Sunday, May 15, 2022

Python: Financial Functions (2nd Edition)

Python:  Financial Functions (2nd Edition)


This is an update to the python file, which I first released on May 17, 2020:


https://edspi31415.blogspot.com/2020/05/numworkscasio-micropythonpython.html


I am able to transfer and test the python file to a Numworks calculator through the online editor, and TI-84 Plus CE Python through the TI Connect CE.  Because only the math module is used, the python file can be run in most, if not all calculators with Python, as well as Python 3.  


What is included?


*  time value of money calculations

*  net present value and internal rate of return

*  net present value (xnpv) and internal rate of return (xirr) when periods between flows are not consistent, a 365 day-year is assumed

*  simple interest:  calculating interest, total, and solving for principal

*  profit calculations: cost-sell-markup

*  adding sales tax

*  percent change

*  present and future value uniform stream factors

*  compound interest calculations of a single stream:  solve for present value, future value, number of periods, and periodic interest

*  days between dates

*  specific applications:  monthly payment, PITI, qualifying loan amount, sinking fund, expressing a list of amounts as a percent of the sum, prorating an amount among a list of flows


Download the Python file and the instructions (pdf file) here:

https://drive.google.com/file/d/1l7Xg9dM-RHfekKkU7A1Wjay76-yVc56S/view?usp=sharing


Size: about 3,800 bytes.  


Eddie


All original content copyright, © 2011-2020.  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, May 14, 2022

The Sum and Product of Roots of a Quadratic Equation

The Sum and Product of Roots of a Quadratic Equation


Introduction


Let s, t be the roots of the equation a*x^2 + b*x + c = 0.


Let:


s = (-b + √(b^2 - 4*a*c)) / (2 * a)

t = (-b - √(b^2 - 4*a*c)) / (2 * a)


Then


s + t = -b / a

s * t = c / a


We see this topic a lot in algebra, let's see how these properties are derived. Fairly simple.  


Sum of the Roots


s + t

=  (-b + √(b^2 - 4*a*c)) / (2 * a) + (-b - √(b^2 - 4*a*c)) / (2 * a)

= (-2 * b) / (2 * a)

= -b / a


Product of the Roots


s * t 

=  (-b + √(b^2 - 4*a*c)) / (2 * a) * (-b - √(b^2 - 4*a*c)) / (2 * a)

= (b^2 + b * √(b^2 - 4*a*c) - b * √(b^2 - 4*a*c) - (b^2 - 4*a*c)) / (4*a^2)

= (b^2 - b^2 + 4*a*c) / (4*a^2)

= (4*a*c) / (4*a^2)



Eddie



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

Retro Review: Hewlett Packard HP 45

Retro Review:   Hewlett Packard HP 45





Quick Facts:


Model:  HP 45

Company:  Hewlett Packard

Years:  1973-1976

Type:  Scientific

Batteries: (original) HP Battery Pack 82001A (rechargeable), compatible batteries can be found on eBay, AC Adapter 82002A

Operating Mode:  RPN

Memory Registers: 9 (R1 - R9), some are used in statistics

Undocumented (by the manual) Feature:  Stopwatch

Original Price:  $395.00 (US) 

Package Includes AC Adapter, User Manual, Pocket Guide, Carrying Case 


Features - History


The HP 45 is the second scientific calculator by Hewlett Packard, first brought to the market in 1973; after the legendary HP 35 was released in 1972.  The HP 45 is the second Hewlett Packard calculator to feature a shift key, after HP's first financial calculator, the HP 80.  


The HP 45 operates on Reverse Polar Notation (RPN).   Here is a Wikipedia page on RPN:  https://en.wikipedia.org/wiki/Reverse_Polish_notation


The HP 45 added more functions to the HP 35, which features include:


* trigonometric functions and inverses

* logarithms and antilogs

* powers and roots

* fixed and scientific 

* factorial of integers

* polar/rectangular conversions

* degrees/degree-minute-second conversions (DD.MMSSSS)

* percent and percent change

*  three angle modes: degree, radians, grads 

* Last x

* three unit conversions

* statistics

* storage and recall arithmetic


When the HP 45 is powered on, the calculator will be in FIX 2 mode.  


Factorial of Integers:   The function n! allows only integers from 0 to 69.  It will be later HP calculators to extend the factorial function to the real numbers.


Polar and Rectangular Conversions:  The conversions involve the X and Y stack.  In polar form, X represents r and Y represents θ.


Conversions:  The HP 45 provides conversion factors for unit conversions. Examples provided in FIX 2 mode. 


[ shift ] [ 7 ]: cm/in.   1 in = 2.54 cm.    


18 in to cm:  18 [ shift ] [ 7 ] [ × ] returns 45.72 cm

50 cm to in:  50 [ shift ] [ 7 ] [ ÷ ] returns 19.69 ft


[ shift ] [ 8 ]:  kg/lb.   1 lb ≈ .4536 kg


200 lb to kg:  200 [ shift ] [ 8 ] [ × ] returns 90.72 kg 

66.5 kg to lb:  66.5 [ shift ] [ 8 ] [ ÷ ] returns 146.61 lb


[ shift ] [ 9 ]: ltr/gal.  1 gal ≈ 3.7854 ltr


150 gal to ltr:  150 [ shift ] [ 9 ] [ × ] returns 567.81ltr

690 ltr to gal:  690 [ shift ] [ 9 ] [ ÷ ] returns 182.28 gal


Percent:  The [ % ] key returns x% of y, while leaving the value in the Y stack.  This could be followed up with [ + ] or [ - ] for percent adding and subtracting calculations.  


Add 6% to 150.

150 [ ENTER ] 6 [ % ] [ + ] returns 159.00


Percent Change:  The [ shift ] [ % ] (∆%) calculates percent change:  (y - x)/y * 100 with the value of the Y stack remains. y is old, x is new.


What is the percent change from 35 to 45?

35 [ ENTER ] 45 [ shift ] [ % ] returns 28.57 (%)


The HP 45 has storage and recall arithmetic for the four arithmetic functions (+, -, ×, ÷).  I love storage arithmetic and any time we get recall arithmetic, it's a huge bonus. 


The keyboard feels good and the keys feel responsive.  


Statistics


The HP 45 has one-variable statistics, which some sums for y-data.


R5 = n

R6 = Σx^2

R7 = Σx

R8 = Σy

RCL Σ+ returns Σx to the X stack and Σy to the Y stack

[ shift ] [ R↓ ] returns x-bar to the X stack and sx to the Y stack


Stopwatch


A famous and undocumented feature of the HP 45 is a stopwatch.  The stopwatch is accessed by the sequence [ RCL ] then pressing [ 7 ], [ 8 ], and [ CHS ] keys at the same time.  Done right the display will be in the form:


hh.mm ss     'ss


Press [ CHS ] to start and stop the timer, and any number keys can be used to store the time for lap records.  The stored time will be stored as a decimal and the two two digit exponent will store the hundredths of seconds. 


Pressing [ CLx ] clears the time and [ ENTER ] returns us to the operator mode.  I understand that due to the lack of crystal, the timer is somewhat inaccurate.   


Closing Thoughts


I love this calculator!   It's good to have a calculator from the 1970s, especially from HP.  


Until next time,


Eddie


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


Friday, May 6, 2022

HP 32S and HP 32SII Week: Maximum, Minimum , Histogram

HP 32S and HP 32SII Week:  Maximum, Minimum , Histogram 





Introduction


The program takes data and determines:


*  maximum of the data set (X)

*  minimum of the data set (Y)

*  bin width using Scott's normal rule (h, see formula below)

*  number of bins (k, rounding is not included)


Scott's normal rule:

h = 3.49 * sx / (n^(1/3))


Number of bins:

k = (max - min) / h

In practice, take the ceiling of k.


Instructions


1.  Enter the first data point.

2.  Press XEQ D  (execute label D)

3.  Enter the next data point, press R/S.  Repeat until the last data point.

4.  Press XEQ C 


HP 32S/32SII Program:  Maximum, Minimum, Bin Width, Number of Bins

Total Size (labels D, S, C): 61.5, plus 48 bytes for statistical data

(D: 6.0, S: 18.0, C:  37.5)



D01 LBL D  // data

D02 CLΣ

D03 STO X

D04 STO Y


S01 LBL S

S02 RCL X

S03 x<>y

S04 x>y?

S05 STO X

S06 RCL Y

S07 x<>y

S08 x<y?

S09 STO Y

S10 Σ+

S11 STOP

S12 GTO S


C01 LBL C

C02 RCL X

C03 STOP

C04 RCL Y

C05 STOP

C06 -

C07 49

C08 1

C09 %   // C07 - C09: build 0.49 in 4.5 bytes instead of 9.5 bytes

C10 3

C11 +

C12 Sx

C13 ×

C14 n

C15 3

C16 1/x

C17 y^x

C18 ÷

C19 STO H

C20 STOP

C21 RCL X

C22 RCL- Y

C23 RCL÷ H

C24 STO K

C25 STOP


Example


Data Set:

4.0

5.8

5.7

5.2

4.6

4.9

6.3

7.1

6.6

6.4


4 XEQ D

5.8 R/S

5.7 R/S

...

6.4 R/S

XEQ C


X:  max:  7.1

Y:  min:  4

h:  1.58387549541

k:  1.95722454763  (2 bins)


Source:


"Histogram"  Wikipedia.  Last Updated March 28, 2022. https://en.wikipedia.org/wiki/Histogram  Last Accessed March 31, 2022.  


Up next:  a review of the HP 45 - May 9, 2022


Eddie 


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


Thursday, May 5, 2022

HP 32S and HP 32SII Week: Jurin's Law - Capillary Rise

HP 32S and HP 32SII Week:  Jurin's Law - Capillary Rise 





Capillary Motion 


Jurin's law describes the motion of liquid in small tubes, as the height is inversely proportional to the tube's diameter (and radius).  Factors include the contact angle and the density of the liquid.


The height of the liquid is determined by:


h = (2 * σ * cos θ) / (ρ * g * r)


σ = surface tension of the liquid (N/m)  (T)

θ = the angle of liquid in degrees, from adhesive (0° to 90°) to cohesive (90° to 180°) (B)

ρ = density of liquid (kg/m^3) (D)

r = radius of the tube (m) (R)


HP 32S and HP 32SII: Jurin's Law

Size:  33.5 bytes


J01 LBL J

J02 DEG

J03 INPUT T

J04 INPUT B

J05 INPUT D

J06 INPUT R

J07 2

J08 RCL× T

J09 RCL B

J10 COS

J11 ×

J12 RCL D

J13 RCL× R

J14 9.80665

J15 ×

J16 ÷

J17 STOP


Example:

Find the capillary rise of water in a tube with radius of 0.1 m.   

Data:  σ = 0.0728 N/m, θ = 0°, and ρ = 1000 kg/m^3


Inputs:

T = 0.0728

B = 0

D = 1000

R = 0.1


Result:  1.48470681E-4 m  (height)


Source:


"Jurin's law" Wikipedia.  Last updated February 11, 2022.  https://en.wikipedia.org/wiki/Jurin%27s_law  Last Accessed April 1, 2022.  


Lindeburg, Michael R. PE   Civil Engineering Reference Manual for the PE Exam 14th Edition  Professional Publications, Inc:  Belmont, CA.  pp. 14-11 to 14-13


Eddie


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


Wednesday, May 4, 2022

HP 32S and HP 32SII Week: Total Drag

HP 32S and HP 32SII Week:  Total Drag





Introduction


The following equation calculates the total drag force applied to parallel to an area in the opposite direction of the object's motion.  


Fd = 1/2 * ρ * v^2 * Cd * A,   ρ = P / (R * T)


ρ = air pressure 

P = absolute pressure (101,325 Pa, 14.696 psi, 2116.224 lb/ft^2)

R = specific gas constant (287.03 J/(kg k), 53.3533 (ft lbf/lb °R))

T = temperature (K = °C + 273.15, °R = °F + 459.67)


A = cross area that the drag force is applied (m^2, ft^2)

V = velocity of the object (m/s, ft/s)

Cd = drag coefficient (unitless)


The program gives outputs:


ρ = air pressure (kg/m^3, lb/ft^3)

Fd = total drag (kg*m/s^2, lb*ft/s^2)


HP 32S/32SII Program:  Total Drag, SI Units

Size: 55.5 bytes


F01 LBL F

F02 INPUT C

F03 INPUT A

F04 INPUT V

F05 INPUT T

F06 273.15

F07 +

F08 287.03

F09 ×

F10 1/x

F11 101,325

F12 ×

F13 STOP

F14 RCL× C

F15 RCL× A

F16 RCL V

F17 x^2

F18 ×

F19 2

F20 ÷

F21 STOP


Example:

C = drag coefficient = 0.31

A = area =7.0686 m^2

T = temperature = 18.8 °C

V = velocity = 3 m/s


Results:

ρ = 1.20915184207 kg/m^3

Fd = 11.9230799416 kg*m/s^2


HP 32S/32SII Program:  Total Drag, US Units

Size: 55.5 bytes


F01 LBL F

F02 INPUT C

F03 INPUT A

F04 INPUT V

F05 INPUT T

F06 459.67

F07 +

F08 53.3533

F09 ×

F10 1/x

F11 2116.224

F12 ×

F13 STOP

F14 RCL× C

F15 RCL× A

F16 RCL V

F17 x^2

F18 ×

F19 2

F20 ÷

F21 STOP


Example:

C = drag coefficient = 0.31

A = area =76.0868 ft^2

T = temperature = 65.84 °F

V = velocity = 9.84252 ft/s


Results:

ρ = 7.54778228E-2 lb/ft^3

Fd = 86.232900381 lb*ft/s^2



Source:


Lindeburg, Michael R. PE   Civil Engineering Reference Manual for the PE Exam 14th Edition  Professional Publications, Inc:  Belmont, CA.  pp. 17-41 and 17-42


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


Tuesday, May 3, 2022

HP 32S and HP 32SII Week: Hypergeometric Distribution

 HP 32S and HP 32SII Week:  Hypergeometric Distribution





What are the Odds?


The hypergeometric probably function deals with taking samples without replacement.  The trials are not independent.  The probability formula is:


G(S; N, T, M) =

1 ÷ nCr(N, M) * nCr(T, S) * nCr(N-T, M-S)


S = number of successes

N = main population size

T = target's population size

M = sample size


nCr(x, y) = x! ÷ ( y! * (x - y)!)


HP 32S/32SII Program:  Hypergeometric Distribution Probability

Size: 30 bytes


H01 LBL H

H02 INPUT S

H03 INPUT N

H04 INPUT T

H05 INPUT M

H06 RCL N

H07 RCL M

H08 Cn,r

H09 1/x

H10 RCL T

H11 RCL S

H12 Cn,r

H13 ×

H14 RCL N

H15 RCL- T

H16 RCL M

H17 RCL-S

H18 Cn,r

H19 ×

H20 STOP


Examples:


What are the odds that four hearts are dealt out of a five card hand?  Assume a standard, 52 card deck.


S = 4 (4 hearts)

N = 52 (52 cards)

T = 13 (13 hearts)

M = 5 (5 card hand)


Result:  1.07292917E-2 (≈1.07%)


What are the odds that a pair of Kings are dealt out of a five card hand?  Assume a standard, 52 card deck.


S = 2 (2 Kings)

N = 52 (52 cards)

T = 13 (13 hearts)

M = 5 (5 card hand)


Result:  3.99298181E-2 (≈3.99%)


Source:


"Hypergeometric Distribution"  Texas Instruments Programmable Slide-Rule SR-56 Applications Library  pp. 58-59 Texas Instruments, 1976


Download the document here, with gratitude to Datamath:

http://www.datamath.net/Manuals/SR-56_AL_US.pdf


Eddie



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

HP 32S and HP 32SII Week: Richter Scale

HP 32S and HP 32SII Week:  Richter Scale





Richter Scale


The equation calculates the massive energy given by a earthquake given the earthquake's magnitude by the Richter scale:


E = 10^(11.3 + 1.8 * M), where E is in ergs

 

with conversions:


Ergs to Joules:  multiply by 1 * 10^-7


Ergs to ft-lbs:  multiply by 7.3756 * 10^-8




Equation Modifications



Energy of an earthquake, given by Richter scale, in Joules (SI units):


E = 10^(4.3 + 1.8 * M)




Energy of an earthquake, given by Richter scale, in Foot-Pounds (US units):


E ≈ 10^(4.1678 + 1.8 * M)




HP 32S/32SII Program:  Earthquake Energy - SI Units

Size: 13.5 bytes


R01 LBL R

R02 18

R03 ×

R04 43

R05 +

R06 10

R07 ÷

R08 10^x

R09 STOP


Example:  3.4 Magnitude


Result:  26,302,679,919 J


Notes:


*  In general, each step takes 1.5 bytes.  


*  Integers 0 to 99 (HP 32S) and 0 to 254 (HP 32SII) takes 1.5 bytes while all other real numbers takes 9.5 bytes.  It could be advantageous to build numbers out of small integers than enter real number constants.  Using a real constant uses 6 steps.  


* It's supposed to be advantageous to end programs with STOP (R/S) than RTN. 



HP 32S/32SII Program:  Earthquake Energy - US Units

Size: 21.5 bytes


R01 LBL R

R02 18

R03 ×

R04 10

R05 ÷

R06 4.1678

R07 +

R08 10^x

R09 STOP


Example:  3.4 Magnitude


Result:  19,399,922,723.9 ft-lbs



Source:


Young, G.B.  "Earthquake Magnitude - Energy Conversation"  Hewlett-Packard HP-674/HP-97 User's Library Solutions:  Earth Sciences  Hewlett Packard:  Corvallis, OR.  pp. 1-4 February 1978


Download the document here, with gratitude to hpcalc.org:

https://literature.hpcalc.org/items/1015


Eddie


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

TI-84 Plus CE: All In Chance Game

TI-84 Plus CE:  All In Chance Game


The All In Chance Game


The objective is to get a high score by stopping the 2 x 2 board like this:


A   B

C  D


You score the sum of all four values.   Watch for negative values and zeroes.


Spots B, C, and D range from -2 to 5, while A has four possible values: -5, 0, 5, 10.


How many spins you get?  The game has a spinner from 2 to 7 spins.  


Free spins can be earned.  One way is to stop the board when A = 10.   There are two other ways, can you discover them?  



TI-84 Plus CE Program: ALLIN

(605 bytes)


Full

ClrHome

Output(1,1,"ALL IN GAME")

Output(2,1,"EWS 2022")

Wait 0.5

Output(4,1,"HOW MANY")

Output(5,1,"SPINS?")

Wait 0.5


0

Repeat Ans

randInt(2,7)→S

ClrHome

Output(1,3,"PRESS ANY KEY")

Output(3,3,"SPINS:")

Output(3,11,S)

Wait 0.25

getKey

End


ClrHome

Output(4,3,"YOU GOT")

Output(5,3,S)

Output(5,5,"SPINS!")

Output(7,3,"GOOD LUCK!")

Wait 0.8


0→T

0→M

While S>0

0

Repeat Ans

augment(5*randInt(­1,2,1),randInt(­2,5,3))→L6

ClrHome

Output(1,1,"SPINS LEFT: "+toString(S))

Output(3,4,L6(1))

Output(3,8,L6(2))

Output(6,4,L6(3))

Output(6,8,L6(4))

Output(8,1,"PRESS ANY KEY")

Wait 0.2

getKey

End

sum(L6)→P

T+P→T

If P>M:P→M

If L6(1)=L6(4) or L6(1)=10

Then

Output(1,1,"****FREE SPIN!****")

S+1→S

End

Output(8,1,"YOU GOT "+toString(P)+"         ")

Output(9,1,"TOTAL: "+toString(T))

Output(10,1,"PRESS ENTER")

Pause 

S-1→S

End


ClrHome

Disp "FINAL SCORE: "+toString(T)

Disp "BEST SPIN: "+toString(M)


Notes:


On the line Output(8,1,"YOU GOT "+toString(P)+"         "), extra spaces are needed to "erase" the PRESS ANY KEY message.


0 is entered before the Repeat Ans loop to make Ans "false", allowing for the loop to happen and the player to press any key to exit the loop. See the TI-Basic Developer's page for more details:  http://tibasicdev.wikidot.com/getkey


Source:


"The getKey Command"  TI-BASIC DEVELOPER: The TI-BASIC INFORMATION REPOSITORY.  Retrieved February 6, 2022.  http://tibasicdev.wikidot.com/getkey


This program is made with OS 5.7, but it should work on O.S versions 5.5 and 5.6.  Earlier OS versions may not have the Wait and toString commands.  


L6 refers to List 6, [ 2nd ]  [ 6  ].


Download the file here: 

https://drive.google.com/file/d/1QkrXnt6dR1KgEy-2d9JQxE7jmQS93Drk/view?usp=sharing

HP 32S and HP 32SII Week:  May 2, 2022 - May 6, 2022


Good luck!


Eddie



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

Casio fx-CG 50: Solar Panel Calculations

 Casio fx-CG 50: Solar Panel Calculations


Note:  The calculator programs can be modified for the monochrome Casio graphing calculators by removing the Color commands (Black, Blue, etc.).  The programs use ClrText and Locate to generate a result screen.


Optimum Tilt of a Solar Panel


The program SLRPANEL estimates the optimum tilt of a solar panel given your latitude (North/South), time of day, and day of the year.  The program assumes a 365 day year.   


For the time of day, enter the time in hours before noon.  Example:  For 9:00 AM, enter 3.   For 3:00 PM, enter -3.   


The declination of the sun is estimated at:


δ ≈ -23.44° * (cos(360°/365° * (n + 10)))

n = number of days from January 1, n = 0 for January 1.  


The program is listed in text file mode.


Casio fx-CG50 Program: SLRPANEL

(464 bytes)


'ProgramMode:RUN

Deg

ClrText

Locate 1,1,"SOLAR PANEL TILT"

Yellow Locate 1,3,"EWS 2022"

For 1->I To 750:Next


ClrText

"365 DAY YEAR ASSUMED"

"MONTH"?->M

"DAY"?->D

"HOURS FROM NOON"?->T

"LATITUDE (N//S)"?->L

0->X

M>2=>Int (0.4*M+2.3)->X

31*(M-1)+D-X-1->N

(-)23.44*(cos (360/365*(N+10)))->E

sin^-1 (sin L*sin E+cos E*cos L*cos (15*T))->H

sin^-1 (sin (15*T)*cos E/cos H)->Z

Z=0=>1Exp(-)9->Z

2/3*(tan^-1 (tan H/tan Z)-30)->P

ClrText

Black Locate 1,1,"MONTH:"

Blue Locate 8,1,M

Black Locate 11,1,"DAY:"

Blue Locate 16,1,D

Black Locate 1,3,"DEC:"

Blue Locate 7,3,E

Blue Locate 21,3,"_deg_"

Black Locate 1,5,"TILT:"

Blue Locate 7,5,P

Blue Locate 21,5,"_deg_"


Example:


April 30, 11:30 AM, at Latitude 40°20'11"


Inputs:

Month:  4

Day:  30

Hours From Noon:  0.5

Latitude:  40°20°11°   ( [ OPTN ], [ F6 ] ( > ), [ F5 ] (ANGLE), [ F4 ] ( ° ' " ))


Result Screen:

MONTH:  4   DAY: 30


DEC:  14.18251427 °


TILT:  34.39287954 °


Solar Energy Reflected


Given an incidence angle and the type of material, the program SOLARENG estimates the ratio of solar reflected.   The program offers three types of material:


Glass, average index of refraction of 1.52 is used

Silicon, average index of refraction of 3.45 is used

Diamond, average index of refraction of 2.417 is used


The program is listed in text file mode.


Casio fx-CG50 Program: SOLARENG

(324 bytes)


'ProgramMode:RUN

Deg

"INCIDENCE ANGLE"?->I

Menu "MATERIAL","GLASS",1,"SILICON",2,"DIAMOND",3

Lbl 1:1.52->R:Goto 4

Lbl 2:3.45->R:Goto 4

Lbl 3:2.417->R:Goto 4

Lbl 4

sin^-1 (sin I/R)->W

0.5*((sin (I-W))^<2>/(sin (I+W))^<2>+(tan (I-W))^<2>/(tan (I+W))^<2>)*100->P

ClrText

Black Locate 1,1,"AT ANGLE "

Black Locate 10,1,I

Black Locate 21,1,"_deg_"

Green Locate 1,2,"INDEX="

Red Locate 9,2,R

Green Locate 1,3,"REFLECT="

Red Locate 9,3,P

Red Locate 21,3,"%"


Example:


Incidence Angle: 6°, glass


Inputs:

INCIDENCE ANGLE: 6

MATERIAL: 1: GLASS


Result Screen:

AT ANGLE 6 °

INDEX = 1.52

REFLECT = 4.25820312 %


HP 32S and HP 32SII Week:  May 2, 2022 - May 6, 2022


Source:


Rosenstein, Morton.  Computing With the Scientific Calculator Casio 1986  ISBN-13:  978-1124161433


Eddie


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

Retro Review: Texas Instruments TI-57 LCD

Retro Review:   Texas Instruments TI-57 LCD











Quick Facts:


Model:  TI-57 LCD

Company:  Texas Instruments

Years:  1982-1984

Type:  Programming

Batteries: 2 x LR44

Operating Mode:  AOS

Memory Registers: Minimum of 1, Maximum of 8

Program Steps:  Minimum of 0, Maximum of 48


Similar to many Texas Instruments programming calculators of the 1970s and 1980s, the memory can be partition between memory steps and program steps by the [ 2nd ] [ Part ] key sequence.  Each register has 8 program steps.  


Some Partitions:


Part 1:  1 register (R0), 48 steps

Part 2:  2 registers (R0, R1), 40 steps

Part 3:  3 registers (R0, R1, R2), 32 steps

Part 4:  4 registers (R0, R1, R2, R3), 24 steps


Features 


* trigonometric functions and inverses

* polar/rectangular conversions and degrees/degrees-minutes-seconds conversions

* integer part (Intg), fractional part (Frac), absolute value ( |x| )

* logarithms (log, ln x)

* storage arithmetic ([STO] followed by +, -, ×, ÷, y^x, INV y^x)


INV Key combinations


[ INV ] [ sin ]:  arcsin

[ INV ] [ cos ]: arccos

[ INV ] [ tan ]:  arctan

[ 2nd ] [ INV ] (P<>R):  rectangular to polar

[ 2nd ] [ INV ] (DMS-DD):  degrees to degrees-minutes-seconds

[ INV ] [ y^x ]:  y^(1/x)

[ INV ] [ log ]:  10^x

[ INV ] [ ln ]: e^x

[ 2nd ] [ INV ] (SBR):  RETURN - this ends subroutines

[ 2nd ] [ INV ] (Dsz):  Decrement R0 by 1 and skip if R0 ≠ 0


Polar to Rectangular:

r [ x<>t ] θ [ 2nd ] [ P<>R ]:   y [ x<>t ] x


Rectangular to Polar:

x [ x<>t ] y [ 2nd ] [ INV ] [ P<>R ]:   θ [ x<>t ] r


Keystroke Programming


The TI-57 LCD is a keystroke programmable calculator.   However, programming steps are at a premium with a maximum of 48 steps (allowing for one memory register) to 0 (yes, zero) if you use all 8 registers (R0 to R7).  


Programming commands include:


*  Test with the t register:  x=t,  x≥t, and inverses

*  Decrement and Skip:  either skip on zero or not on zero.  This command works on register 0.  

*  Labels and Go to commands:  labels 0-9

*  Pause command

*  Subroutines (SBR)

*  Go to step zero (RST)


Thankfully some steps are merged, mainly with the [ INV ] key, [ GTO ] key (GO TO command), [ 2nd ] key, and storage arithmetic.  


What is interesting is that there are no statistical functions on the TI-57 LCD.   See the One Variable Statistics section for a 25-step program to add one-variable statistics.  


Keyboard


We need to talk about the keyboard.  The keyboard looks good.  I have the United States edition of the TI-57 LCD and I like the blue, gray, black, and white color scheme.   


Unfortunately, some keys are hard to press and other keys can produce a double-stroke.  With the calculator I got, one wrong press gives a double number (22 instead of 2, 00 instead of 0) while some keys pressed in the "wrong" way do not register.  This does not allow for fast typing.   I think I found the keys "sweet spots":  the right side of the keys.    


The keyboard difficulties are a common complaint with the TI-57 LCD.   They are corrected with the TI-57 II released in 1986.  


TI-57 LCD Program:  One Variable Statistics

Memory Registers Required: 3  (Part 3)


00  23.01     LBL 1   // data entry

01  61.85.01 STO+ 1

02  34 x^2

03  61.85.02 STO+ 2

04  1 1

05  61.85.00 STO+ 0

06  13 R/S

07  22.01     GTO 1


08  23.02     LBL 2   // calculation

09  71.01    RCL 1

10  55 ÷

11  71.00     RCL 0

12  95 =

13  13 R/S   // sample mean

14  71.02     RCL 2

15  55 ÷

16  71.00     RCL 0

17  75 -

18  53 (

19  71.01     RCL 1

20  55 ÷

21  71.00     RCL 0

22  54 )

23  34 x^2

24  95 =

25  35

26  13 R/S  // population deviation


Registers used:

R0 = number of data points = n

R1 = sum of the data points = Σx

R2 = sum of the data points squared = Σx^2


Mean:

x-bar = Σx / n


Population Deviation

σx = √( Σx^2/n - (Σx/n)^2 )


Instructions:

1.  If necessary, partition memory to fit 3 memory registers (R0, R1, R2).  [ 2nd ] (Part) [ 3 ].

2.  Enter the first point, press [ GTO ] [ 1 ], then [ R/S ].  1 is displayed when data points are entered.

3.  Enter each subsequent point, press [ R/S ].  Repeat until finished.  

4.  To calculate the mean and population deviation, press [ GTO ] [ 2 ].   The mean is displayed first, press [ R/S ] to display population deviation.  


[ RCL ] [ 0 ]:  number of points

[ RCL ] [ 1 ]:  sum of data points

[ RCL ] [ 2 ]:  sum of squares of data points


Example 1:


Data Set: 4, 5, 9, 8, 6


Results:

n = 5

Σx = 32

Σx^2 = 222

x-bar = 6.4

σx = 1.854723699


Example 2:


Data Set: 11058, 12360, 12445, 12761, 13002, 13360


Results:

n = 6

Σx = 74986

Σx^2 ≈ 9.40 * 10^8

x-bar = 12497.66667

σx = 725.9110757


Closing Thoughts


I wish the TI-57 LCD had both more memory and functions.   Honestly, Texas Instruments could combine the functions of the TI-57 LCD (tests, labels, go to, decrement and skip), the TI-55 III (better keyboard, linear regression, integrals, unit conversions, signum function, permutations, combinations), and the later TI-60 (the TI-55III with base conversions) with a total of 188 steps.  The programming set up with the TI-57 LCD wins with it's merged steps with INV, STO, LBL, and GTO.   


Overall, I like the appearance of the TI-57 LCD, despite the keyboard's set backs. That, the lack of functions and statistics, and the sometimes slow execution and we can see why the TI-57 LCD was not a best seller.  


HP 32S and HP 32SII Week:  May 2, 2022 - May 6, 2022


Until next time,


Eddie


All original content copyright, © 2011-2022.  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: Financial Functions (2nd Edition)

Python:  Financial Functions (2nd Edition) This is an update to the python file, which I first released on May 17, 2020: https://edspi31415....