Saturday, March 7, 2026

TI-84 Plus CE and Swiss Micros DM32: Blood Alcohol Level

TI-84 Plus CE and Swiss Micros DM32: Blood Alcohol Level


Just in time for the upcoming St. Patrick’s Day in a few weeks…


Introduction


The blood alcohol level is calculated by the following approximation by Walter L. Gregory Jr. using data from the CRC Handbook of Tables for Applied Engineering (1970). The program is based off the HP-97/HP-67 program listed in their Medical Practitioner pac (1979). (see source):


BAC ≈ ((ALC * OZ) ÷ 50 – T) * (3.751 ÷ WT)


ALC: Percentage of alcohol consumed. Enter as a whole number. For example, if the drink has 40% alcohol, ALC = 40. If the alcohol is measured in proof, divide the proof by 2.

OZ: The total amount of ounces consumed within the period of time. For example: six 12-oz beers total 72 ounces.

WT: The weight of the person in pounds.

T: The number of hours drinks are consumed. If T > 1, then T = hours – 1. Otherwise T = 0.


If calculated BAC is below 0, then set BAC = 0.


TI-84 Program CE: ALCOHOL

Type: TI Basic


Disp “BLOOD ALCOHOL (US)”

Input “WEIGHT (LB)? “, W

Input “OUNCES? “, O

Input “PERCENTAGE? “, P

Input “HOURS OF DRINKING? “, H

If H≤1 : Then : 0 → H

Else : H – 1 → H : End

(P * O / 50 – H) * 3.751 / W → A

Disp “BLOOD ALCOHOL: “, A


Swiss Micros DM32 (HP 32SII): ALCOHOL


A01 LBL A

A02 INPUT W

A03 INPUT O

A04 INPUT P

A05 INPUT H

A06 RCL H

A07 1

A08 x≥y?

A09 SF 1

A10 STO- H

A11 FS? 1

A12 Cl x

A13 FS? 1

A14 STO H

A15 CF 1

A16 RCL P

A17 RCL× O

A18 50

A19 ÷

A20 RCL- H

A21 3.751

A22 RCL÷ W

A23 ×

A24 x<0?

A25 Cl x

A26 RTN


Notes:


A07 1, A08 x≥y?, A09 SF 1: If hours > 1, set Flag 1. Using flags can sometimes eliminates the need for additional labels.


A24 x<0?, A25 Cl x: If the number in the display (x stack) negative, change it to zero.


Examples


Example 1:

Inputs:

Weight: W = 150 lbs

Ounces: O = 4 oz

Percentage: P = 20%

Hours: H = 0.5 hours (T = 0)

Output: 0.0400


Example 2:

Inputs:

Weight: W = 180 lbs

Ounces: O = 45 oz

Percentage: P = 50%

Hours: H = 2.5 hours (T = 1.5)

Output: 0.0521


Be sure to check your local laws for legal blood alcohol levels. This program is not suited to be evidence in legal matters.


One thing remains: DON’T DRINK AND DRIVE



Source


Hewlett Packard. HP-67/HP-97. User’s Library Solutions: Medical Practitioner. Corvallis, OR. April 1979. pp. 9-12



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.

Saturday, February 28, 2026

TI-84 Plus CE: Logistic Map

TI-84 Plus CE: Logistic Map


It feels like forever since I with the TI-84 Plus CE.


Introduction


The program LOGISTIC plots the sequence


x = r * x * (1 – x)


where x is initially in the interval (0, 1) and r is a parameter. The sequence traces out the path of recursion.


Depending on the value of r, the sequence can eventually stabilize to a single point, fluctuate then stabilize, eventually bounce between two stable points, or going into the chaos. The higher the r, chance of the latter two possibilities increase. Typically, for any r < 3, the sequence will most likely stabilize.



TI-84 Plus CE Program: LOGISTIC.8xp


Type: TI-Basic Program


ClrHome

Disp “LOGISTIC MAP”

Disp “X1=R*X0*(1-X0)”

Seq

FnOff

Menu(“LAMBDA (R)”, “ENTER”, 1, “RANDOM”, 2)

Lbl 1

Input “0<R≤4: “, R

Goto A

Lbl 2

randInt(1,80) / 20 → R

Pause R

Goto A

Lbl A

Menu(“U(1)=”, ”ENTER”, 3, “RANDOM”, 4)

Lbl 3

Input “U(1)? “, U

Goto B

Lbl 4

rand → U

Pause U

Goto B

Lbl B

{U} → u(nMin)

SEQ(n+1)

“R*u(n)*(1-u(n))” → u

FnOn 1

1 → nMin

50 → nMax

0 → Ymin

1 → Ymax

0 → Xmin

50 → Xmax

DispGraph



Notes:


The Time setting is assumed: x-axis = n, y-axis = u__n


nMin: Sets the counter and the index of the first argument. Typically the counter starts with 0 or 1. Keystrokes: [ vars ], 1. Window, scroll to U/V/W, 4. nMin.


Seq: Sets Sequence mode.


I use R for λ since the TI-84 does not have Greek characters (except for π and σ).


randInt(1,80) / 20 → R: Selects random values from 0.05 and 4 with a tick mark of 0.05.


u(nMin): Store the initial conditions. The conditions are entered as a list, even there is only one initial condition. Keystrokes: [ vars ], 1. Window, scroll to U/V/W, 1. u(nMin)


SEQ(n+1): In the program editor, I had to select this from the catalog. It is listed under “SEQ(n+1) Type”. This allows for the recurring sequence to be in the format u(n+1) = f(u(n),n).

R*u(n)*(1-u(n))” → u: The u is type from the keyboard: [ 2nd ] [ 7 ].

FnOn 1: Turns the sequence u(n) on.



Examples




Left: r = 3.67, initial point = 0.2. This looks like total chaos as n grows.


Right: r = 3.1, initial point = 0.5. This sequence does not converge to a single value, but eventually provides a bifurcation between two points.


Caution: If r is too high, even if the u(1) is with in the interval [0, 1], the sequence can “escape” and an overflow can occur. I don’t recommend an r higher than 4.


Source


“Logistic map”. Wikipedia https://en.wikipedia.org/wiki/Logistic_map Retrieved October 20, 2025.



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.

Saturday, February 21, 2026

New Background

 The blog could use change in scenery:




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.


HP 12C: Quickly Approximating Arc Tangent

HP 12C: Quickly Approximating Arc Tangent



The HP 12C does not have trigonometric functions. Various sources list on how such functions are be approximated with varying degrees of accuracy. Today’s blog will feature a quick approximation, using only a 14 step function for the arc tangent (inverse tangent) function.


Formula Used in Approximation

(see Source)


arctan(x) ≈ x ÷ (1 + 0.28125 * x²) = x ÷ (1 + 9 * x² ÷ 32)


Best for -1 ≤ x ≤ 1


Maximum absolute error of 0.0049 radians, approximately 0.28°. The error gets worse outside these ranges. The program rounds the result to 2 decimal places. The angle is returned in radians.


HP 12C Program: Arc-tangent Approximations


FIX 2

01

42, 2

Program start

ENTER

02

36


ENTER

03

36


×

04

20


9

05

9


×

06

20


3

07

3


2

08

2


÷

09

10


1

10

1


+

11

40


÷

12

10


RND

13

42, 14

Round result to 2 decimal places

GTO 00

14

43, 33, 00

Program end

Examples


x = 0.1. Result: 0.10

x = 0.3. Result: 0.29

x = 0.5. Result: 0.47


Source


Sreeraman Rajan, Sichun Wang, Rober Inkol, and Alain Joyal. “Efficient Approximations for the Arctangent Function” IEEE Signal Processing Magazine. May 2006.


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.



Sunday, February 15, 2026

Casio fx-3650P vs. Casio fx-3650P II: Programs


Here are four programs that are done with both the fx-3650P and fx-3650P II to illustrate some programming similarities and differences.


When we start a new program with the fx-3650P II, we are prompted to the choose the appropriate mode at the beginning:


COMP (main calculation with real numbers)

CMPLX (complex numbers, primarily complex number arithmetic)

SD (single-derivation mode, single-variable statistics)

REG (regression mode, two-variable statistics)

BASE (base conversions and Boolean logic)


Left:  Casio fx-3650P (2002), Right:  fx-3650P II (2013)


Program 1: Exponential Distribution


This program calculates:


PDF: e^(-X ÷ A)

CDF (lower tail): 1 - e^(-X ÷ A)


where:

A = 1/λ parameter (i.e. average waiting time, time for an event to occur/fail/succeed)

X = time parameter


fx-3650P, 25 bytes:


? → A : ? → X :

e(-X ÷ A) ÷ A ◢

1 – e(-X ÷ A)


fx-3650P II, 25 bytes:


? → A : ? → X :

e^(-X ÷ A) ÷ A ◢

1 – e^(-X ÷ A)


Example 1:

Inputs: A = 100, X = 50

Outputs: 6.065306597E-3 (*10^-3), 0.39346934


Example 2:

Inputs: A = 50, X = 3

Outputs: 0.01883529, 0.058235466


Program 2: Using Newton’s Method to get the real root of the cubic equation that is closest to zero:


x^3 + A * x^2 + B * x + C = 0


Using Newton’s Method:


x1 = x0 – f(x0) / f’(x0) [ let y = f(x0) / f’(x0) ]


x1 = x0 - (x^3 + A * x^2 + B * x + C) / (3 * x^2 + 2 * A * x + B)



fx-3650P, 72 bytes:


? → A : ? → B : ? → C : 0 → X :

Lbl 0 :

(X³ + AX² + BX + C) ÷ (3X² + 2AX + B) → Y :

√(Y²) → D :

X – Y → X :

D ≥ 1E-8 ⇒ Goto 0 : X


√(Y²) returns Abs(Y) in Comp mode.

D is set up to be the control variable, where

D = abs((x^3 + A * x^2 + B * x + C) / (3 * x^2 + 2 * A * x + B))



fx-3650PII, 67 bytes:


? → A : ? → B : ? → C : 0 → X : 1 → Y :

While Abs(Y) ≥ 1E-8 :

(X³ + AX² + BX + C) ÷ (3X² + 2AX + B) → Y :

X – Y → X :

WhileEnd: X


We could have used the derivative function (d/dx) but typing out the derivative took less room.


Example 1: X³ + 2X² – 5X + 4 = 0

Inputs: A = 2, B = -5, C = 4

Output: -3.663076827


Example 2: X³ – 3X² + 9X + 6 = 0

Inputs: A = -3, B = 9, C = 6

Output: -0.5481911635



Program 3: Sum of the polynomial: Σ((AX + B)^C, X = 1 to Y)


fx-3650P, 57 bytes:


0 → M : ? → A : ? → B : ? → C : ? → Y : 1 → X :

Lbl 0 :

(AX + B)^C M+ : X + 1 → X : X > Y ⇒ Goto 1 : Goto 0 :

Lbl 1 : M



fx-3650PII, 41 bytes:


0 → M : ? → A : ? → B : ? → C : ? → Y : 1 → X :

For 1 → X To Y : (AX + B)^(C) M+ : Next : M



Example 1: Σ((5X – 3)^2, X = 1 to 8)

Inputs: A = 5, B = -3, C = 2, Y = 8

Output: 4092



Example 2: Σ((2X + 1)^3, X = 1 to 10)

Inputs: A = 2, B = 1, C = 3, Y = 10

Output: 29160


Program 4: Complex Roots of Unity


x^n = 1


where:

x = cos(2 * m * π / n) + i * sin(2 * m * π / n) = r * e^(2 * m * i / n)

m = 0 to n – 1, i = j = √-1


fx-3650P, 47 bytes:


Switch to complex mode. The CMPLX indicator will be displayed but not shown as a step.


Rad : ? → A : 0 → B :

Lbl 0 :

cos(2 B π ÷ A) + i × sin(2 B π ÷ A) ◢

1 + B → B : A > B ⇒ Goto 0 : 1


We must have an else condition when the jump command is used, that is why the second one is there. Also, that one “indicates” the end.


fx-3650PII, 34 bytes:


Rad : ? → A :

For 0 → B To A :

cos(2 B π ÷ A) + i × sin(2 B π ÷ A) ◢

Next : 1


The second one “indicates” the end and can be omitted.


In complex mode, the real and imaginary parts are displayed on part at a time. A settle R←→I indicator displays at the right hand side of the screen. Switch between seeing the parts by pressing [ SHIFT ] [ EXE ].


Example 1: x^3 = 1

Input: A = 3

Outputs:

1 + 0 i

-0.5 + 0.866025403 i

-0.5 - 0.866025403 i


Example 2: x^5 = 1

Input: A = 5

Outputs:

1 + 0 i

0.309016994 + 0.951056516 i

-0.809016994 + 0.587785252 i

-0.809016994 - 0.587785252 i

0.309016994 - 0.951056516 i


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: Casio fx-3650PII and Comparison with the fx-3650P and fx-50FH (II)

 Spotlight: Casio fx-3650PII and Comparison with the fx-3650P and fx-50FH (II)




Quick Facts: fx-3650P II



Model: fx-3650P II

Company: Casio

Type: Solar Scientific Algebraic, Programmable with battery backup: 1 x LR44/AP76

Memory: 7 memory registers: A, B, C, D, X, Y, M (M has memory addition and subtraction)

Programming Memory: 390 bytes, 4 program slots

Years in Production: 2013 (per fx-3650PII manual) to Present

Primary Market: Asia

Display: 10 digits


Casio’s fx-3650PII web page: https://www.casio.com/intl/scientific-calculators/product.FX-3650PII/


The fx-3650P II is the successor to the fx-3650P. The interface, menu structure, and the display of the fx-3650PII match that of Casio’s other current dual-powered programmable, the fx-50FH series (current as this blog entry fx-50FHII).



The modes available for the fx-3650 PII are:


COMP: This is our main calculator mode, with all the scientific functions available.

CMPLX: Complex Number mode: features complex arithmetic, conjugate, modulus (Abs), argument, rectangular/polar conversions.

BASE: Base conversions of integers between the four well known bases: binary, decimal, octal, and hexadecimal. The mode contains the standard Boolean operations.

SD: Single variable statistics (formerly named standard deviation mode)

REG: Regressions/two-variable statistics. A is usually the y-intercept and B is the slope.


The regressions available are:

Linear: y = a + b * x

Logarithmic: y = a + b * ln x

e-Exponential: y = a * e^(b* x)

Power: y = a * x^b

Inverse: y = a + b / x

Quadratic: y = a + b * x + c * x^2

ab-Exponential: y = a * b^x


Casio fx-3650P vs Casio fx-3650P II



Both of these calculators are (or were) sold primarily in Asia.  They are dual-powered: solar with a backup battery.  



Casio fx-3650P



*  Years Released: 2002 – about 2013

*  Pressing [ e^x ] types e. e(n) takes e^n not e × n.

*  Program space: 4 programs, total of 360 bytes

*  Absolute value function (Abs) is available in complex number mode (CMPLX) mode only.


The [ MODE ] key:  

Page 1: 1: COMP, 2: CMPLX

Page 2: 1: SD, 2: REG, 3: BASE

Page 3: 1: PRGM, 2: RUN, 3: PCL

Page 4: 1: Deg, 2: Rad, 3: Grad

Page 5: 1: Fix, 2: Sci, 3: Norm

Page 6: 1: Disp (display setup, fractions, rectangular/polar in complex mode)


CMPLX (complex numbers, primarily complex number arithmetic)

SD (single-derivation mode, single-variable statistics)

REG (regression mode, two-variable statistics)

BASE (base conversions and Boolean logic)



Program Functions (P-CMD), which is a limited set:

Page 1: ? (prompt), → (store), : (separator), ◢ (output/pause)

Page 2: ⇒ (jump/if-then-else), =, ≠, >, ≥

Page 3: Goto, Lbl



To exit program editing mode, press [ MODE ], [ MODE ], select 2 for RUN



fx-3650 PII


*  Production: 2013 – current? (not in United States, but in Asia)

*  Pressing [ e^x ] types e^(. This is gives a clear indication that we are using a function (exponential).

*  Program space: 4 programs, total of 390 bytes

*  Absolute value function (Abs) is available in all modes.



The [ MODE ] key: 

Page 1: 1: COMP, 2: CMPLX, 3: BASE

Page 2: 4: SD, 5: REG, 6: PRGM


CMPLX (complex numbers, primarily complex number arithmetic)

SD (single-derivation mode, single-variable statistics)

REG (regression mode, two-variable statistics)

BASE (base conversions and Boolean logic)


The SET UP menu, use arrows to navigate:

Page 1, Angles: 1: Deg; 2: Rad; 3: Gra

Page 2, Fraction: 1: a b/c; 2: d/c

Page 3, Complex Number: 1: a+bi; 2: r∠Θ

Page 4, Statistical Frequency: 1: FreqOn; 2: FreqOff

Page 5, Contrast Setting


Operating structure has adopted the structure of the fx-50FH (a past model, it’s since been updated to the fx-50FHII).


Program Commands (P-CMD), available on both the fx-3650PII and fx-50FH series:

Page 1: ? (prompt), → (store), : (separator), ◢ (output/pause)

Page 2: ⇒ (jump/if-then-else), =, ≠

Page 3: >, <, ≥, ≤

Page 4: Goto, Lbl

Page 5: While, WhileEnd

Page 6: Next, Break

Page 7: For, To, Step

Page 8: Else, IfEnd

Page 9: If, Then


To exit program editing mode, press [ MODE ], [ MODE ], select 2 for RUN


When entering a new program, you are prompted to select the type of program at the start: COMP, CMPLX, SD, REG, or BASE.



Casio fx-3650 PII vs. Casio fx-50FH (II)


The main difference is that the fx-3650 PII has the numerical calculus functions integration and derivative, while the fx-50 FH has a library of scientific constants and 23 built in formulas. The fx-50FH has 680 bytes of programming memory.


The next post will have four programs that are done with both the fx-3650P and fx-3650P II to illustrate the programming differences.




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.

TI-84 Plus CE and Swiss Micros DM32: Blood Alcohol Level

TI-84 Plus CE and Swiss Micros DM32: Blood Alcohol Level Just in time for the upcoming St. Patrick’s Day in a few weeks… Introducti...