Sunday, April 25, 2021

HP 12C: Statistical Signal to Noise Ratio

HP 12C:   Statistical Signal to Noise Ratio


Introduction and The Formula


There are many parameters that can be used to measure signal to noise ratio.   Today's formula will concentrate on the statistical measurements of univariate (1-variable) data.  The signal to noise ratio (SNR) is defined as the inverse of the ratio of the coefficient of variation, or the ratio of the mean to deviation.


SNR = mean / deviation


In the sources listed below (see the Sources section), they define the ratio as:


SNR = mean / standard deviation


However, the sources define standard deviation as:


√( ∑(x_i - mean for i = 1 to n) / (1 - n )


This is the formula for sample standard deviation, and that is the deviation this program will use.


HP 12C Program:  SNR


STEP KEY     KEY CODE

01 x-bar 43, 0

02 STO 0 44, 0

03 s         43, 48

04 RCL 0 45, 0

05 x<>y 34

06 ÷         10

07 GTO 00         43, 33, 00


Notes:


1.  x-bar displays the mean for both x and y data in their respective stacks.  Since we are only interested in the x data, I had to store the mean in R0.

2.  Similarly, calling up the s function displays the standard deviation for both x and y. 

3.  In statistics, only certain registers are available for storing values.  The HP 12C stores the following calculations during statistics:  R1: n,  R2: ∑x, R3: ∑x^2, R4: ∑y, R5: ∑y^2, R6: ∑xy.  


Instructions


1.  Clear the statistical data registers by pressing [ f ], [ SST ].

2.  Enter the data by using [ ∑+ ].

3.  Run the program by pressing [ R/S ].


Examples


Note:  The HP 12C is set to Fix 4 mode for these examples.  


Example 1: 

Data:  10, 35, 76, 49, 52, 56

SNR:  2.0883

(Mean:  46.3333,  Sample Standard Deviation:  22.1871)


Example 2:

Data:  50, 30, 20, 35, 25

SNR:  2.78000

(Mean:  32.0000,  Sample Standard Deviation: 11.5109)


Sources


BYJU'S  "Signal to Noise Ratio Formula"  BYJU'S Classes. 2021. https://byjus.com/signal-to-noise-ratio-formula/  Last Retrieved March 23, 2021  


EasyCalculation.com  "How to Calculate Signal to Noise Ratio (SNR) - Tutorial" https://www.easycalculation.com/statistics/learn-signal-to-noise-ratio.php Last Retrieved March 23, 2021


Wikipedia  "Signal-to-noise" https://en.wikipedia.org/wiki/Signal-to-noise_ratio  Retrieved February 27, 2021


Eddie


All original content copyright, © 2011-2021.  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, April 24, 2021

TI-Nspire CX and CX II: Finance Widgets

TI-Nspire CX and CX II:  Finance Widgets


Financial Widgets


The zip file has five widgets:


simple interest widget:  Calculates the total interest paid in a simple interest loan


pi payment widget:  Calculates the payment of a monthly mortgage without a balloon payment.  


piti widget:  Calculates the PITI (payment-interest-tax-insurance) of a mortgage.  Down payment, annual property tax, and annual property insurance are included.


qualified loan amount widget:  Determines the amount of purchase price a buyer can afford.  The standard 28/36 ratio test is used, compares the two methods, and uses the minimum payment to estimate the qualified amount.  


qualified income test widget:  Test whether the proposed PITI and debt payments against a buyer's income  


Instructions


1.  Download the zip file here:  https://drive.google.com/file/d/1cl-yMpcwRHypGa1kdi66ThZs2xf5pPaQ/view?usp=sharing

2.  Save the widget (tns) files to the MyWidgets folder.

3.  Any tns file in the MyWidgets can be opened as a regular document or be added to a document by Insert-Widget.  

4.  When operated as a widget, highlight the entire page by Ctrl+A, pressing [ menu ], selecting 1. Actions, 1.  Evaluate (Enter).  


Eddie


All original content copyright, © 2011-2021.  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, April 18, 2021

Swiss Micros DM16L: Advanced Boolean and Factorial (up to 20)

Swiss Micros DM16L:   Advanced Boolean and Factorial (up to 20)


Introduction


The program listing, for the Swiss Micros DM16L and Hewlett Packard HP 16C,  will assign the following functions to the labels:


A:  NAND:   nand(x, y) = not(x and y)

B:  NOR:   nor(x, y) =  not(x or y)

C:  XNOR:  xnor(x, y) = (not x and not y) or (x and y)

D:  Implication:  y → x = (not y) or x

E:  Factorial:  x!  (x is a positive integer up to 20, 64 word size


NAND, NOR, NXOR, and Implication are advanced Boolean functions.  You can check out program code for the HP Prime here:


http://edspi31415.blogspot.com/2020/03/hp-prime-advanced-boolean-functions.html


Program - DM16L/HP 16C


// NAND

001 43,22,A LBL A

002 42,20   AND

003 42,30   NOT

004 43,21   RTN


// NOR

005 43,22,b LBL B

006 42,40   OR

007 42,30  NOT

008 43,21  RTN


// XNOR

009 43,22,C LBL C

010 44,1    STO 1

011 42,30  NOT

012 34      x<>y

013 44,2    STO 2

014 42,30   NOT

015 42,20   AND

016 45,1    RCL 1

017 45,2    RCL 2

018 42,20  AND

019 42,40   OR

020 43,21   RTN


// Implication

021 43,22,d LBL D

022 34      x<>y

023 42,30   NOT

024 42,40   OR

025 43,21   RTN


// Factorial

026 43,22,E LBL E

027 44,32  STO I

028 1      1

029 44,1    STO 1

030 43,22,1 LBL 1

031 45,1    RCL 1

032 45,32   RCL I

033 20      ×

034  44,1    STO 1

035 43,23   DSZ

036 22,1    GTO 1

037 45,1    RCL 1

038 43,21   RTN


Examples


Let:

R1 = 1011 0001

R2 = 1100 1100


Set up: 2-16-0000 (2's complement, 16 bits)


RCL 2, RCL 1, GSB A NAND(R2, R1):  0111 1111*

RCL 2, RCL 1, GSB B NOR(R2, R1): 0000 0010*

RCL 2, RCL 1, GSB C XNOR(R2, R1): 1000 0010*

RCL 2, RCL 1, GSB D R2 → R1:  1100 1110* 

* only the last eight bits 


Set word size to 64:

0 [ f ] [ STO ] (WSIZE)


5 GSB E 5! = 120

9 GSB E 9! = 362880*


* if the word size is insufficient, it will not show 362880 but a weird result as an overflow


12 GSB E   (64 word size)

12! = 4 79001600

Window 1:  4

Window 0:  79001600


20 GSB E

20! = 243 29020081 76640000

Window 2: 243

Window 1: 29020081

Window 0: 76640000


Source for the Advanced Boolean Functions:


John W. Harris and Horst Stocker.  Handbook of Mathematics and Computation Science  Springer:  New York, NY.  2006.  ISBN 978-0-387-94746-4



Eddie


All original content copyright, © 2011-2021.  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, April 17, 2021

Fun with the HP 20S (April 17, 2021 Edition)

Fun with the HP 20S (April 17, 2021 Edition)


A Quick Note - Spam Comments 

I noticed that my blog recently had a lot spam comments, especially since the beginning of this year.  Because of this I am considering turning off the ability to leave comments altogether.  If you are going to comment, please be courteous and stay on topic.  No one wants to read the same spam post about off-shore casinos, printers, or scandalous divorce inquiries.

Thank you and now, on with the post.  



Integer Division


The program calculates the quotient and remainder of the division: 


a ÷ b


Instructions:


Enter a, press [ XEQ ] ( F ), enter b.   Get the quotient, press [ R/S ], get the remainder



Program:


01 61,41,F         LBL F

02 21,2 STO 2

03 45        ÷

04 26        R/S

05 21, 1    STO 1

06 74          =

07 21,0      STO 1

08 51,45    IP

09 26          R/S

10 22,0      STO 0

11 61,45    FP

12 55        ×

13 22,1      RCL 1

14 74        =

15 51,33,0         FIX 0

16 61,44    RND   (round)

17 61,34    ALL

18 61,26    RTN



FIX 0, RND, ALL:  round the number in the display to the nearest integer


Examples:


74 ÷ 6  = 12 R 2

Keystrokes:  74, XEQ F, 6, R/S (12) R/S (2)


1576 ÷ 237 = 6 R154


Day Number


This calculates the day number given the month and the date.   A 365-day year is assumed.  


Instructions:

1.  Store month in memory register 1

2.  Store day in memory register 2

3.  Press XEQ A


Program:


01 61,41,A         LBL A

02 22,1      RCL 1

03 31        INPUT

04 2          2

05 61,42    x≤y?

06 51,41,1         GTO 1

07 33          (

08 33        (

09 22,1      RCL 1

10 75        +

11 1          1

12 34          )

13 55        ×

14 3            3

15 0          0

16 73        .

17 6          6

18 34          )

19 51,45    IP

20 65        -

21 6            6

22 3          3

23 74          =

24 21,3      STO 3

25 51,41,2         GTO 2

26 61,41,1         LBL 1

27 33          (

28 33        (

29 22,1      RCL 1

30 65        -

31 1          1

32 34      )

33 55        ×

34 6            6

35 3          3

36 45        ÷

37 2          2

38 34        )

39 51,45    IP

40 74        =

41 21,3      STO 3

42 61,41,2         LBL 2

43 75        +

44 22,2      RCL 2

45 74        =

46 21,3      STO 3

47 61,26    RTN


Examples:


February 16:  2 STO 1, 16 STO 2, XEQ A.  Result:  47

August 22:  8 STO 1, 22 STO 2, XEQ A.   Result:  234


Source:

Duffett-Smith, Peter.  Practical Astronomy With Your Calculator  2nd Ed.  Cambridge University Press: Cambridge.  1979  ISBN 0-521-28411-2


Astronomy:  Geocentric Parallax


The program calculates the quantities ρ sin θ' and ρ cos θ' where:


ρ = distance the observer is from the center of the Earth in meters

θ' = geocentric latitude in degrees


Inputs:


h = height of observer above sea level in meters

L = latitude of the observer in degrees, north is positive


Calculations:


h' = h / 6378140   (estimated radius of Earth is about 6,378 km)

u = atan(0.996647 tan L)

ρ sin θ' = 0.996647 sin u + h' sin L

ρ cos θ' = cos u + h' cos L


Program:


01 61,41,b         LBL B

02 61,23    DEG

03 33          (

04 22,1      RCL 1

05 25        TAN

06 55        ×

07 73        .

08 9          9

09 9          9

10 6            6

11 6          6

12 4          4

13 7          7

14 21,0      STO 0

15 34          )

16 51,25    ATAN

17 21,3      STO 3

18 22,2      RCL 2

19 45        ÷

20 6            6

21 3            3

22 7            7

23 8          8

24 1            1

25 4          4

26 0          0

27 74          =

28 21,4        STO 4

29 22,0      RCL 0

30 55          ×

31 22,3      RCL 1

32 23        SIN

33 75        +

34 21,1      RCL 1

35 23          SIN

36 55            ×

37 22, 4        RCL 4

38 74        =

39 26          R/S

40 22, 3        RCL 3

41 24            COS

42 75          +

43 22, 4      RCL 4

44 55        ×

45 22, 1      RCL 1

46 24          COS

47 74          =

48 61,26      RTN


Registers used:


R1 = L  (input)

R2 = h   (input)

R3 = u

R4 = h / 6378140

R0 = 0.996647


Example:


Input:

L = 45.76° N

h = 53.48 m


54.76 STO 1, 53.48 STO 2, XEQ B

Result:  

ρ sin θ' = .712859241, R/S

ρ cos θ' = .698873028


Source:

Duffett-Smith, Peter.  Practical Astronomy With Your Calculator  2nd Ed.  Cambridge University Press: Cambridge.  1979  ISBN 0-521-28411-2


Eddie

All original content copyright, © 2011-2021.  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. 

Monday, April 12, 2021

Spotlight: Jim Cullen - Mathematical Topics

Spotlight:  Jim Cullen - Mathematical Topics 


On today's blog I want to feature Jim Cullen, who has a mathematical web page:


Mathematical Topics Index Page - Associated Calculator Programs


Topics include:


Pi and several series to approximate π

Random Normal Number Generators

Generalized Fibonacci Sequences

A Comparison between Casio fx-115ES and Sharp EL-W516 (2 pdf files)

Diophantine Equations



Cullen also has a page of family's genealogy:  http://members.bex.net/jtcullen515/CullOrig.htm


Check it out,  


Eddie


All original content copyright, © 2011-2021.  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, April 11, 2021

Retro Review: Hot Rod Calculator

 Retro Review:   Hot Rod Calculator








Quick Facts:


Model:  8703, Hot Rod Calc

Company:  Mr. Gasket Co/Calculated Industries

Years of Production: 2009 - 2020*

Memory Registers:  1

Batteries:  2 LR-44

Operating System:  Chain

Display:  8 digits, unit indicators 

New Price: $80 retail; can be found on sale or clearance


* I can no longer find the Hot Rod calculator as a new calculator on the Calculated Industries website.  However, the Hot Rod app for both iOS and Android.  


Ladies and Gentlemen, Start Your Engines!


The Hot Rod Calc is a specialty calculator that emphasizes on automotive mathematics, with solvers and applications including:  


*  Air Temperature, Relative Humidity (Moisture), Elevation

*  Vehicle Weight, Elapsed Time (1/4 mile traveled in seconds), MPH

*  Bore, Stroke, RPM, Torque, Engine Displacement

*  Tire Ratio, Gear Ratio

*  Engine Volumetric Efficiency

*  Carburetor Size

*  Vehicle Weight, Horsepower, Elapsed Time

*  Conversions including length, area, volume, temperature, mass, velocity (speed)


You can download a PDF version of the manual here: 


https://documents.holley.com/mr_gasket_instructions_hot_rod_calculator_8703.pdf


The manual has several reference tables:


*  Drag Coefficients depending on the automobile type

*  Holley Jet Chart

*  Jet Orifice Area Conversation Chart


Keyboard


The calculator comes in a bright red Armadillo Gear case.   The keys are bright and colorful, with most of them sporting a warm color palette (red, orange).  The keys are responsive, but have a rubber feel to them.  I believe the keys are made to handle dirt and oils given the target audience of the Hot Rod Calc.


The case has a quick reference guide.


Example Calculations


The calculator is set to U.S. units (default)


Example 1:


Calculate Air Temperature given:

Elevation:  1,284 ft

Air Pressure:  30.12 inHg

Humidity:  33%


1284 [ Elev/ADI ]

33 [ Moisture ]

30.12 [ Conv ] [Air Temp] (Pressure)

[Air Temp],  Result:  55.4211 °F


Example 2:


Find the weight of a vehicle given:

It's horsepower:  426 HP

It's elapsed time:  9.73 sec to run 1/4 mi


426 [ HP ]

9.73 [ ET ]

[ Vehicle Wt ],  Result:  1999.7337 lb


Example 3:


Find the speed, in miles per hour, for an automobile traveling with the following specifications:

1st Gear:  3.26

Final Drive Gear: 3.03

RPM: 5800 (revolutions per minute)

Diameter of the tires: 26 inches


3.26 [ × ] 3.03 [ Gear Ratio ]

5800 [ RPM ]

26 [ Conv ] [ Gear Ratio ] (New Tire Dia)

[ MPH ],  Result:  45.417902  mph


Verdict


If you are into racing, hot rods, and automobiles, and you need a quick mathematics tool, the Hot Rod calculator is worth the investment.  Its user manual is a well written.  Now may be the best time to purchase one before the calculator becomes a rare item.  


Eddie


All original content copyright, © 2011-2021.  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, April 10, 2021

Fun with the HP 20S (April 10, 2021 Edition)

 Fun with the HP 20S (April 10, 2021 Edition)



In all the programs presented on the blog, all inputs are stored in the appropriate registers before the program is run.  



The Power of a Windmill


This program calculates the power generated by a windmill, given the diameter and velocity of the windmill’s fans.   SI units (meters, kilograms, seconds) are used.   The general equations used are:


Area of the swept by the windmill’s fans (in m^2):

A = ( π * diameter^2 ) / 4 


Power generated (in W (Watts), J/s, m^2 kg/s^3):

P = ½ * area * density * velocity^3 


Density of air = 1.225 kg/m^3


Input:

R1 = diameter of the fans, m 

R2 = velocity of the fans, m/s 


Output:

R3 = area that the fans cover, m^2;  press [ R/S ]

R4 = power of the fan, W


Program:

01 LBL A         61,41, A

02 RCL 1         22, 1

03 51, 11

04 × 55

05 π 61, 22

06 ÷ 45

07 4 4

08 = 74

09 STO 3         21, 3

10 R/S 26

11 × 55

12 RCL 2         22, 2

13 y^x 14

14 3 3

15 × 55

16 . 73

17 6 6

18 1 1

19 2 2

20 5 5

21 = 74

22 STO 4         21, 4

23 RTN 61, 26


Example:

Inputs:  

diameter = R1 = 6.65 m

velocity = R2 = 10 m/s

Results:

R3 = area = 34.7322702808 m^2

R4 = power = 21,273.515547 W


Source:

Sharp Electronics Corporation.  Conquering The Sciences: Applications for the SHARP Scientific Calculators EL-506P, EL-510S, EL-515S  Japan. 1984



Depth of a Well


This program calculates the depth of a well, which is determined by the time between a person drops a rock and the person hears the rock hit the bottom of the well.  The program uses SI units (meters, kilograms, seconds) with the following constants:


Earth’s Gravitational Acceleration:  g = 9.80665 m/s^2

g/2 = 4.903325 m/s^2

Speed of Sound, in dry air, 20°C temperature: s = 343.21 m/s


Equations:

X = (-B + √(B^2 + 4*A*B)) / 2

Y = g/2 * a^2


where:

B = s / (g/2) (see the above constants)

A = amount of time, in seconds, between the person drops the rock and hears the rock hit the bottom (input)

X = amount of time, in seconds, that it actually takes the rock from the time it was dropped until the rock hits the bottom of the well (output)

Y = depth of the well, in meters (output)


Input:

R1 = time until you hear the rock hit the bottom of the well (sec) 

Output:

R2 = time until the rock actually hits the bottom of the well (sec), [ R/S ]

R3 = depth of the well (m)



Program:

01 LBL B         61, 41, B

02 3 3

03 4 4

04 3 3

05 . 73

06 2 2

07 1 1

08 ÷ 45

09 4 4

10 . 73

11 9 9

12 0 0

13 3 3

14 3 3

15 2 2

16 5 5

17 STO 0         21, 0

18 = 74

19 STO 4         21, 4

20 +/- 32

21 + 75

22 ( 33

23 RCL 4         22, 4

24 51, 11

25 + 75

26 4 4

27 × 55

28 RCL 4         22, 4

29 × 55

30 RCL 1         22, 1

31 ) 34

32 11

33 = 74

34 ÷ 45

35 2 2

36 = 74

37 STO 2         21, 2

38 R/S 26

39 51, 11

40 × 55

41 RCL 0         22, 0

42 = 74

43 STO 3         21, 3

44 RTN 61, 26


Example:

Input:  

time until you hear the rock hit the ground = R1 = 3 sec

Results:

R2 = time the rock travels to the bottom of the well = 2.8813865 sec

R3 = depth of the well = 40.70930098622 m



Source:

Saul, Ken.  The Physics Collection:  Ten HP-41C Programs for First-Year Physics Class   Corvallis, OR.  1986



Thevenin’s Theorem




This program calculated the equivalent resistance and voltage of a linear network of two resistors and a capacitor.  


Formulas:

R_TH = (R1 * R2) / (R1 + R2)

V_TH = V * R2 / (R1 + R2)


Inputs:

R1 = resistor 1 ( Ω )

R2 = resistor 2 ( Ω )

R3 = capacitor ( V )

Output:

R4 = equivalent resistor, R_TH, [ R/S ]

R5 = equivalent capacitor, V_TH


Program:

01 LBL C         61, 41, C

02 RCL 1         22, 1

03 × 55

04 RCL 2         22, 2

05 ÷ 45

06 ( 33

07 RCL 1         22, 1

08 + 75

09 RCL 2         22, 2

10 ) 34

11 = 74

12 STO 4         21, 4

13 R/S 26

14 RCL 3         22, 3

15 × 55

16 RCL 2     22, 2

17 ÷ 45

18 ( 33

19 RCL 1     22, 1

20 + 75

21 RCL 2         22, 2

22 ) 34

23 = 74

24 STO 5     21, 5

25 RTN 61, 26



Example:

Input:

R1 = 8 Ω

R2 = 9 Ω

R3 = 11 V

Results: 

R4 = 4.23529411765 Ω

R5 = 5.82352941176 V



Source:

Gussow, Milton and William T. Smith  Schaum’s Easy Outlines: Basic Electricity  New York. 2012  ISBN 978-0-07-178068-1



Norton’s Theorem


This program calculates an equivalent resistance and current when any network connected to a positive and a negative terminal.





Formulas:

R_N = (R1 * R2) / (R1 + R2)

I_N = V / R1


Inputs:

R1 = resistor 1 ( Ω )

R2 = resistor 2 ( Ω )

R3 = capacitor ( V )

Output:

R4 = equivalent resistor, R_N, [ R/S ]

R5 = equivalent current, I_N

Program:

01 LBL D         61, 41, D

02 RCL 1         22, 1

03 × 55

04 RCL 2         22, 2

05 ÷ 45

06 ( 33

07 RCL 1         22, 1

08 + 75

09 RCL 2         22, 2

10 ) 34

11 = 74

12 STO 4         21, 4

13 R/S 26

14 RCL 3         22, 3

15 ÷ 45

16 RCL 1         22, 1

17 = 74

18 STO 5         21, 5

19 RTN 61, 26




Example:

Input:

R1 = 8 Ω

R2 = 9 Ω

R3 = 11 V

Results: 

R4 = 4.23529411765 Ω

R5 = 1.375 A


Source:

Gussow, Milton and William T. Smith  Schaum’s Easy Outlines: Basic Electricity  New York. 2012  ISBN 978-0-07-178068-1


Eddie 


All original content copyright, © 2011-2021.  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.


Casio fx-9750GIII and fx-CG 50: Playing Games with the Probability Simulation Mode

Casio fx-9750GIII and fx-CG 50: Playing Games with the Probability Simulation Mode The Probability Simulation add-in has six type...