Symmetric Quartic Equation - Python
Note: The code is programmed with a TI-84 Evo. No modules are used, so the scripts should be adopted to other calculators with ease.
Introduction
The script find the roots of a symmetric quartic equation:
a * x^4 + b * x^3 + c * x^2 + b * x + a = 0
The coefficients of x^4 and x^0 (constant) are equal, and the coefficients of x^3 and x^1 (x) are equal.
a * x^4 + b * x^3 + c * x^2 + b * x + a = 0
a * (x^4 + 1) + b * (x^3 + x) + c * x^2 = 0
Assuming that x ≠ 0, divide by x^2:
a * (x^2 + 1/x^2) + b * (x + 1/x) + c = 0
Per Jan Tuma, Ph.D (see source):
Let y = x + 1/x
Then y^2 = x^2 + 2 + 1/x^2
and y^2 – 2 = x^2 + 1/x^2
Substitute y^2 – 2 for x^2 + 1/x^2 and simplify:
a * y^2 + b * y + (c – 2 * a) = 0
Solving for y for y0 and y1:
y = ( -b ± √(b^2 – 4 * a * (c – 2 * a)) ) ÷ (2 * a)
Then:
y = x + 1/x
0 = x^2 – y * x + 1
Solve for the final solutions x1, x2, x3, and x4:
x = ( y0 ± √(y0^2 – 4) ) ÷ 2
and
x = ( y1 ± √(y1^2 – 4) ) ÷ 2
Script: SYMQTRC.py
(coded with a TI-84 Evo)
# quadratic formula
# no module required
def quad(a,b,c):
d=b**2-4*a*c
x1=(-b+d**0.5)/(2*a)
x2=(-b-d**0.5)/(2*a)
return [x1,x2]
# 2026-10-11 EWS
from math import *
print("Symmetric Quartic")
print("ax**4+bx**3+cx**2+bx+a=0")
a=eval(input("a? "))
b=eval(input("b? "))
c=eval(input("c? "))
y=quad(a,b,c-2*a)
y0=-y[0]
y1=-y[1]
x0=quad(1,y0,1)
xa=x0[0]
xb=x0[1]
x1=quad(1,y1,1)
xc=x1[0]
xd=x1[1]
print("roots:")
print(xa)
print(xb)
print(xc)
print(xd)
Examples
Note: j = 1 = √(-1)
Example 1:
x^4 + 3 * x^3 – 6 * x^2 + 3 * x^2 + 1 = 0
Inputs:
a: 1, b: 3, c: -6
Outputs (rounded for this blog, the code does not round results):
-4.4783
-0.22330
0.82078 + 0.52552 * j
0.82078 - 0.52552 * j
Example 2:
2 * x^4 – 5 * x^3 + 8 * x^2 – 5 * x + 2 = 0
Inputs:
a: 2, b: -5, c: 8
Outputs (rounded for this blog, the code does not round results):
0.39005 + 0.54903 * j
0.39005 - 0.54903 * j
0.85995 + 1.2105 * j
0.85995 - 1.2105 * j
Source
Tuma, Jan J. Ph. D Handbook of Numerical Calculations in Engineering McGraw-Hill Publishing Company. New York, NY. 1989. ISBN 0-07-065446-8. pg. 125
Note: Due to circumstances beyond my control, I moved up all scheduled November posts from the second half of November 2026 to November 13. The next post will be on December 12, 2026.
Eddie
All original content copyright, © 2011-2026. Edward Shore. Unauthorized use and/or unauthorized distribution for commercial purposes without express and written permission from the author is strictly prohibited. This blog entry may be distributed for noncommercial purposes, provided that full credit is given to the author.