Saturday, April 4, 2026

TI-84 Plus CE: Signal to Noise Ratio and Shannon’s Law

TI-84 Plus CE: Signal to Noise Ratio and Shannon’s Law



Signal to Noise Ratio (SNR)


The program SNR calculates the signal to noise ratio for inputs in one of the three units:


Decibels

S – N

Watts

20 * log( S ÷ N )

Voltage

10 * log(S ÷ N )

S: desired signal level

N: noise level


Cadence PCB Solutions (see source) provides a scale of signal to noise ratios and their effectiveness, which is summarized here:


5 dB to 10 dB

No connection is made, the ratio is too low

10 dB to 15 dB

The connection is unreliable

15 dB to 25 dB

Minimum acceptable level

25 dB to 40 dB

Good connection

41 dB and above

Excellent connection


In general, the higher the SNR, the better.


TI-84 TI-Basic Code: Signal to Noise Ratio

Program Title: SNR



Menu(“SIGNAL NOISE RATIO”,”DECIBELS”,1,”WATTS”,2,”VOLTAGE”,3)

Lbl 1

Input “SIGNAL DB? “, S

Input “NOISE DB? “, N

S – N → R

Goto 0

Lbl 2

Input “SIGNAL (W)? “, S

Input “NOISE (W)? “, N

20 * log(S / N) → R

Goto 0

Lbl 3

Input “SIGNAL (V)? “, S

Input “NOISE (W)? “, W

10 * log(S / N) → R

Goto 0

Lbl 0

Disp “SNR (DB): “, R



Examples



Example 1: S: -10 dB, N: -50 dB (from Source)

Results: 40 dB



Example 2: S: 400 W, N: 60 W

Results: 16.47817482 dB



Example 3: S: 300E-3 V (300 millivolts), N: 2E-6 V (2 microvolts)

Result: 51.76091259 dB (*source erroneously had 62 DB)





Shannon’s Law



The program SHANNON makes two calculations: signal to noise ratio in decibels and the capacity of the channel in bits per second. Shannon’s Law was discovered by Claude Shannon during World War II.



C = W * log(1 + S ÷ N) ÷ log(2)



W: bandwidth of the signal in Hertz

S: average signal received in Watts

N: average noise signal in Watts

C: maximum channel capacity in Bits per Second





TI-84 TI-Basic Code: Shannon’s Law

Program Title: SHANNON



Disp “SHANNON’S LAW”

Input “REC’D POWER (W)? “, S

Input “NOISE POWER (W)? “, N

Input “BANDWIDTH (HZ)? “, W

20 * log(S / N) → R

Disp “SIGNAL NOISE RATIO: “, R

W * log(1 + S / N) / log(2) → C

Disp “CHANNEL (BITS/S):”, C



Example



Inputs:

Average Received Signal Power (S): 49.2 W

Average Noise Power (N): 2.2 W

Bandwidth: 200 Hz



Results:

Signal Noise Ratio (SNR): 26.99084844 dB

Channel capacity: 909.2385861 bits/s



Source



Cadence. “What is Signal to Noise Ratio and How to calculate it?” Cadence PCB Solutions. 2020. Accessed November 30, 2025. https://resources.pcb.cadence.com/blog/2020-what-is-signal-to-noise-ratio-and-how-to-calculate-it



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, March 28, 2026

Casio fx-4000P: Antennas

Casio fx-4000P: Antennas



Vertical and Horizontal Bandwidth


Given the height (h) and length (l) of an antenna plate, along with wavelength (λ) given from the antenna, the vertical and horizontal bandwidth, in degrees is calculated as:


Vertical Bandwidth:

ßv = (k * λ * 180) ÷ (h * π)


Horizontal Bandwidth:

ßh = (k * λ * 180) ÷ (l * π) = h * ßv ÷ l


The constant k is the antenna taper factor, which in the original program assigned the constant as k = 1.4.


Casio fx-4000P Program Code (Prog 0)


“HEIGHT” : ? → H :

“LENGTH” : ? → L :

“WAVE. L.” : ? → W :

“VERT-BAND=” ◢

252 × W ÷ H ÷ π → V ◢

“HOR-BAND=” ◢

H × V ÷ L → Z


Example 1:

Input: H: 2.4 ft (height), W: 12.4 ft (width), λ: 0.18 ft (wavelength)

Results:

Vertical Bandwidth: 6.016056849°

Horizontal Bandwidth: 1.1643981°


Example 2:

Input: H: 3.8 ft (height), W: 3.6 ft (width), λ: 0.05 ft (wavelength)

Results:

Vertical Bandwidth: 1.05544857°

Horizontal Bandwidth: 1.114084602°



Convert from Frequency to Wavelength


This program converts frequency (Hz) to wavelength (ft).


λ = c ÷ f


Using c as the speed of light in a vacuum (299,792,458 m/s), a conversion is required (1 m ≈ 3.28084 ft).


Casio fx-4000P Program Code (Prog 1)


“FREQ” : ? → F :

“WAVE L.=” ◢

299792458 ÷ F × 3.28084



Example 1:

Input: freq = 6200 MHz (6200E6)

Results: 0.158640498 ft



Example 2:

Input: freq = 8500



Equivalent Antenna Area



The equivalent area given the gain of the antenna in decibels (dB):



Ae = (λ² * 10^(G ÷ 10)) ÷ (4 * π)



Casio fx-4000P Program Code (Prog 2)



“GAIN” : ? → G :

“WAVE L.” : ? → W :

“AREA=” ◢ W² × 10^(G ÷ 10) ÷ 4 ÷ π → A



Example 1:

Input: gain = 28 dB, λ = 0.12 ft

Results: 0.7230238578 ft²



Example 2:

Input: gain = 49 dB, λ = 0.19 ft

Results: 228.1903833 ft²



Source


Hewlett Packard. HP-67/HP-97: Users’ Library Solutions: Antennas. Rev. D April 1979. pp. 32 – 26.



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, March 21, 2026

TI-83 Premium CE Edition Python and Casio fx-92 Collège: Graphing Roses

TI-83 Premium CE Edition Python and Casio fx-92 Collège: Graphing Roses


Introduction


The scripts presented today will draw a rose with the following polar equation:


r = a * cos(n * Θ)


If n is odd, then the rose will have n petals, but if n is even, then the rose will have double the petals (2*n petals).



TI-83 Premium CE Edition Python (and TI-84 Plus CE Python): ROSE84.PY


from math import *

from turtle import *

t=Turtle()

t.clear()

t.hidegrid()

t.hideturtle()

t.pencolor(255,0,0)


# set pedal length

a=100

t.penup()

t.goto(a,0)


# ask for pedals

print(“** rose **”)

print(“odd n: n pedals”)

print(“even n: 2*n pedals”)

n=eval(input(“n? “))

t.clear()


# draw

t.pendown()

for i in range(129):

  # theta

  m=i/128*2*pi

  # r

  r=a*cos(n*m)

  t.goto(r*cos(m),r*sin(m))

t.done()






Casio fx-92 Collège: Graphing a Rose


Note: The instructions are in French.


INSTRUCTION

DETAIL

ENGLISH TRANSLATION

Style Criox


Cross Cursor Style

? → B

Demander valuer B

Input B

20 → A

Metrire var á 20 → A

Set A = 20

Aller á x = A; y = 0


Goto (A, 0)

Stylo écrit


Pen down

Répéter 128


Repeat 128 times (loop):

C ÷ 128 × 2 × π → D

Metrire var á C ÷ 128 × 2 × π → D

Set D = C/128*2*π

A × cos((B × D)^r) → E

Metrire var á A × cos((B × D)^r) → E

Set E = A*(cos(B*D)), B*D is in radians.

Aller à x=E×cos(D^r); y=E×sin(D^r)


Goto (E * cos D, E * sin D). D is in radians.

C + 1 → C

Metrire var á C + 1 → C

Set C = C + 1


End of loop


Note: To designate a measure of an angle to be radians regardless of calculator setting, press [ CATALOG ] >> Angl/Coord/Sexag >> Radians.






Drawing roses on the first day of spring,



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, March 15, 2026

TI-84 Plus CE Python: Traceable Plots in Python

TI-84 Plus CE Python: Traceable Plots in Python


These two scripts are an easy way on how to create plots that are traceable. A traceable plot allows the user to trace along a scatter plot or functional plot by using the right and left arrow keys, just like if you made a plot in a graphing calculators’ graph mode.



The two scripts presented are:



TIRNDPLT: makes a scatter plot of ten random points between 0 and 1. The x axis is the plot marker while the y axis is the random point.

TIFXPLT: makes a plot of a single function y(x). Radians mode as assumed and the plot is made of 50 points. You specify the minimum and maximum values of x. Radians mode is assumed and the math module has imported, allowing for scientific functions. A caveat is to plot a function where it is defined for all of the domain given. For instance, for sqrt(x), no negative values should be included in the domain [xmin, xmax].



The two scripts can be downloaded here:

https://drive.google.com/file/d/1D3oB7Vrt9cd1e-wXrEkhZbr8VJ_7V4qB/view?usp=sharing



However I am going to list the code because there are things to be pointed out.



TIRNDPLT



Code:

# TI-84+: Traceable Plot

# Edward Shore 2026-02-20
# tirndplt.py

# Plot ten random elements

# import modules
from math import *
from random import *
from ti_system import *
# plot module is imported differently
import ti_plotlib as plt


# build a random list
x=[i for i in range(1,11)]
y=[round(random(),4) for i in range(1,11)]

# set up the key
# left (2) and right (1) is the trace, enter to exit (5)
k=0

# set the pointer
p=0

# constant elements
# clear the screen
plt.cls()
# set window to allow room for text
plt.window(0,11,-0.5,1.5)
plt.axes("axes")

# plot gray grid
plt.color(192,192,192)
plt.grid(1,0.1)

# main loop, faster?, redraw only replaceable elements
while k!=5:
  # scatter plot, filled dot default
  plt.color(0,0,0)
  plt.scatter(x,y)
  # text at line 1
  plt.text_at(1,"<-, ->, press enter to exit","left",1)
  # string at line 12
  s="x = {0:.0f}, y = {1:.4f}".format(x[p],y[p])
  plt.text_at(12,s,"left",1)
  # plot pointer with cross, blue
  plt.color(0,0,255)
  plt.plot(x[p],y[p],"x")
  # get key
  k=wait_key()
  # left and right keys
  if k==2:
    # clear
    plt.color(255,255,255)
    plt.plot(x[p],y[p],"x")
    # replace
    plt.color(0,0,0)
    plt.plot(x[p],y[p])
    p=(p-1)%10
  elif k==1:
    plt.color(255,255,255)
    plt.plot(x[p],y[p],"x")
    plt.color(0,0,0)
    plt.plot(x[p],y[p])
    p=(p+1)%10

# show draw at the end
plt.text_at(1,"DONE","left",1)
plt.show_plot()


Notes:


1. Modules used: math, random, ti_system, and ti_plotlib. The calling of math and random modules allow the user to include math and random functions. The ti_system has the command wait_key(), which calls for the user to press a key, and returns a specific code value when a key is pressed. The module ti_plotlib is for the specific graphics commands.

2. The y minimum and maximum values for the plot have a padding of 2 to allow room for the top and bottom lines which will contain information. The top line will give instructions for the keys: ← to trace left, → to trace right, and pressing the [ enter ] exits the program.

3. The script has plots in two sections. Outside the loop are elements that will stay permanent: the window, the axis, and the scatter plot. Inside the loop will be the pointer because it changes.

4. Every time an arrow key is processed, the pointer first must be “erased” off the previous position, then move to the next. The pointer is in blue. The variable p is used for the pointer and will take the value between 0 and 9.

5. In Python, the percent symbol is used as a modulus function. So, the expression (p-1)%10 means (p – 1) mod 10. Similarly, (p+1)%10 means (p + 1) mod 10. This is what keeps p in the range of [0, 9]. p is an integer.

6. The use of the format is required to make reading the coordinates readable.

7. Any script using ti_plotlib must have a plt.show_plot() command, at least at the end. It’s primary purpose is to show the final picture and freeze the screen in graphics mode.


TIFXPLT.py




Code:

# TI-84+: Traceable Plot
# Edward Shore 2026-02-22
# tifxplt.py


# Plot a traceable function

# import modules
from math import *
from random import *
from ti_system import *
# plot module is imported differently
import ti_plotlib as plt

# build f(x)
fx=input("y(x)? ")
xmin=eval(input("xmin? "))
xmax=eval(input("xmax? "))
chgx=(xmax-xmin)/50

xl=[]
yl=[]

x=xmin
while x<=xmax:
  y=eval(fx)
  xl.append(x)
  yl.append(y)
  x+=chgx

ymin=min(yl)-2
ymax=max(yl)+2

# set up the key
# left (2) and right (1) is the trace, enter to exit (5)
k=0

# set the pointer
p=0

# constant elements
# clear the screen
plt.cls()
# set window to allow room for text
plt.window(xmin,xmax,ymin,ymax)
plt.color(16,16,16)
plt.axes("on")

plt.color(0,0,0)
plt.plot(xl,yl,".")

# main loop, faster?, redraw only replaceable elements
while k!=5:
  # scatter plot, filled dot default
  # text at line 1
  plt.text_at(1,"<-, ->, press enter to exit","left",1)
  # string at line 12
  s="x = {0:.1f}, y = {1:.4f}".format(xl[p],yl[p])
  plt.text_at(12,s,"left",1)
  # plot pointer with cross, blue
  plt.color(0,0,255)
  plt.plot(xl[p],yl[p],"x")
  # get key
  k=wait_key()
  # left and right keys
  if k==2:
    # clear
    plt.color(255,255,255)
    plt.plot(xl[p],yl[p],"x")
    # replace
    plt.color(0,0,0)
    plt.plot(xl[p],yl[p])
    p=(p-1)%50
  elif k==1:
    plt.color(255,255,255)
    plt.plot(xl[p],yl[p],"x")
    plt.color(0,0,0)
    plt.plot(xl[p],yl[p])
    p=(p+1)%50

# show draw at the end
plt.text_at(1,"DONE","left",1)
plt.show_plot()



Notes:

1. Modules used: math, random, ti_system, and ti_plotlib. The calling of math and random modules allow the user to include math and random functions. The ti_system has the command wait_key(), which calls for the user to press a key, and returns a specific code value when a key is pressed. The module ti_plotlib is for the specific graphics commands.

2. The y minimum and maximum values for the plot have a padding of 2 to allow room for the top and bottom lines which will contain information. The top line will give instructions for the keys: ← to trace left, → to trace right, and pressing the [ enter ] exits the program.

3. The script has plots in two sections. Outside the loop are elements that will stay permanent: the window, the axis, and the plot of the function. Inside the loop will be the pointer because it changes.

4. Every time an arrow key is processed, the pointer first must be “erased” off the previous position, then move to the next. The pointer is in blue. The variable p is used for the pointer and will take the value between 0 and 49.

5. In Python, the percent symbol is used as a modulus function. So, the expression (p-1)%50 means (p – 1) mod 50. Similarly, (p+1)%50 means (p + 1) mod 50. This is what keeps p in the range of [0, 49]. p is an integer.

6. The use of the format is required to make reading the coordinates readable.

7. Any script using ti_plotlib must have a plt.show_plot() command, at least at the end. It’s primary purpose is to show the final picture and freeze the screen in graphics mode.



I hope you enjoy these programs as I did making them,



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, March 14, 2026

Commodore P50 Programs

Commodore P50 Programs



A collection of programs from the vintage Commodore P50 from 1978. Check out my review from last April: https://edspi31415.blogspot.com/2025/04/spotlight-commodore-p50.html.



Air Density


This equation calculates air density, in m/kg³ given the temperature of Celsius. The standard equations are used.


ρ = p ÷ (R * (T°C + 273.15)) ≈ 359.98728 ÷ (T°C + 273.15)

p = 101,325 Pa (absolute pressure)

R = 287.05 J/(kg * K) (specific gas constant)

p/R = 101325 / 287.05 ≈ 359.98728



With limited storage space of 24 steps, the equation had to be simplified.

(The step numbers are for reference, since steps cannot be reviewed on the P50.)



Start with temperature in the display. Press GOTO 00, R/S. The air density is displayed.

00 +

01 2

02 7

03 3

04 .

05 1

06 5

07 =

08 1/x

09 ×

10 3

11 5

12 2

13 .

14 9

15 8

16 7

17 2

18 8

19 =

20 r/s

21 GOTO

22 00


Examples:


Example 1: Input: 0°C, Output: 1.2922837 m/kg³

Example 2: Input: 15°C, Output: 1.2250123 m/kg³

Example 3: Input: 37.8°C, Output: 1.1351898 m/kg³



Speed of Sound



This equation calculates the speed of sound (in dry air) in m/s given the temperature of Celsius.

c_air ≈ 20.05 * √(273.15 + T°C)



Start with temperature in the display. Press GOTO 00, R/S. The speed of air is displayed.

00 +

01 2

02 7

03 3

04 .

05 1

06 5

07 =

08 √x

09 ×

10 2

11 0

12 .

13 0

14 5

15 =

16 r/s

17 GOTO

18 00


Examples:

Example 1: Input: 0°C, Output: 331.37137 m/s

Example 2: Input: 20°C, Output: 343.28856 m/s

Example 3: Input: 37.8°C, Output: 353.55718 m/s



Decibel Gain/Loss from Power Ratio



dB = 10 * log(power output ÷ power input)



Start with power output. Press GOTO 00, R/S. Then enter power input, press R/S. The decibel gain/loss is displayed.


00 ÷

01 r/s

02 =

03 log

04 ×

05 1

06 0

07 =

08 r/s

09 GOTO

10 00


Examples:

Example 1: power output = 25 W, power input = 5 W

Input: 25 GOTO 00 r/s, 5 r/s. Output: 6.9897 dB

Example 2: power output = 30 W, power input = 42 W

Input: 30 GOTO 00 r/s, 42 r/s. Output: -1.4612804 dB

Example 3: power output = 3 W, power input = 1 W

Input: 3 GOTO 00 r/s, 1 r/s. Output: 4.7712125 dB



“Radio Mathematics” ARRL. Retrieved November 1, 2025. https://www.arrl.org/files/file/ARRL%20Handbook%20Supplemental%20Files/2023%20Edition/Radio%20Supplement.pdf



Plus or Minus Operation



This program calculates a ± b (a + b and a – b). The program leaves a – b in the display and a + b in memory, which can be toggled by the memory exchange [ x ←→ M ] key.


The program uses the memory exchange key. Enter b (the term to both be added and subtracted first), then a.


00 STO

01 r/s

02 +

03 RCL

04 =

05 r/s

06 x ←→ M

07 ×

08 2

09 =

10 ±

11 +

12 RCL

13 =

14 r/s

15 GTO

16 00


Examples:

Remember, enter the second number (b) first.

Example 1: 5 ± 9

Input: 9 GOTO 00 r/s, 5, r/s. Output: 14 r/s -4

Example 2: 36 ± 20

Input: 20 GOTO 00 r/s, 36 r/s. Output: 56 r/s 16

Example 3: 310 ± 240

Input: 240 GOTO 00 r/s, 310 r/s. Output: 550 r/s 70



Combination



This is the combination function:



nCr = n! ÷ (r! * (n – r)!)



Due to only having one memory register and the factorial function does not distribute, one of the arguments (r) will need to be entered twice.



Input: n GOTO 00 r/s, r r/s, r r/s (again). Output: nCr.



00 STO

01 -

02 r/s

03 =

04 n!

05 1/x

06 ×

07 RCL

08 n!

09 ÷

10 r/s

11 n!

12 =

13 r/s

14 GOTO

15 00



Examples:

Example 1: 52 C 5

Input: 52 GOTO 00 r/s, 5 r/s, 5 r/s. Output: 2,598,960

Example 2: 34 C 12

Input: 34 GOTO 00 r/s, 12, r/s, 12 r/s. Output: 5.4835404 E 08

Example 3: 10 C 4

Input: 10 GOTO 00 r/s, 4 r/s, 4 r/s. Output: 210


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.