Hi,
I am in high school and have some knowlege of PASCAL, we are studying parabolas in my math class at the moment and I was wondering if someone could write me up a program that would determine the equation of a parabola with any given three points. Or rather how could I go about translating the process( by which the equation of a parabola is determined by three points) listed below into PASCAL?
As far as I have tried I couldn't figure out how make PASCAL solve my problems through the substitution method.
All help is appreaciated. Thank You
-john32
==========================================================================
The equation for a parabola is y = ax^2 + bx + c
So if you have three points, you can calculate the equation of the
parabola. But you need three points.
Let's say the points are (-4,15) (2,3) and (1,-5). Notice that these
points have an x value and a y value, and the equation has a place
for x and a place for y.
So for each point you could plug in the the x and y values.
(-4,15): y = ax^2 + bx + c <=== x=-4, y=15
15 = a(-4)^2 + b(-4) + c
15 = 16a - 4b + c
(2,3): y = ax^2 + bx + c <=== x=2, y=3
3 = a(2)^2 + b(2) + c
3 = 4a + 2b + c
(1,-5): y = ax^2 + bx + c <=== x=1, y=-5
-5 = a(1)^2 + b(1) + c
-5 = a + b + c
Now we have these three equations:
15 = 16a - 4b + c
3 = 4a + 2b + c
-5 = a + b + c
There are three equations and three unknowns, so if we can solve these
equations for a, b, and c, we will be able to turn y = ax^2 + bx + c
into the equation for the graph.
Step 1: pick an equation at random and solve for one unknown
-5 = a + b + c
c = -5 - a - b
Step 2: plug that into both of the other equations
15 = 16a - 4b + c <=== c = -5 - a - b
15 = 16a - 4b + (-5 - a - b)
15 = 15a - 5b - 5
20 = 15a - 5b
3 = 4a + 2b + c <=== c = -5 - a - b
3 = 4a + 2b + (-5 - a - b)
3 = 3a + b - 5
8 = 3a + b
Now we have only two equations with two unknowns:
20 = 15a - 5b
8 = 3a + b
Step 3: pick an equation at random and solve for one unknown
8 = 3a + b
b = 8 - 3a
Step 4: plug that into the other equation
20 = 15a - 5b <=== b = 8 - 3a
20 = 15a - 5(8 - 3a)
20 = 15a - 40 + 15a
60 = 15a + 15a
60 = 30a
60/30 = a
a = 2
Step 4: plug that into the answer for step 3
b = 8 - 3a <=== a=2
b = 8 - 3(2)
b = 2
Step 5: plug both of those into the answer from Step 1
c = -5 - a - b <=== a=2, b=2
c = -5 - (2) - (2)
c = -9
The equation for a parabola is y = ax^2 + bx + c and we have values
for a, b, and c, so:
y = ax^2 + bx + c <=== a=2, b=2, c=-9
y = 2x^2 + 2x - 9
And that's the equation of our parabola.
========================================================================