- #1
curiouschris
- 147
- 0
Not a homework question but this seems to be the appropriate place...
1. Homework Statement
I would like to be able to calculate the intersections of two parabola's which accounts for one or both of the parabola's being shifted along the x axis
I have written an excel vba function to do this and it all works fine as long as the parabola's are in the form of [itex]ax^2+bx+c[/itex]
If I try to use [itex]a(x-h)^2+bx+c[/itex] I get lost
I have included the VBA function so you can see my working out
An example is the following equations
[tex]x^2+138x+317[/tex]
[tex](x -33.33167)^2+2222[/tex]
3. The Attempt at a Solution
I have attempted to resolve this myself but find my fingers hovering over the keyboard and I am sure the look of a stunned mullet on my face.
My online searches have produced zilch examples of what I am trying to do.
Its the step to the quadratic formula that loses me.
The best I could do is the following but my div by zero test fails as it does not take into account x (which is not in the divisor) So I am guessing I can't use the quadratic formula but I am not sure what else to use...
[tex]x = (-(b1-b2) +/- sqrt((b1-b2)^2 - 4*(a1-a2)*(c1-c2)))/(2*(a1-a2)) + (h1-h2)[/tex]
Attribution
To get me to the point of creating the VBA function I used this resource
http://zonalandeducation.com/mmts/i...woParabollas1/intersectionOfTwoParabolas1.htm
1. Homework Statement
I would like to be able to calculate the intersections of two parabola's which accounts for one or both of the parabola's being shifted along the x axis
I have written an excel vba function to do this and it all works fine as long as the parabola's are in the form of [itex]ax^2+bx+c[/itex]
If I try to use [itex]a(x-h)^2+bx+c[/itex] I get lost
I have included the VBA function so you can see my working out
Code:
Function QQInterceptX(a1, b1, c1, a2, b2, c2, pos)
' returns the x intercept
' y1=a1x^2+b1x+c1
' y2=a2x^2+b2x+c2
' when they intersect then the following is true
' a2x^2+b2x+c2=a1x^2+b1x+c1 as the y values are equivalent
' using algebra we get the following
' x=(a1x^2 - a2x^2) + (b1x - b2x) + (c1 - c2)
' x=(a1-a2)x^2 + (b1-b2)x + (c1-c2)
' we can then solve using the quadtratic formula
' x = (-(b1-b2) +/- sqrt((b1-b2)^2 - 4*(a1-a2)*(c1-c2)))/(2*(a1-a2))
' check for div by 0
If ((a1 - a2) <> 0) Then
' return the positive x intercept
If (pos) Then
QQInterceptX = (-(b1 - b2) + Sqr((b1 - b2) ^ 2 - 4 * (a1 - a2) * (c1 - c2))) / (2 * (a1 - a2))
Else
QQInterceptX = (-(b1 - b2) - Sqr((b1 - b2) ^ 2 - 4 * (a1 - a2) * (c1 - c2))) / (2 * (a1 - a2))
End If
Else
QQInterceptX = CVErr(xlErrNA)
End If
Homework Equations
An example is the following equations
[tex]x^2+138x+317[/tex]
[tex](x -33.33167)^2+2222[/tex]
3. The Attempt at a Solution
I have attempted to resolve this myself but find my fingers hovering over the keyboard and I am sure the look of a stunned mullet on my face.
My online searches have produced zilch examples of what I am trying to do.
Its the step to the quadratic formula that loses me.
The best I could do is the following but my div by zero test fails as it does not take into account x (which is not in the divisor) So I am guessing I can't use the quadratic formula but I am not sure what else to use...
[tex]x = (-(b1-b2) +/- sqrt((b1-b2)^2 - 4*(a1-a2)*(c1-c2)))/(2*(a1-a2)) + (h1-h2)[/tex]
Attribution
To get me to the point of creating the VBA function I used this resource
http://zonalandeducation.com/mmts/i...woParabollas1/intersectionOfTwoParabolas1.htm