473,695 Members | 1,786 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

help asap


HELP ME PLEASE!! my email is th************* *@yahoo.com

I can't get the ball to go up right side and then I need it to turn

around and keep turning until velocity=0 I have been at it for the

past 2 weeks now i give up and call for help. Please if anyone can

gide me through i will be so grateful!! I have pasted my code below

from cmath import *

from visual import *

floor1 = box(length=10, height=0.5, width=4, color=color.blu e)

floor1.pos = (-6,4,0)

floor1.axis= (5,-5,0)

floor2 = box(length=10, height=0.5, width=4, color=color.blu e)

floor2.pos = (6,4,0)

floor2.axis= (-5,-5,0)

floor3 = box(length=7, height=0.5, width=4, color=color.blu e)

floor3.pos = (0,1.25,0)

ball= sphere(radius=0 .5, color=color.red )

ball.pos=(-8.6,7.5,0)

m=3. #kg

angle=asin(3.6/5.)#radians

g=-9.8

mu=.2

N=mgcos(angle)

F=mgsin(angle)

f=mu*N

lax=(-Nsin(angle)+fco s(angle))/m

lay=(-Ncos(angle)-fsin(angle)+m*g )/m

rax=(+Nsin(angl e)+fcos(angle))/m

ray=(-Ncos(angle)-fsin(angle)+m*g )/m

ds=0.01

dt=0.01

vx=lax*dt

vy=lay*dt

ball.velocity=v ector(vx,vy,0)

#print a

while 1:

rate(100)

ball.velocity.x =ball.velocity. x+lax*dt

ball.velocity.y =ball.velocity. y+lay*dt

ball.pos=ball.p os+ball.velocit y*dt

if ball.x>-3.5 and ball.x<=3.5:

vx=sqrt(2(-gball.y+0.5(vx2 +vy2)-fds))

ball.velocity.x =ball.velocity. x+mugdt

ball.velocity.y =0

ball.pos=ball.p os+ball.velocit y*dt

if ball.x>3.5 and ball.x<8.6:

vx=vx*cos(angle )

vy=sqrt(2/m(m-gball.y-fds))

#print vy

vy=vy*sin(angle )

#print vy

ball.velocity.x =ball.velocity. x+rax*dt

ball.velocity.y =ball.velocity. y+ray*dt

ball.pos=ball.p os+ball.velocit y*dt

#print ball.pos


Jul 18 '05 #1
1 1949
the_proud_famil y wrote:
HELP ME PLEASE!! my email is th************* *@yahoo.com

I can't get the ball to go up right side and then I need it to turn

around and keep turning until velocity=0 I have been at it for the

past 2 weeks now i give up and call for help. Please if anyone can

gide me through i will be so grateful!! I have pasted my code below

from cmath import *

from visual import *

floor1 = box(length=10, height=0.5, width=4, color=color.blu e)

floor1.pos = (-6,4,0)

floor1.axis= (5,-5,0)

floor2 = box(length=10, height=0.5, width=4, color=color.blu e)

floor2.pos = (6,4,0)

floor2.axis= (-5,-5,0)

floor3 = box(length=7, height=0.5, width=4, color=color.blu e)

floor3.pos = (0,1.25,0)

ball= sphere(radius=0 .5, color=color.red )

ball.pos=(-8.6,7.5,0)

m=3. #kg

angle=asin(3.6/5.)#radians

g=-9.8

mu=.2

N=mgcos(angle)

F=mgsin(angle)

f=mu*N

lax=(-Nsin(angle)+fco s(angle))/m

lay=(-Ncos(angle)-fsin(angle)+m*g )/m

rax=(+Nsin(angl e)+fcos(angle))/m

ray=(-Ncos(angle)-fsin(angle)+m*g )/m

ds=0.01

dt=0.01

vx=lax*dt

vy=lay*dt

ball.velocity=v ector(vx,vy,0)

#print a

while 1:

rate(100)

ball.velocity.x =ball.velocity. x+lax*dt

ball.velocity.y =ball.velocity. y+lay*dt

ball.pos=ball.p os+ball.velocit y*dt

if ball.x>-3.5 and ball.x<=3.5:

vx=sqrt(2(-gball.y+0.5(vx2 +vy2)-fds))

ball.velocity.x =ball.velocity. x+mugdt

ball.velocity.y =0

ball.pos=ball.p os+ball.velocit y*dt

if ball.x>3.5 and ball.x<8.6:

vx=vx*cos(angle )

vy=sqrt(2/m(m-gball.y-fds))

#print vy

vy=vy*sin(angle )

#print vy

ball.velocity.x =ball.velocity. x+rax*dt

ball.velocity.y =ball.velocity. y+ray*dt

ball.pos=ball.p os+ball.velocit y*dt

#print ball.pos

Let me open by saying I'm sorry of this response appears superficially
unhelpful. Please read it to the end, as it really is intended to help
despite its obstinate refusal to directly address your question.

This appears to be your third attempt to recruit help, which shows
rather poor learning behavior. You have presented what appears
(superficially, most people who contribute to this newsgroup don't have
the time to read random chunks of code and I'm usually the same) to be
the same program each time.

Might I suggest that you:

1. Explain what the program is intended to
do. If we can't know what problem you
are trying to solve we are unlikely to
be able to help.

2. Reformat your code to use leading spaces
rather than tabs (many newsreaders
handle tabs badly)

3. Add copious comments explaining what each
section of your program is supposed
to do.

With luck, those activities alone will help you to solve your own
problem. One valid debugging technique is to explain to somebody else
exactly why there can't possibly be anything wrong with your program.
Quite often you will smack your head in the middle of this activity,
having realized exactly what your mistaken assumption has been. If there
is no human available a stuffed toy can work almost as well.

Finally, please take the time to read

http://www.catb.org/~esr/faqs/smart-questions.html

as this will give you some useful clues on how to increase your chances
of getting a rely that will *actually solve your problem* rather than
just pointing out that your current behavior is unlikely to do so.

It's just occurred to me that in the time it's taken me to write this I
probably could have run your code (had it been properly formatted) and
attempted to find out what was wrong with it. So please take this advice
in the spirit of "if you give a man a fish you feed him for a day*, if
you teach him to fish you feed him for a lifetime" -- I am trying to
help you help yourself, as several others have already.

Finally, one crucial lesson for any would-be programmer is to persevere
(and you do at least score high marks there). The longer your problem
goes unsolved the better you'll feel about eventually arriving at a
solution.

regards
Steve
--
* alternative ending: if you teach him to fish, for the rest of his life
he'll bore you with stories about the one that got away.

http://www.holdenweb.com
http://pydish.holdenweb.com
Holden Web LLC +1 800 494 3119
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

7
1294
by: Peter Butler | last post by:
OK, lets see... I have 10 text boxes to enter keywords into a form page (The master search page) These boxes are either set or not set when passed to the result page as set or unset variables. Depending on which variables have been set, the set variables are used to formulate the query.
4
1815
by: Shelly | last post by:
This is driving me crazy and makes no sense. Any suggestions will be appreciated. I upload an image to a staging area. I have written software to look at the images, and if accepted it is moved to the user's area. The user's area for images is at users/the_username/photo/ where users is a directory off the root. The staging area is tmp_photo/, also off the root. When it is in the staging area, I see the image. Using identical...
2
2077
by: AnuSree | last post by:
hi am getting error when am trying to type cast.is it possible to type cast from one type of vector to another type.is there any other way other than overloading.my peice of code in which am getting error is.
2
1408
by: SC | last post by:
I'm having a problem getting this validation script to work. There are two images on the page with the ids of img_antirobot and img_chk_agree. In the final page it will validate about 12 entries, so this is just a snippet. If there are blank entries, the script is to change the appropriate images to warning icons. Unfortunately it aways errors at the getElementById with "undefined" as the reason. I know the names are right, so what's the...
1
1650
by: Massimo Bonanni | last post by:
Hi, I try to implement ASAP protocol in my web service, but I find a very hard problem. I define my SOAP Header: public class Request : SoapHeader {
4
1687
by: briggsie2006 | last post by:
I need to write a program called wc.py. It promts the user to input a filename and outputs the number of lines, words, and, characters in the file. I really need help on this because I don't know what to do. email me at briggsie2006@hotmail.com asap if you can help me out.
8
1575
by: Dhananjay | last post by:
hello everyone Do you have any information how to generate a tool using .net which is used to translate the web page contents to html format. Plz reply me asap Thanks in advance Dhananjay
15
2574
by: Jay | last post by:
I have a multi threaded VB.NET application (4 threads) that I use to send text messages to many, many employees via system.timer at a 5 second interval. Basically, I look in a SQL table (queue) to determine who needs to receive the text message then send the message to the address. Only problem is, the employee may receive up to 4 of the same messages because each thread gets the recors then sends the message. I need somehow to prevent...
3
1989
by: splintercell | last post by:
well i got this code from java.sun.com and tried modiifying it in all the possible ways,but to no good.. stil its not workin..pleas help me out and try postin good workinw web cralwer if u have.. need help asap... import java.applet.Applet; import java.text.*; import java.awt.*; import java.awt.List; import java.awt.event.*; import java.util.*;
1
1586
by: khandelwalk1 | last post by:
here is a java code, wich is supposed to read a file name from user n read its contents and display it, bt its nt working..ne1 dere cud help me...jus copy n paste dis code in a notepad file wid name TsetofFile.java n save another input notepad file in bin to give it as input to code. Execute this code n give dat file name...bt its showng File nt found..watz rong in dis...plz help me asap...!! import java.io.*; import java.net.*; class...
0
8587
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
9140
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
9005
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8867
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7688
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
4351
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4599
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3025
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
1987
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.