Was: how to make a curve motion with ball object

Quote:

Originally Posted by

**jim829** A curve is nothing more than a series of x,y coordinates. So if f(x) is your curve equation then y = f(x) provides the two points.

To start off simple, use y = mx + b for a straight line. By varying the sign and value of the slope (m) and the y intercept(b) you can draw a diagonal line. If you want to move the object from upper left corner to lower right corner of a square, use y = x, where the slope would be 45 degrees (or m = 1).

Regards,

Jim

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 vice-versa).

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

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 vice-versa) in a curve. Nor does y = f(x) rule that out.

db

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,

Jim

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

Quote:

Also, there is no requirement that there be two values of x for 1 value of y (or vice-versa) in a curve.

1. Do you agree that for a curve we need a 2nd degree equation?

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 vice-versa) ?

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

Re: how to make a curve motion with ball object

Quote:

Originally Posted by

**Kuttappu** 2. Can you give a simple 2nd degree curve equation which does not have 2 values of x for 1 value of y (or vice-versa) ?

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)?

But that is not the point. The issue was what it takes to generate a curve, not a parabola. Here is an example:

Code:

`for (double x = 1; x < 10; x+= .1) {`

double y = x*x;

}

The coordinates generated will provide a curve. Just because y = x^2 is symmetric about the y-axis does not mean you need to use all of it to generate a curve.

Regards,

Jim

Re: how to make a curve motion with ball object

Quote:

Originally Posted by

**Kuttappu** Hi Darryl,

Firstly, it is Kuttappu, not kuggappu.. Kuttappu is my name.. :)-:

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.

Quote:

Originally Posted by

**Kuttappu** 1. Do you agree that for a curve we need a 2nd degree equation?

2. Can you give a simple 2nd degree curve equation which does not have 2 values of x for 1 value of y (or vice-versa) ?

1. No.

2. Exponential function - Wikipedia, the free encyclopedia

db

Re: how to make a curve motion with ball object

Quote:

Originally Posted by

**DarrylBurke**

Quote:

Originally Posted by

**Kuttappu** 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).

Except for exponential curves, any?.

Quote:

Originally Posted by

**jim829** But that is not the point. The issue was what it takes to generate a curve, not a parabola. Here is an example:

Code:

`for (double x = 1; x < 10; x+= .1) {`

double y = x*x;

}

The coordinates generated will provide a curve. Just because y = x^2 is symmetric about the y-axis does not mean you need to use all of it to generate a curve.

Regards,

Jim

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

Re: how to make a curve motion with ball object

Quote:

Originally Posted by

**Kuttappu** 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".

Every polynomial of degree 'n' (highest exponent value) has exactly n roots (possibly complex).

kind regards,

Jos

Re: how to make a curve motion with ball object

I believe you are still missing the point. Here is what you said earlier:

Quote:

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 vice-versa).**

For a curve, you do not need two values of x for one value of y (or vice-versa). No one except you was talking about conic sections. The discussion was what it takes to make a curve.

Regards,

Jim

Re: how to make a curve motion with ball object

Quote:

Originally Posted by

**jim829** I believe you are still missing the point. Here is what you said earlier:

For a curve, you do not need two values of x for one value of y (or vice-versa). No one except you was talking about conic sections. The discussion was what it takes to make a curve.

Regards,

Jim

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?

Re: Was: how to make a curve motion with ball object

Since the question asked in http://www.java-forums.org/new-java/...ll-object.html was answered in the first response, I've split this discussion to a new thread.

db

Re: how to make a curve motion with ball object

Quote:

Originally Posted by

**JosAH** Every polynomial of degree 'n' (highest exponent value) has exactly n roots (possibly complex).

kind regards,

Jos

Yes, i agree.. Thats my point, so y=x² also has two values for x if u substitute any value for y (except 0, when both solutions of x become 0).

Thank you for framing in better words what i meant to say. :)

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.

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,

Jim

Re: how to make a curve motion with ball object

Quote:

Originally Posted by

**Kuttappu** 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.

This discussion was split in two sections; you'll find the other section (containing all your other posts) in the 'Form Lobby'. I was just reading this discussion while it was split ;-)

kind regards,

Jos

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

Re: Was: how to make a curve motion with ball object

Moved the rest of the off topic posts here.

db

Re: Was: how to make a curve motion with ball object

Thank you Jim, Darryl and JasAh, nice discussion.

:) see you.