Friday, November 13, 2026

Symmetric Quartic Equation - Python

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


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.

Python: Drawing Perspective

Python: Drawing Perspective




The goal: draw lines towards the center (0,0), creating the perspective of looking directly towards a point in the distance.



The script asks for two inputs:

h: the height of the wall

n: the number of lines drawn (half of the wall)



Best results are achieved when n divides in h evenly.



Python: Using Turtle (Numworks)





(h = 100, n = 5)

Code:

from math import *

from turtle import *


# inputs

h=eval(input("height? "))

n=int(input("# of steps? "))


speed(7)


# loop

for i in range(-n,n+1):

  penup()

  y=i*h/n

  goto(-160,y)

  pendown()

  goto(160,-y)


hideturtle()



Python: Using TI-Draw (TI-84 Evo)



(h = 100, n = 5)


Code:

# Math Calculations

from math import *

from ti_draw import *


# 2026-07-20 EWS

# perspective drawing


# inputs

h=eval(input("height? "))

n=int(input("# of steps? "))




# set up screen

clear()

set_window(-160,160,-105,105)


# loop

for i in range(-n,n+1):

  y=i*h/n

  draw_line(-160,y,160,-y)


# show drawing

show_draw()


Enjoy and have a great day,


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.


Spotlight: HP 35 Calculator (1972)

Spotlight: HP 35 Calculator (1972)








Here it is, the first every handheld scientific calculator: the Hewlett Packard HP 35 from 1972!

I got it at the HHC 2026 Conference earlier this month, and I thank you, David Ramsey, Gene Wright, Ron Grant, and Mark Sims. (Rest in peace, Mr. Sims)


The 35 came with a working Ni-CAD battery pack and the original plug in charger. The keyboard and the leather case are in excellent condition. I also have the little booklet.


The HP 35 is Version 4, and in this version, the functions are labeled on top of the keys instead of above them. All the labels are in capital letters. In earlier versions, some of the labels were in lower case (see the Functions of the 35 section).


I also have a 3-AAA Alkaline battery adapter from Waterhosko that is for HP classic calculator series (35, 45, 55, 80, 65, 67).


I feel like I have finally arrived.


Quick Facts


Model: HP 35

Company: Hewlett Packard

Type: RPN Scientific

Memory: 1 (store, recall)

Years in Production: 1972 to 1975

Display: 10 digits

Original Price: $ 395.00


Hardware, Simulators, and Emulators


The hardware may not be easy to come by, although there are still some HP 35 calculators available through auction sites such as eBay.


There are plenty of simulators and emulators for the HP 35. For example, the pockemul app, available for both Android, Apple iOS, Windows, and mac0S, contains many past calculators and pocket computers. One of the calculators that are offered at no cost is the HP 35 (the version shown is an earlier version (not red dot) where the functions are labeled above the keys).


Site: https://pockemul.com/


A Javascript simulator, hosted by the MoHPC (Museum of HP Calculators) site, is written by Neil Fraser. The simulator may also be downloaded: https://www.hpmuseum.org/simulate/hp35sim/hp35sim.htm


Functions on the HP 35


The HP 35 has one shift key, and that is only for the trigonometric functions.


[ x^y ]: power key, note the order of the variables

[ log ]: common logarithm (log10)

[ ln ]: natural logarithm, base e

[ e^x ]: exponential function

[ √x ]: principal square root

[ sin ]: sine function, angle is in degrees

[ arc ] [ sin ]: arcsine function, returns the angle in degrees

[ cos ]: cosine function, angle is in degrees

[ arc ] [ cos ]: arccosine function, returns the angle in degrees

[ tan ]: tangent function, angle is in degrees

[ arc ] [ tan ]: arctangent function, returns the angle in degrees

[ clr ]: sets all four stacks (X, Y, Z, T) and the memory register to 0

[ 1/x ]: reciprocal

[ x<>y ]: swap the contents of X and Y

[ R↓ ]: roll down the stack (T → Z, Z → Y, Y → X, X → T)

[ STO ]: store the contents of the X stack into memory

[ RCL ]: recall the contents of memory to the X stack, pushes up the contents up the stack (whatever was in stack T was lost)

[ ENTER ]: pushes the contents of memory form the X stack to the Y stack, everything gets pushed up one level (whatever was in stack T was lost). Entering a new number replaces the copied number in the X stack.

[ CHS ]: changes the sign of the number of the X stack. For the HP 35 only, the sign can be changed before or after the number has been entered.

[ - ], [ + ], [ × ], [ ÷ ]: arithmetic keys

[ π ]: Enters pi (π) to the X stack. (3.141592654)


The Power Function


I hope you have noticed something about the power function. Usually the power function on must calculators (especially non-graphing scientific ones) usually are labeled y^x. On most RPN calculators, the number on the Y stack is treated as base while the number on the X stack is treated as the exponent.


This isn’t the case on the HP 35: the key is labeled x^y. The variables are reversed. On the HP 35’s power function, the number on the number of X stack is the base, while the number on the Y stack is treated as the exponent.


For example, let’s try to calculate 1.8^3.

On the HP 35: 3 [ ENTER ] 1.8 [ x^y ] returns 5.832000001


Now try 3^4.

On the HP 35: 4 [ ENTER ] 3 [ x^y ] returns 81.00000001

But 3^4 = 81. Why the extra .00000001?


Accuracy


Try: 1 ÷ 3 × 3

1, [ ENTER ], 3, [ ÷ ], 3, [ × ]

This returns .9999999999

(we would expect 1)


To put it simply, the HP 35 works with floating point numbers which are presented with a 10-digit mantissa and a 2-digit exponent. Numbers are stored as binary-coded decimal as 56 bit numbers. The calculator rounds off results in at 11th decimal place, leaving a possibility of the 10th place of a possible error of ±1 digit.


With the internal algorithms used with trigonometric, exponential, and other transcendental functions, round off errors can build up and show up in the 10th decimal place.


Something to keep in mind when doing calculations: The HP 35 does not have a fixed decimal place setting, so rounding to more accurate results falls to the responsibility of the user.


For more information:



Cochran, David S. “Algorithms and Accuracy in the HP-35” HP Journal. June 1972. Retrieved from

https://www.keesvandersanden.nl/calculators/hp_journals/HP_Journal_7206_Algorithms_and_Accuracy_in_the_HP-35.pdf

(Retrieved November 11, 2026)



“HP 35” Wikipedia. Last Edited on December 13, 2025. Retrieved November 11, 2026.

https://en.wikipedia.org/wiki/HP-35







Final Thoughts



The HP 35 is a well-time honored calculator and has brought the world of scientific computing to many in a handheld package. It is a delight to use and the red LCD display is timeless.


This would make an excellent entry-level scientific calculator for those who are learning RPN for the first time, providing a wealth of functions for a wide range of calculations. I recommend this calculator, physical handled and/or emulator.



Eddie


HHC Conference Videos

Please check out the Youtube page hpcalc.org at https://www.youtube.com/@hpcalc .   

Videos and talks from HP Calculator conferences until HCC 2025 are posted.   Look out for talks from HCC 2026 to posted there soon.  Disclaimer:  I do not run this account.  


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.



HP 67 Collection: November 2026

HP 67 Collection: November 2026



All examples are done in FIX 4. (DSP 4)



Circular Sector – Degrees


R: radius

Θ°: angle in degrees

Arc Length: A = Ï€ * Θ° * R ÷ 180

Chord Length: L = 2 * R * sin(Θ° ÷ 2)



Input Stack:

Y: Θ°

X: R



Code:

LBL A : 001 31, 25, 11

ENTER : 002 41

ENTER : 003 41

CLx : 004 44

- : 005 51

R↓ : 006 35, 53

x<>y : 007 35, 52

R↓ : 008 35, 53

DEG : 009 35, 41

→R : 010 35, 73

× : 011 71

-x- : 012 31, 84 (show arc length)

R↓ : 013 35, 53

R↓ : 014 35, 53

2 : 015 02

÷ : 016 81

SIN : 017 31, 62

× : 018 71

RTN: 019 35, 22 (show chord length)



Examples



Inputs: Y: Θ = 45°, X: R = 8.36

Outputs: Arc Length: 6.5659, Chord Length: 17.2208



Inputs: Y: Θ = 30°, X: R = 7.92

Outputs: Arc Length: 4.1469, Chord Length: 7.7646



Inputs: Y: Θ = 120°, X: R = 10

Outputs: Arc Length: 20.9440, Chord Length: 103.9230





Capacitor Voltage Across an RC Circuit



Vc = Vi * (1 – e^(-t ÷ (R * C))



Inputs:

T: Vi: step voltage (Volts, V)

Z: t: time elapsed (Seconds)

Y: R: resistance (Ohms, Ω)

X: C: capacity (Farads, F)



Output:

Vc: voltage across the RC circuit (Volts)



Code:

LBL B : 001 31 25 12

× : 002 71

÷ : 003 81

CHS: 004 42

e^x : 005 32, 52

1 : 006 01

x<>y : 007 35, 52

- : 008 51

× : 009 71

RTN : 010 35, 22



Examples



Inputs:

T: Vi: 18 V

Z: Time: 250 * 10^-3 sec

Y: Resistance: 3300 Ω

X: Capacitance: 47 * 10^-6 F



Output: 14.4087 V



Inputs:

T: Vi: 30 V

Z: Time: 0.5 sec

Y: Resistance: 2000 Ω

X: Capacitance: 53 * 10^-6 F



Output: 29.7317 V



Source



Texas Instruments. Slide Rule Calculator SR-50A Manual. 1975. Manual from datamath.org: http://www.datamath.net/Manuals/SR-50A_US.pdf pg. 61





Ideal Thermal Voltage and Shockley Diode Equation



Thermal Voltage:

Vt = k * T ÷ q * 10^3 (mV)



Constant used (values taken from a Casio fx-9910CW):

k: Boltzmann Constant: 1.380649 * 10^-23 J/K

q (e): Electron Charge: 1.602176634 * 10^-19 C

k/q ≈ 1 / 11604.51812



The equation can be simplified to (SI units):



Vt ≈ (T°C + 273.15) ÷ 11604.51812



Shockley Diode Equation:

Id = Is * (exp(vD ÷ (n * vt)) – 1)

Ideal: n = 1



Then:

Id = Is * (exp(vD ÷ vt – 1)



Input Stack:

Z: Is: reverse bias saturation current (in milliamps)

Y: Vd: voltage across the diode (millivolts)

X: T°C: temperature in Celsius (°C)



Outputs:

Vt: thermal voltage (millivolts) – stored in memory register 1

Id: diode current (milliamps) – stored in memory register 2



Code:

LBL C : 001 31 25 13

ENTER: 002 41

2 : 003 02

7 : 004 07

3 : 005 03

. : 006 83

1 : 007 01

5 : 008 05

+ : 009 61

1 : 010 01

1 : 011 01

6 : 012 06

0 : 013 00

4 : 014 04

. : 015 83

5 : 016 05

1 : 017 01

8 : 018 08

1 : 019 01

2 : 020 02

÷ : 021 81

3 : 022 03

10^x : 023 32, 53

× : 024 71

STO 1 : 025 33 01

-x- : 026 31 84 (show Vt)

÷ : 027 81

e^x : 028 32 52

1 : 029 01

- : 030 51

× : 031 71

STO 2 : 032 33 02 (show Id)

RTN : 033 35 22



Examples:



Inputs:

Z: Is: 35 mA

Y: Vd: 40 mV

X: T°C: 27 °C

Outputs:

Vt: 25.8649 mV

Id: 129.3246 mA



Inputs:

Z: Is: 35 mA

Y: Vd: 40 mV

X: T°C: 33 °C

Outputs:

Vt: 26.3820 mV

Id: 124.4189 mA





Inputs:

Z: Is: 35 mA

Y: Vd: 10 mV

X: T°C: 33 °C

Outputs:

Vt: 26.3820 mV

Id: 16.1312 mA



Source:

“Shockley Diode Equation” Wikipedia. Last Edited November 13, 2025.

https://en.wikipedia.org/wiki/Shockley_diode_equation

Retrieved June 19, 2026.





Angle of a Banked Turn



Determine the angle of a banked turn, which is a turn which a vehicle includes towards the inside of a turn. The slope is usually sloped down towards the center of the curve. In this equation, friction is not considered.



The banked turn in degrees, not considering friction:



Θ° = arctan( v² ÷ (r * g)) * 180 ÷ Ï€



v: velocity of the vehicle

r: radius of the curve

g: gravitational constant.

Θ: banked angle



Note: We can apply elevation and latitude if desired:

g_ø, h ≈ (9.806 – 0.026 * cos(ø°)) * (6378.1 ÷ (6378.1 + ø))

(ø is latitude (North/South) in degrees, h is elevation in kilometers)



In this program, the standard Earth’s gravity constant is used (g = 9.80665 m/s²). The program switches angle modes: first to radians then to degrees.



Input Stack:

Y: radius (in meters)

X: velocity (in meters per second)



Output: banked angle in degrees



Code:

LBL A : 001 31 25 11

RAD : 002 35 42

x² : 003 32 54

x<>y : 004 35 52

9 : 005 09

. : 006 83

8 : 007 08

0 : 008 00

6 : 009 06

6 : 010 06

5 : 011 05

× : 012 71

÷ : 013 81

TAN^-1 : 014 32 64

D← : 015 31 73

DEG : 016 35 41

RTN : 017 35 22



Example:



Input:

Y: r: 1280 m

X: v: 16 m/s



Output:

Θ: 1.1683°

Source

The Engineering ToolBox (2012). Banked Turn. [online] Available at: https://www.engineeringtoolbox.com/banked-turn-d_1844.html Accessed June 24, 2026



Another day with one of my favorite calculators. Until next time,



Eddie


HHC Conference Videos

Please check out the Youtube page hpcalc.org at https://www.youtube.com/@hpcalc .   

Videos and talks from HP Calculator conferences until HCC 2025 are posted.   Look out for talks from HCC 2026 to posted there soon.  Disclaimer:  I do not run this account.  


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.


Symmetric Quartic Equation - Python

Symmetric Quartic Equation - Python Note: The code is programmed with a TI-84 Evo. No modules are used, so the scripts should be adopt...