Results 1 to 18 of 18
 06262013, 06:53 PM #1
Was: how to make a curve motion with ball object
Correct me if i am wrong. He asked for curve right? I believe y=f(x) can never give you a curve.
For a curve there will be 2 values of x for 1 value of y (or viceversa).
So you will need y=f(x²).
But again, since you get 2 values of x for each y, you will need logic to take negative/positive values first.
eg: in this equation 4ay=x² for parabola if we take a=4 and y=1, we will get +4 and 4 values for x..
so if you give this directly in loop it wont wont. In loop, do the loop such that it iterate as follows:
y=1, x=2
y=2, x=1
y=3, x=0
y=2, x=1
y=1, x=2
It will help you understand more if you draw this in a graph and do some thinking..
Hope this will help you.. :)Last edited by Kuttappu; 06262013 at 06:59 PM.
 06262013, 07:05 PM #2
Re: how to make a curve motion with ball object
Kuggappu, please limit yourself to subjects you understand. You clearly don't understand the mathematical significance of y = f(x).
Also, there is no requirement that there be two values of x for 1 value of y (or viceversa) in a curve. Nor does y = f(x) rule that out.
dbIf you're forever cleaning cobwebs, it's time to get rid of the spiders.
 06262013, 08:59 PM #3Senior Member
 Join Date
 Jan 2013
 Location
 Northern Virginia, United States
 Posts
 4,026
 Rep Power
 6
Re: how to make a curve motion with ball object
f(x) simply means a function of x, where x is the independent variable. So f(x) = x^2 +3x + 6 is an example. So f(2) = 16. However, in two dimensions the horizontal axis is x and the vertical axis is f(x) or y. This is algebra 101.
Note: I did make one mistake. f(x) is a mathematical expression, not a mathematical equation. y = f(x) is an equation.
Regards,
JimLast edited by jim829; 06262013 at 09:12 PM.
The Java^{TM} Tutorials  SSCCE  Java Naming Conventions
Poor planning on your part does not constitute an emergency on my part
 06272013, 12:26 AM #4
Re: how to make a curve motion with ball object
Hi Darryl,
Firstly, it is Kuttappu, not kuggappu.. Kuttappu is my name..
I made a mistake that instead of writing 1st degree equation and second degree equation, i wrote y=f(x) and y=f(x²)..
Also, there is no requirement that there be two values of x for 1 value of y (or viceversa) in a curve.
FN: ax²+bxy+cy²+dx+ey+f=0 is the general equation for conical section.
You can derive equation of ellipse, hyperbola, parabola, etc from this. Whatever equation it is, if it is a curve it will be 2nd degree equation. Agree?
2. Can you give a simple 2nd degree curve equation which does not have 2 values of x for 1 value of y (or viceversa) ?
Any equation of parabola, hyperbola or ellipse?
How many solutions are there for a second degree equation (after you substitute for either x or y, when u l get a quadratic equation)?
FN:If you draw any line parallel to directrix or latex rectum, between vertex and infinity, it will touch "TWO" points in the curve. QED
I believe only at vertex 2 solution of the equation are equal.
Note: All above are based on the assumption, that the curve is drawn in 2D. Also, i think exponential curves are exception to this (correct me if i am wrong).
This may be a subject beyond my understanding, but i don't limit myself coz i am curious, please correct me again if i am wrong.. :)
 06272013, 01:43 AM #5Senior Member
 Join Date
 Jan 2013
 Location
 Northern Virginia, United States
 Posts
 4,026
 Rep Power
 6
Re: how to make a curve motion with ball object
But that is not the point. The issue was what it takes to generate a curve, not a parabola. Here is an example:
Java Code:for (double x = 1; x < 10; x+= .1) { double y = x*x; }
Regards,
JimLast edited by jim829; 06272013 at 01:49 AM.
The Java^{TM} Tutorials  SSCCE  Java Naming Conventions
Poor planning on your part does not constitute an emergency on my part
 06272013, 04:22 AM #6
Re: how to make a curve motion with ball object
Sorry about that. My response was typed in a power cut, racing against the UPS battery going down and I shut down the computer as soon as I had posted it.
1. No.
2. Exponential function  Wikipedia, the free encyclopedia
dbIf you're forever cleaning cobwebs, it's time to get rid of the spiders.
 06272013, 01:52 PM #7
Re: how to make a curve motion with ball object
Except for exponential curves, any?.
Jim, you have taken one side (positive half) of parabola, right? Thats good, i like it.. :).
what you have given is an equation of parabola. (y=x²) Here is the image of the parabola: https://www.google.co.in/search?q=y%...w=1366&bih=659
Also, in that equation itself there are two values of x for 1 value of y (you wont know it since you looped x, you are taking positive half only).
If you get the solution for it, then
when y=1, x=1 or +1
when y=4, x=2 or +2
But that is mathematics.
So can i conclude like,
"There are two (or more) solutions for a curve equation (2nd degree or higher) (exponential curves are exception) in mathematics, but we put limits to get part of a curve in computer screen".
So one last question..
If i want a parabola, i will be needing two loops right? one as Jim said and another after that, with negative values of x. (Since computer screen is 1st quadrant we l take x as screen_x_axis+100 and y as screen_y_axis+100, or something like that? So we get a complete parabola?? )
After all, to bounce a ball, you will need a parabola. :D
Thank you Darryl and Jim. :).
 06272013, 02:31 PM #8
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 13,776
 Blog Entries
 7
 Rep Power
 21
 06272013, 05:37 PM #9Senior Member
 Join Date
 Jan 2013
 Location
 Northern Virginia, United States
 Posts
 4,026
 Rep Power
 6
Re: how to make a curve motion with ball object
I believe you are still missing the point. Here is what you said earlier:
Correct me if i am wrong. He asked for curve right? I believe y=f(x) can never give you a curve.
For a curve there will be 2 values of x for 1 value of y (or viceversa).
Regards,
JimThe Java^{TM} Tutorials  SSCCE  Java Naming Conventions
Poor planning on your part does not constitute an emergency on my part
 06272013, 06:12 PM #10
Re: how to make a curve motion with ball object
The equation you gave in program is derived from general equation of conic section (ax²+bxy+cy²+dx+ey+f=0)
y=x²(the equation u gave in your program) is derived from equation of parabola (y²=4ax or x²=4ay) where a=1/4.
You gave limits of x from 1 to 10, which takes only positive half of the parabola..
(If u give the equation y=x² to mathematician they will give 2 sets of values of x for every value of y. In you are program u r limiting to one half of parabola, right?).
How can it not be part of conic section?
Of course in a programmer point of view you dont need to know all mathematics, but just when you said no one is taking about conic section, you are actually using equation of conic section in your program. Am i wrong?
 06272013, 06:22 PM #11
Re: Was: how to make a curve motion with ball object
Since the question asked in how to make a curve motion with ball object was answered in the first response, I've split this discussion to a new thread.
dbIf you're forever cleaning cobwebs, it's time to get rid of the spiders.
 06272013, 06:25 PM #12
 06272013, 06:39 PM #13
Re: how to make a curve motion with ball object
Posts deleted?
So bad.. 1st time i am seeing someone say y*y=x is not conic section. Without mathematics there is no computer science.
One guy asked for curve n you give equation of straight line?
y=mx+b is for curve? good keep up the good work.
Moderators, is this the way you do? I am quitting this forum. Please do a favor, delete my account details.
 06272013, 06:45 PM #14Senior Member
 Join Date
 Jan 2013
 Location
 Northern Virginia, United States
 Posts
 4,026
 Rep Power
 6
Re: how to make a curve motion with ball object
First, no one deleted anything. Darryl simply started a new thread since it was going off topic. No one has disputed that y = x*x is a conic section. And I am the one who suggested y = mx + b. The OP had said they could only go left, right, up, and down. So I suggested the OP try a diagonal first and then move to a curve. Why are you so angry?
Regards,
JimThe Java^{TM} Tutorials  SSCCE  Java Naming Conventions
Poor planning on your part does not constitute an emergency on my part
 06272013, 06:47 PM #15
 Join Date
 Sep 2008
 Location
 Voorschoten, the Netherlands
 Posts
 13,776
 Blog Entries
 7
 Rep Power
 21
Re: how to make a curve motion with ball object
cenosillicaphobia: the fear for an empty beer glass
 06272013, 06:48 PM #16
Re: how to make a curve motion with ball object
Oh am sorry..
It was a nice discussion, felt sad and angry when i saw all posts got deleted..
Am sorry everyone..
 06272013, 08:21 PM #17
Re: Was: how to make a curve motion with ball object
Moved the rest of the off topic posts here.
dbIf you're forever cleaning cobwebs, it's time to get rid of the spiders.
 06272013, 09:20 PM #18
Similar Threads

how to make a curve motion with ball object
By nisael in forum New To JavaReplies: 3Last Post: 01192014, 06:08 AM 
Make an object from a class once
By OddOne in forum New To JavaReplies: 7Last Post: 07032012, 06:04 PM 
Freehand curve smoothing using Bezier Curve
By JavaIsChallenging in forum Java 2DReplies: 3Last Post: 12142011, 08:56 PM 
How do I make My ball to move randomly?
By whdbstjr90 in forum New To JavaReplies: 4Last Post: 12312007, 06:32 PM 
Problem deleting ball from bouncing ball app
By adlb1300 in forum New To JavaReplies: 2Last Post: 12032007, 10:08 PM
Bookmarks