Discussion about math, puzzles, games and fun.   Useful symbols: ÷ × ½ √ ∞ ≠ ≤ ≥ ≈ ⇒ ± ∈ Δ θ ∴ ∑ ∫ • π ƒ -¹ ² ³ °

You are not logged in.

• Index
•  » Help Me !
•  » solving quadratic for randomly determined points

## #1 2006-01-10 05:53:35

Justin
Guest

### solving quadratic for randomly determined points

I am trying to write code to construct a parabola based on three points which are randomly determined at run-time. The problem I am having is that I cannot reduce any equations due to the fact that none of the variables have known values at the time of writing the equations (they will only be known at run-time).

This is as far as I have gotten. I defined c first because it seemed the easiest to isolate. I went for a next, but, as you can see, I ran into a problem where a is defined partially in terms of itself. I am looking to have one of the three (a, b, or c) defined only in terms of the X/Y coordinates. It doesn't matter how long or complicated the equation is. Then one of the other two will be defined in terms of the X/Y cooordinates as well as that previously defined variable. Then the final one will be defined according to anything as long as it doesn't have itself in the definition.

y1 = a*x1^2 + b*x1 + c
y2 = a*x2^2 + b*x2 + c
y3 = a*x3^2 + b*x3 + c

c = y1 - (a*x1^2 + b*x1)

y2 = a*x2^2 + b*x2 + y1 - (a*x1^2 + x1*b)
a*x2^2 = b*x2+y1 - (a*x1^2 - x1*b) - y2
a = (b*x2 + y1 - (a*x1^2 - x1*b) - y2) / x2^2

Anyone able to help with this? Thanks.

## #2 2006-01-10 14:56:42

John E. Franklin
Star Member

Offline

### Re: solving quadratic for randomly determined points

Hi Justin.  This may not help, but who knows?

Define the bottom or top of the parabola at (d,D)

I'll rename your (x1,y1) to be (a,A), just because I feel like it.
And (x2,y2) is (b,B).  And (x3,y3) is (c,C).
Also your "a" multiplier, I will call "N", as it makes the parabola narrower.

Now if you get the point (d,D) and find N, then the equation for the parabola will be
(y-D) = N (x-d)^2

Okay, let's begin:

There are distance relationships in a parabola to do with squares,
hence we can write these equations:

N(a-d)^2 = |A-D|
N(b-d)^2 = |B-D|
N(c-d)^2 = |C-D|

Last edited by John E. Franklin (2006-01-10 15:00:44)

igloo myrtilles fourmis
• Index
•  » Help Me !
•  » solving quadratic for randomly determined points