find equation from 2 points and 1 y-value

stormloop

New member
Joined
Nov 3, 2020
Messages
3
first of all, I do not know if this is the right category since I don't use the English terms, please move it if it isn't.
Second of all, I'm 15, so please don't explain this too complicated to me.
I'm programming a little project and decided to go extra fancy but I got myself into trouble doing that.
Using a(x-alpha)^2+bèta
There are 2 points on a graph. One of which is (0;0) and the other one has a positive x and positive y

1604438295882.png

Now I need an parabolic equation that goes through both points. But there are an infinite amount of those equations.
So to counter that I limited the y-value of the top of the parabolic equation. Say the top is the y of point B * 1.125 following that, the equation has to draw a "mountain parabole"
1604438744394.png
Which leaves only 2 possible parabolic equations going through these 2 points and having a bèta of 4.5.
I realize the second equation doesn't go through the two points but let's just imagine it does.
I know, because that's how I want to implement it, that I need the equation with 0<alpha<4.
This gives me 0.5(x-3)^2+4.5.
Now this is reverse engineered, I took a random equation and made the points and bèta up.
But for this to work in my program I need a general formula to put in the second point, since A is fixed, and have bèta being the y-value of B * 1.125 and it outputs the function.
I've tried a lot of approaches on paper with my dad already but none of them worked out.
I am convinced this is possible.
Can anyone help me with this?
 
I'm programming a little project and decided to go extra fancy but I got myself into trouble doing that.
Using a(x-alpha)^2+bèta
There are 2 points on a graph. One of which is (0;0) and the other one has a positive x and positive y

View attachment 22848

Now I need an parabolic equation that goes through both points. But there are an infinite amount of those equations.
So to counter that I limited the y-value of the top of the parabolic equation. Say the top is the y of point B * 1.125 following that, the equation has to draw a "mountain parabole"
View attachment 22849
Which leaves only 2 possible parabolic equations going through these 2 points and having a bèta of 4.5.
I realize the second equation doesn't go through the two points but let's just imagine it does.
I know, because that's how I want to implement it, that I need the equation with 0<alpha<4.
This gives me 0.5(x-3)^2+4.5.
Now this is reverse engineered, I took a random equation and made the points and bèta up.
But for this to work in my program I need a general formula to put in the second point, since A is fixed, and have bèta being the y-value of B * 1.125 and it outputs the function.
I've tried a lot of approaches on paper with my dad already but none of them worked out.
I am convinced this is possible.
Can anyone help me with this?

You've made a good start. (I'm just not sure what your B*1.125 refers to.)

You want a curve [MATH]y = a(x-\alpha)^2+\beta[/MATH], where [MATH]a[/MATH] and [MATH]\alpha[/MATH] are unknown, but [MATH]\beta[/MATH] is known and it passes through the points (0, 0) and (u, v), say. You need to find [MATH]a[/MATH] and [MATH]\alpha[/MATH], right?

Put the two points into the equation:

[MATH](0, 0)\rightarrow 0 = a(0-\alpha)^2+\beta[/MATH]​
[MATH](u, v)\rightarrow v = a(u-\alpha)^2+\beta[/MATH]​

Now you need to eliminate one of the two unknowns. One way is to solve the first equation for [MATH]a[/MATH], and substitute that into the second equation. You will end up with a quadratic equation in [MATH]\alpha[/MATH], which you will have to solve by the quadratic formula. That takes a little work, but the result is not too bad.
 
The bèta = y * 1.125 is my way of having bèta not be completely unknown.
I'm quite surprised i didn't think of this since we learned this in school. I do remember doing something similar by substituting but i dont think it was exactly this, either way i ended up with an exponential 3 so i couldn't continue since that exceeds my knowledge.
So i don't currently have access to a piece of paper but to make this a program that the computer would understand i'd basically go as far as possible with the parameters u and v and substitute those with the constant, it's constant because the first point is always (0, 0), alpha = sqrt(bèta) / sqrt(-a). Using yhis k can find a, then filling in a i'd find 2 values for alpha because we're using square roots which gives us both a negative and a positive value. After that we can find alpha, once again we get 2 values, one linked to the first a and one to the other. We take out the correcr alpha value with it's corresponding a value and we've got the function. That should be it, right? If I'm very honest I've created such a monster...
 
What you describe doesn't sound quite right; it's hard to predict what you'll be doing without actually doing it. So just do it, and show actual work when you have a chance.

My suggestion was to solve for [MATH]a[/MATH], not [MATH]\alpha[/MATH], in the first equation, because I think that makes the work simpler (no square roots until the end).
 
I have had some time now to write this all down on some paper and have ran into a problem, i have first tried substituting a, and then alpha since it didn't seem to work.
With substitution of a:
0 = a(0-alpha)^2 + beta
<=> a = beta / alpha^2
u = a(v-alpha)^2 + beta
<=> u = beta/alpha^2(v-alpha)^2 + beta
<=> u = beta/alpha^2(v^2-2alpha*v+alpha^2) + beta
<=> beta*v^2/alpha^2 - 2*beta*v/alpha + 2*beta - u = 0
To work away the fractions, multiply by a^2
<=> beta*v^2 - 2*beta*v*alpha + 2*beta*alpha^2 - u*alpha^2 = 0
<=> (2*beta-u)alpha^2 - 2*beta*v*alpha + beta*v^2 = 0
Using letter D as this is how we do it in belgium
D = (-2*beta*v) -4*(2*beta-u)*beta*v^2
When calculating this with u =4 = v and beta = 4.5 we get D = -144 which would mean no value for alpha exists, but we know for sure it does since i've drawn it in the beginning of thos thread.
Now with substitute of alpha:
0 = a(0-alpha)^2 + beta
<=> alpha = sqrt(beta/a)
u = a(v- alpha)^2 + beta
<=> av^2 -2av*sqrt(beta/a) + beta/a + beta - u = 0
Now when multiplying by a to get some frqctions away we'd have sqrt(b*a) which I'm unable to solve in a quadratic formula
 
I have had some time now to write this all down on some paper and have ran into a problem, i have first tried substituting a, and then alpha since it didn't seem to work.
With substitution of a:
0 = a(0-alpha)^2 + beta
<=> a = beta / alpha^2
u = a(v-alpha)^2 + beta
<=> u = beta/alpha^2(v-alpha)^2 + beta
<=> u = beta/alpha^2(v^2-2alpha*v+alpha^2) + beta
<=> beta*v^2/alpha^2 - 2*beta*v/alpha + 2*beta - u = 0
To work away the fractions, multiply by a^2
<=> beta*v^2 - 2*beta*v*alpha + 2*beta*alpha^2 - u*alpha^2 = 0
<=> (2*beta-u)alpha^2 - 2*beta*v*alpha + beta*v^2 = 0
Using letter D as this is how we do it in belgium
D = (-2*beta*v) -4*(2*beta-u)*beta*v^2
When calculating this with u =4 = v and beta = 4.5 we get D = -144 which would mean no value for alpha exists, but we know for sure it does since i've drawn it in the beginning of thos thread.
Now with substitute of alpha:
0 = a(0-alpha)^2 + beta
<=> alpha = sqrt(beta/a)
u = a(v- alpha)^2 + beta
<=> av^2 -2av*sqrt(beta/a) + beta/a + beta - u = 0
Now when multiplying by a to get some frqctions away we'd have sqrt(b*a) which I'm unable to solve in a quadratic formula
You missed a negative sign in your second line. You also swapped my definition of u and v, so that your given point is (v, u), which is not really a problem.

Fix the sign and try again!
 
Top