I've made a code for finding the general equation of an ellipse. Unfortunately, it is rather useless at the moment, since you will have to already know that the form you are dealing with is an ellipse! I am working on branching this code out to include the main loci, then it should be
EPIC. Since the equation may appear unfactored (grrr), I have included the solutions for a^2,b^2,h,k in
. The "Output" commands were ****** up so I had to mess around with them to get them right, they might work differently on another calculator. Also, the program is 507 (kb, b, kB?), so it could use some tidying up.
OH yeah, and a BIG THING to note is that you have to solve your expression = 0, then put it in, i.e.:
You type:
(~4 seconds to evaluate)
loci()
Prgm
ClrIO
Input "Input Expression",q
x+y*i→z
zeros(d(q,x),x)→list4
list4[1]→j
zeros(q|x=j,y)→list4
1/2*abs(list4[1]-list4[2])→a
1/2*(list4[1]+list4[2])→k
zeros(q|y=k,x)→list4
1/2*abs(list4[1]-list4[2])→b
ClrIO
Disp "Input Expression"
Disp q
If a=b Then
Disp "Circle"
Else
Disp "Ellipse"
EndIf
Disp (x-j)^2/a^2+(y-k)^2/b^2=1
Pause
Output 76,1,"h="
Output 64,26,j
Output 63,75,"k="
Output 63,97,k
Pause
Output 80,1,"a^2="
Output 63,35,a^2
Output 65,76,"b^2="
Output 63,111,b^2
EndPrgm
The program works by identifying the coordinates of the stationary points of the ellipse (since that is the only way I know to do it). It then uses this information to find the rest of the values. The planned program will require extensive use of stationary points:
0 stat points => Left-right Hyperbola, Line, Inverse parabola
1 stat points => Parabola
2 stat points => Ellipse, Up-down Hyperbola
My current dilemma is in
trying to find a way for the calc to recognise the # of solutions, and furthermore to recognise the type of locus required. Comments and advice would be appreciated
EDIT: Code for y=ax^2+bx+c parabola:
para()
Prgm
Input "Input Expression",q
zeros(d(q,x),x)→h
zeros(q|x=h,y)→t
t→k
{}→t
zeros(q|y=k-1,x)→t
If t={} Then
zeros(q|y=k-1,x)→t
t[1]→r
t[2]→s
zeros(a*(x-r)*(x-s)-y|x=h and y=1,a)→a
Disp expand(y=a*(x-r)*(x-s)+k-1)
Else
t[1]→r
t[2]→s
zeros(a*(x-r)*(x-s)-y|x=h and y=-1,a)→a
Disp expand(y=a*(x-r)(x-s)+k+1)
EndIf
EndPrgm
Once again, solve equal to 0, then type the expression, e.g.:
or