473,403 Members | 2,183 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,403 software developers and data experts.

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.blue)

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

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

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

floor2.pos = (6,4,0)

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

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

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)+fcos(angle))/m

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

rax=(+Nsin(angle)+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=vector(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.pos+ball.velocity*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.pos+ball.velocity*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.pos+ball.velocity*dt

#print ball.pos


Jul 18 '05 #1
1 1887
the_proud_family 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.blue)

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

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

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

floor2.pos = (6,4,0)

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

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

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)+fcos(angle))/m

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

rax=(+Nsin(angle)+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=vector(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.pos+ball.velocity*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.pos+ball.velocity*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.pos+ball.velocity*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
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...
4
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...
2
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...
2
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,...
1
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
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...
8
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
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...
3
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.....
1
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...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
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...
0
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,...
0
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...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.