Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Education > Math > Re: Determine q...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 3 of 3 Topic 4051 of 4322
Post > Topic >>

Re: Determine quadratic polynomial

by "AvdBerg" <NIETDITMAARavdberg@[EMAIL PROTECTED] > May 4, 2008 at 07:27 PM

"Robert Larsen" <robert@[EMAIL PROTECTED]
> schreef in bericht
news:481b307f$0$27377$d40e179e@[EMAIL PROTECTED]
> Hi group
>
> I seem to have lost all math skills :-(
>
> I am trying to determine the coefficients of a quadratic polynomial
> given the following data:
>
> x1,y1 - One point on the curve
> x2,y2 - Another point on the curve
> y3    - The Y coordinate of the top coordinate
>
> y3 > y1 and y3 > y2
> x2 > x1
>
> I believe this should yield exactly one solution but have no idea how to
> find it. Can you help me ?
> It should be used for calculating the path for an animation in a
> computer game.
>
> Sincerely,
> Robert

coordinates:   (x1,y1) , (x2,y2)  and  top(??,q)

y = a(x-p)^2 + q

y1 = a(x1-p)^2 + q

-->     a = (y1-q)/((x1-p)^2)   (I)

        [x1 = p is special case]

y = (y1-q) * (x-p)^2 / (x1-p)^2 + q

y2 = (y1-q) * (x2-p)^2 / (x1-p)^2 + q

(y2-q) = (y1-q) * (x2-p)^2 / (x1-p)^2
(y2-q) * (x1-p)^2 = (y1-q) * (x2-p)^2
(y2-q) * (x1^2 - 2px1 +p^2) = (y1-q) * (x2^2 - 2px2 + p^2)

p^2 * ((y2-q) - (y1-q)) + p * (-2x1*(y2-q) + 2x2*(y1-q)) + (x1^2 * (y2-q)
-
x2^2 * (y1-q)) = 0
p^2 * (y2-y1) + p * (-2x1 * (y2-q) + 2x2 * (y1-q)) + (x1^2 * (y2-q) - x2^2
*
(y1-q)) = 0

D = ( -2x1 * (y2-q) + 2x2 * (y1-q) )^2 - 4 * (2*(y2-y1)) * (x1^2 * (y2-q)
-
x2^2 * (y1-q))
D = 4 * (x1-x2)^2 * (y1-q) * (y2-q)

    [D>0   (y1,y2 < q or y1,y2 > q)  -->  2 solutions]

p = (2x1*(y2-q) - 2x2*(y1-q)) / (2*(y2-y1)) +/- sqr[D] / (2*(y2-y1))

-->     p = ( x1*(y2-q) - x2*(y1-q) +/- (x1-x2) * sqr[(y1-q)*(y2-q)] ) /
(y2-y1)   (II)

        [y1 = y2 is special case]


example 1.

y = - x^2 + 4x + 1     take   (0,1) , (3,4) , ([2],5)

p= (0*-1 - 3*-4  +/- 3*sqr[(-1)(-4)] ) / 3     (from II)
p = (12 +/- 6) / 3

p+ = 18 / 3 = 6
p- =  6 / 3 = 2

a(p=6) = (1 - 5)/(0 - 6)^2 = -1/9              (from I)

-->    y = -1/9(x-6)^2 + 5

a(p=2) = (1 - 5)/(0 - 2)^2 = -1

-->    y = -(x-2)^2 + 5             [ y = - x^2 + 4x + 1 ]

example 2.

y = -2x^2 + 5x - 3     take  (2,-1) , (-3,-36) , ([1.25],0.125)

p = (2*-36.125 + 3*-1.125 +/- 5*sqr[-1.125*-36.125] ) / -35
p = (-75.625 +/- 31.875) / -35

p+ = -43.75 / -35 = 1.25
p- = -107.5 / -35 = 43/14

a(p=1.25) = (-1.125)/(2-1.25)^2 = -2

-->    y = -2(x-1.25)^2 + 0.125     [ y = -2x^2 + 5x - 3 ]

a(p=43/14) = -1.125/(2 - 43/14)^2 = -0.98

-->    y = -0.98*(x-43/14)^2 + 0.125


There will be 2 solutions.
One with p (= x_top) between x1 and x2.


special cases:

x1 = p      (y1=q)           --> a = (y2-q) / (x2-p)^2

y1 = y2 --> p = (x1 + x2)/2  --> a = 4(y1-q) / (x1-x2)^2

AvdB
 




 3 Posts in Topic:
Determine quadratic polynomial
Robert Larsen <robert@  2008-05-02 17:27:18 
Re: Determine quadratic polynomial
"[Mr.] Lynn Kurtz&qu  2008-05-02 19:12:29 
Re: Determine quadratic polynomial
"AvdBerg" <N  2008-05-04 19:27:02 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Fri Nov 21 7:59:41 CST 2008.