I am writing a program to deal with differential equations for AP Calculus BC class, and the slope field code (shown below) has worked for exponential differential equations. I tried to graph the slope field for an ellipse (using J instead of Y in Y1), but the slope lines on the left are much too long even though I thought that my code checking if the R value was greater than 0.4 would check for that. I would appreciate any help.
(Sorry, I couldn't get the image to load as I just made an account to ask this question, but if you want to graph it you can see)
Lbl 2
0.4→Z
iPart(Xmin)→Q
iPart(Ymin)→W
For(J,W,iPart(Ymax),1)
If abs(Ymin-J)<Z
Then
J+1→J
End
For(C,Q,iPart(Xmax),1)
If abs(Xmin-C)<Z
Then
C+1→C
End
J+0.00000001→J
If abs(D*Y₁(C))>100
Then
Z→R
0→D
Else
J-0.00000001→J
If (Y₁(C))>1
Then
(Z/Y₁(C))→D
Z→R
Else
Z*Y₁(C)→R
Z→D
End
End
If R>Z
Then
(Z/Y₁(C))→D
Z→D
End
(C-D)→A
(J-R)→S
(C+D)→N
(J+R)→M
If N>Xmax
Xmax→N
If S<Ymin
Ymin→S
If S>Ymax
Ymax→S
If M<Ymin
Ymin→M
If M>Ymax
Ymax→M
Line(A,S,N,M)
End
End