Why am I getting a syntax error in my Ti - 84 ce plus code?

125 views Asked by At

The menu shows up but then I get an error right away. I have a feeling it has something to do with the indentation or the calling functions area but I am not sure. I've already tried Chat GPT multiple times but it won't give me the correct code. It only gives me a syntax error every time I have tried to run it.

ClrHome
StoreGDB 5
AxesOff
BorderColor 4
BackgroundOff
ClrDraw
Disp "      Conic Solver"
Disp "==========================="
Disp "1: Identify Conic"
Disp "2: Standard Form"
Disp "3: Equation to Standard Form"
Disp "4: Quit"
Input "Option:", M
ClrHome

If M=1
Then
  Disp "Identify Conic Section"
  Input "A=", A
  Input "B=", B
  Input "C=", C
  Input "D=", D
  Input "E=", E
  Input "F=", F
  If A = 0 and C = 0
  Then
    Disp "Invalid Equation"
  ElseIf A = C and D = 0 and E = 0
  Then
    Disp "Conic Section: Circle"
  ElseIf A ≠ C and D = 0 and E = 0
  Then
    Disp "Conic Section: Hyperbola"
  ElseIf A = C and D ≠ 0 and E ≠ 0
  Then
    Disp "Conic Section: Parabola"
  Else
    Disp "Conic Section: Unknown"
  End
  Pause
  Goto CONIC_PROGRAM
End

If M=2
Then
  Disp "Standard Form"
  Menu("Select Conic Section","Hyperbola",11,"Circle",12,"Ellipse",13,"Parabola",14,"Back",99)
  Lbl 11 ; Hyperbola
  Prompt F1, F2, G1, G2, D
  (F1 - F2)^2 - D^2 -> A
  (G1 - G2)^2 - D^2 -> B
  If A < 0 or B < 0
  Then
    Disp "Invalid Input"
  Else
    (F1 + F2) / 2 -> H
    (G1 + G2) / 2 -> K
    Disp "Standard Form:"
    Disp "(X - ", H, ")^2 / ", A, " - (Y - ", K, ")^2 / ", B, " = 1"
  End
  Pause
  Goto CONIC_PROGRAM

  Lbl 12 ; Circle
  Prompt H, K, R
  Disp "Standard Form:"
  Disp "(X - ", H, ")^2 + (Y - ", K, ")^2 = ", R^2
  Pause
  Goto CONIC_PROGRAM

  Lbl 13 ; Ellipse
  Prompt H, K, A, B
  Disp "Standard Form:"
  Disp "(X - ", H, ")^2 / ", A^2, " + (Y - ", K, ")^2 / ", B^2, " = 1"
  Pause
  Goto CONIC_PROGRAM

  Lbl 14 ; Parabola
  Prompt H, K, F, G
  If H = F and K = G
  Then
    Disp "Invalid Input"
  ElseIf H = F
  Then
    Disp "Standard Form:"
    Disp "X = ", H
  ElseIf K = G
  Then
    Disp "Standard Form:"
    Disp "Y = ", K
  Else
    sqrt((F - H)^2 + (G - K)^2) -> P
    If F > H
    Then
      Disp "Standard Form:"
      Disp "(Apologies for the incomplete response. There seems to be an issue with the code indentation in my previous response as well. Here's the updated code with corrected indentation:

```plaintext
ClrHome
StoreGDB 5
AxesOff
BorderColor 4
BackgroundOff
ClrDraw
Disp "      Conic Solver"
Disp "==========================="
Disp "1: Identify Conic"
Disp "2: Standard Form"
Disp "3: Equation to Standard Form"
Disp "4: Quit"
Input "Option:", M
ClrHome

If M=1
Then
  Disp "Identify Conic Section"
  Input "A=", A
  Input "B=", B
  Input "C=", C
  Input "D=", D
  Input "E=", E
  Input "F=", F
  If A = 0 and C = 0
  Then
    Disp "Invalid Equation"
  ElseIf A = C and D = 0 and E = 0
  Then
    Disp "Conic Section: Circle"
  ElseIf A ≠ C and D = 0 and E = 0
  Then
    Disp "Conic Section: Hyperbola"
  ElseIf A = C and D ≠ 0 and E ≠ 0
  Then
    Disp "Conic Section: Parabola"
  Else
    Disp "Conic Section: Unknown"
  End
  Pause
  Goto CONIC_PROGRAM
End

If M=2
Then
  Disp "Standard Form"
  Menu("Select Conic Section","Hyperbola",11,"Circle",12,"Ellipse",13,"Parabola",14,"Back",99)
  Lbl 11 ; Hyperbola
  Prompt F1, F2, G1, G2, D
  (F1 - F2)^2 - D^2 -> A
  (G1 - G2)^2 - D^2 -> B
  If A < 0 or B < 0
  Then
    Disp "Invalid Input"
  Else
    (F1 + F2) / 2 -> H
    (G1 + G2) / 2 -> K
    Disp "Standard Form:"
    Disp "(X - ", H, ")^2 / ", A, " - (Y - ", K, ")^2 / ", B, " = 1"
  End
  Pause
  Goto CONIC_PROGRAM

  Lbl 12 ; Circle
  Prompt H, K, R
  Disp "Standard Form:"
  Disp "(X - ", H, ")^2 + (Y - ", K, ")^2 = ", R^2
  Pause
  Goto CONIC_PROGRAM

  Lbl 13 ; Ellipse
  Prompt H, K, A, B
  Disp "Standard Form:"
  Disp "(X - ", H, ")^2 / ", A^2, " + (Y - ", K, ")^2 / ", B^2, " = 1"
  Pause
  Goto CONIC_PROGRAM

  Lbl 14 ; Parabola
  Prompt H, K, F, G
  If H = F and K = G
  Then
    Disp "Invalid Input"
  ElseIf H = F
  Then
    Disp "Standard Form:"
    Disp "X = ", H
  ElseIf K = G
  Then
    Disp "Standard Form:"
    Disp "Y = ", K
  Else
    sqrt((F - H)^2 + (G - K)^2) -> P
    If F > H
    Then
      Disp "Standard Form:"
      Disp "(X - ", H, ")^2 = 4 * ", P, "(Y - ", K, ")"
    Else
      Disp "Standard Form:"
      Disp "(Y - ", K, ")^2 = -4 * ", P, "(X - ", H, ")"
    End
  End
  Pause
  Goto CONIC_PROGRAM
End

If M=3
Then
  Disp "Equation to Standard Form"
  Menu("Select Conic Section","Hyperbola",21,"Circle",22,"Ellipse",23,"Parabola",24,"Back",99)
  Lbl 21 ; Hyperbola
  Prompt A, B, C, D, E, F
  Disp "Standard Form:"
  Disp "(X^2 / ", A, ") - (Y^2 / ", B, ") = 1"
  Pause
  Goto CONIC_PROGRAM

  Lbl 22 ; Circle
  Prompt A, B, C, D, E, F
  Disp "Standard Form:"
  Disp "(X - ", A, ")^2 + (Y - ", B, ")^2 = ", C^2
  Pause
  Goto CONIC_PROGRAM

  Lbl 23 ; Ellipse
  Prompt A, B, C, D, E, F
  Disp "Standard Form:"
  Disp "((X - ", A, ")^2 / ", C^2, ") + ((Y - ", B, ")^2 / ", D^2, ") = 1"
  Pause
  Goto CONIC_PROGRAM

  Lbl 24 ; Parabola
  Prompt A, B, C, D, E, F
  If A = 0 and B = 0
  Then
    Disp "Invalid Equation"
  ElseIf A = B
  Then
    Disp "Standard Form:"
    Disp "X = ", A, " + (Y - ", B, ")^2"
  ElseIf A = -B
  Then
    Disp "Standard Form:"
    Disp "X = ", A, " - (Y - ", B, ")^2"
  Else
    Disp "Standard Form:"
    Disp "Y = ", B, " + (X - ", A, ")^2"
  End
  Pause
  Goto CONIC_PROGRAM
End

If M=4
Then
  ClrHome
  RecallGDB 5
  BackgroundOff
  AxesOn 
  Stop
End

Lbl CONIC_PROGRAM
Menu("CONIC PROGRAM","Identify Conic",1,"Standard Form",2,"Equation to Standard Form",3,"Quit",4)
1

There are 1 answers

0
Quaris On

I see multiple obvious syntax errors here:

  • Lines cannot be indented at all.
  • There is no such thing as an underscore character on the TI84.
  • There is no such thing as a semicolon character on the TI84.

...I assume this code was generated by Chat GPT?

Try removing the indentation, redoing the Goto/Lbl identifiers to be numbers or single letters, and removing the comment that starts with a semicolon.

As an aside, I see no reason to do the graph setup functions like ClrDraw, StoreGDB, and AxesOff, and if there is such a thing as a BackgroundOff command I have zero memory of it.

There might be other problems with the code too, I haven't ran it or inspected it that closely for functional problems.