## Sunday, October 18, 2020

### HP 42S/DM42: Height of a Fire, Time to Clear a Corridor

HP 42S/DM42:  Height of a Fire, Time to Clear a Corridor

HP 42S/DM42/Free42 Program:  FIREHGT

The program FHGT approximates the height of a fire in three scenarios:

* A relatively large fire

* A fire with a base area of approximately 0.5 meter

* A fire set in a corner

The general equation is:

H = factor * Q^0.4

H = height of a fire in meters, including the tip

factor = constant depending on the scenario the fire is set in

Q = energy release rate in kilowatts

00  {119-Byte Prgm}

01 LBL "FIREHGT"

02 "ENERGY? (kW)"

03 PROMPT

04 STO 01

05 LBL 00

06 "TYPE?"

07 AVIEW

08 "LARGE"

09 KEY 1 GTO 01

10 "0.5 M"

11 KEY 2 GTO 02

12 "CORNER"

13 KEY 3 GTO 03

15 LBL 10

16 STOP

17 GTO 10

18 LBL 01

19 0.23

20 GTO 04

21 LBL 02

22 0.21

23 GTO 04

24 LBL 03

25 0.075

26 GTO 04

27 LBL 04

29 EXITALL

30 RCL 01

31 0.4

32 Y↑X

33 ×

34 "HEIGHT="

35 ARCL ST X

36 AVIEW

37 END

Example:

Q = 2650 kW

large fire:  H = 5.38302238231 m

0.5 m fire:  H = 4.9149334795 m

corner fire:  H = 1.7553338554 m

HP 42S/DM42/Free42 Program:  SMOKE

The program SMOKE estimates:

*  The front velocity of the smoke, or how quickly the smoke fills a corridor

*  The time it takes for front velocity to fill the corridor.

Equations used:

V ≈ 0.5 * √(g * (1 - Ta/T) * H)

tf = L / Vf

g = acceleration of gravity, for Earth, g = 9.80665 m/s

Ta = ambient temperature

T = gas temperature  (Ta ≤ T)

H = height of the corridor in meters

L = length of the corridor in meters

Note 1 - Ta/T = (Da - Dc) / Da

Da = density of the corridor of the ambient air

Dc = density of the fire fluid

00 {99-Byte Prgm}

01 LBL "SMOKE"

02 1

03 "AMB. TEMP?"

04 PROMPT

05 "GAS TEMP?"

06 PROMPT

07 ÷

08 -

09 9.80665

10 ×

11 "HEIGHT? (M)"

12 PROMPT

13 ×

14 SQRT

15 2

16 ÷

17 ENTER

18 "VEL= "

19 ARCL ST X

20 AVIEW

21 STOP

22 R↓

23 1/X

24 "LENGTH? (M)"

25 PROMPT

26 ×

27 "TIME="

28 ARCL ST X

29 AVIEW

30 END

Example:

Amb. Temp:  78 °F = 25.555555556 °C

Gas Temp:  103 °F = 39.44444444 °C

Height:  3.048 m

Length:  3.6576 m

Results:

Velocity:  1.622103844 m/s

Time:  2.254849474 s

Source:

Lawson, J.R. and Quintiere, J.G..   "Slide Rule Estimates of Fire Growth". Fire Technology, Vol. 21., No. 4, November 1985, pg. 267

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, October 17, 2020

### Review: Catiga CS-121

Review:  Catiga CS-121

Just the Facts:

Model:  CS-121 (could be other model numbers)

Company: Catiga

Type: Graphing

Battery:  Case contains 2 CS-2032 slots, but can run on 1

Logic: Algebraic

Memory Registers: 9

Colors:  Many colors including Black, Red, Blue.  I purchased a blue CS-121.

Case and Keyboard

The cover case and calculator casing for the CS-121 is very light.  When sliding the calculator into the case, you really have to listen for the snap to lock the calculator in place.  The keys are very fast and responsive, you will have no problems typing in expressions quickly.

Screen

Like most graphing calculators, the CS-121 has a large screen.  However, the CS-121 does not use the screen like most graphing calculators.   The CS-121 operates as a large Casio fx-6300g instead.   Graphs take up part of the left side of the screen and you can see only the X or the Y (not both) coordinates during tracing.   The expression line is reduced to the bottom line of the screen.

This is my biggest gripe of the CS-121.   This screen scheme may have worked on the fx-6300g and its relatives fx-6200g and HP 9g because they have small screens to work with, but the CS-121 should have full screen graphs and allowed the use of the entire screens for expressions in Home mode.

Features of the CS-121

Left,  Catiga CS-121;  Right, Casio fx-6300g

The CS-121 isn't an entire clone of the fx-6300g because it does have some nice advanced features.

Graphing:  Functions (up to 2 functions), Parametric (1 parametric pair)

Calculus:  Numeric Integrals of f(x)

Solver:  Solve for any variable

Complex Number Mode:  Arithmetic, Cube, Cube Root, Square, Square Root, Absolute Value, Argument (angle).   The [ENG] acts as the i key.  Switch between showing the real and complex results by pressing [ SHIFT ] [ = ].  All complex numbers operate in rectangular format (a + bi).

Regressions:  Linear, Logarithm, Exponential, Power, Inverse, Quadratic.   Get the correlation ( r ) by pressing [SHIFT] [ ( ].

Base-N:  The CS-121 adds boolean logic functions ([x^3] key):  And, Or, Nxor, Xor, Not, Neg

Drawing Tools:  Plot points, lines including lines between two points, horizontal, vertical, and tangent.   It is a little frustrating that the CS-121 does not use the entire screen for graphs because it would really enhance the use of the drawing tools.

Memory

Let's talk about the memory.  It is very unusual for a graphing calculator to only have nine memory slots (A, B, C, D, E, F, X, Y, M with M+ and M-).  It's because the CS-121 does not have programming.  Yes, you can store an equation in the form var=f(vars) with the [SHIFT] [ Calc ] (PROG) key sequence and calculate using the stored equation by using [ Calc ].

It is very rare that a graphing calculator does not have programming.  The rare Casio fx-6200g was a direct relative to the fx-6300g and it did not have programming.

The Learn (LRN) Key

The [LRN] key allows users to shift graphs or change the size of the graphs.  Handy when learning about functions.

Verdict

I like the keyboard and I like how responsive the calculator operates.  The CS-121 operates on not much batter (ultimately 1 CS-2032 battery).  As said before, my major gripe is the mismanaged use of the screen.

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.

## Thursday, October 15, 2020

### HPCC 2020 Virtual Conference and Document Website

HPCC 2020 Virtual Conference and Document Website

HPCC 2020 Virtual Conference

The HPCC 2020 Virtual Conference took place on October 10, 2020.   The HPCC is the Handheld and Portable Computer Club is a long running calculator and computer site based out of the United Kingdom.  Their meetings are held virtually on the 2nd and 4th Saturday of every month.  I have recently joined the HPCC and glad to be a part of the club.

You can find more information on the meetings here:  http://www.hpcc.org, under the Home tab.  Membership rates are between £17 to £23 depending where you live.

The conference has the following speakers and topics:

Eric Rechlin:  USB Drive Update

Jake Schwartz:  Updates to the PPC Archive

Bob Prosperi:  Swiss Micros DM41X - A little late; a lot better

Eric Hazen:  HP-25 Re-implementation on Z80 with VFD display

Michael Park:  MP-29 - a tactile touchscreen calculator

Mark Power:  Prime G2

Sylvain Côté:  Clonix & NoV modules for the HP-41

Edward Shore:  CAS and Calculators

Gene Wright and Włodek Mier-Jędrzejowicz: HP's Worst Calculators

Godwin Stewart:  Presentation on DMConnect

Will Marchant:  DM16 in a satellite launch campaign

Conference web page:  http://www.hpcc.org/conferences/index.html

HP Documentation Website

Eric Rechlin of hpcalc.org has put together a new website where you can download manuals for Hewlett Packard calculators, past and present.

Coming soon:  the USB that contains information calculator conferences including manuals through 2020 will be available his commerce site,  https://commerce.hpcalc.org.

Eddie  (Edward Shore)

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.

## Sunday, October 11, 2020

### Casio Classpad: Theorem of Sós

Introduction: The Theorem of Sós

A set of triple rational numbers (a, b, λ) is considered to be a H-triple if

c = √(a^2 - 2 λ a b + b^2) is also a rational number.  (I)

Heron Triple

Should the set of rational numbers (a, b, λ) can be further test to see if to is also a Heron triple.  That criteria (see source) requires for some numbers λ' and A (area):

λ' = √(1 - λ^2) is a positive rational number, and

A = λ' * abs(a * b) / 2 is a natural number  (positive integer)

This implies for all cases for Heron Triples that abs(λ) < 1, or -1 < λ < 1.

If the H-triple passes, then it becomes a Heron triple and the sides (a, b, c) (see (I) above) are the lengths of a Heron triangle.

It is possible that an H-triple is not a Heron triple.

Today's blog focuses on H-triples.

Generating H-Triples

Given relatively prime integers m and n (where gcd(m,n) = 1) and μ, an H-triple can be generated by the following equations:

(II)

a = μ * (m^2 - n^2)

b = μ * (2*m * (n + λ*m))

c = μ * (m^2 + 2*λ*m*n + n^2)

For a > 0, this requires that m > n.  In the program htrigen, I assume that μ = 1.  In the program, u = λ

(fx-CP400 and fx-CG500)

'2020-09-15 EWS

'H Triple

Local a,b,c,m,n,u

Input m, "m > n", "m?"

Input n, "m > n", "n?"

Input u, "λ? (rational)"

If gcd(m,n)≠1

Then

Print "m and n are not"

Print "relatively prime."

Stop

IfEnd

(m^2 - n^2) ⇒ a

(2 × m × (n + u × m)) ⇒ b

(m^2 + 2 × u × m × n + n^2) ⇒ c

Print "H-Triple:", ColorMagenta

Print "{a,b,λ}="

Print {a,b,u}, ColorBlue

Print "c="

Print c

Example:

m = 7, n = 3, λ = 2/3

Result:

a = 40, b = 322/3, c = 86

Testing the Theorem of Sós

The program htrist tests the criteria for the triple (a, b, λ).

Testing numbers in a program to see that they are rational is not as easy as it appears. Thankfully, the functions numerator and denominator can be used on the Classpad.  The numerator function converts the number into an exact fraction and extracts its numerator.  Similarly, the denominator function converts the number into an exact fraction and extracts its denominator.

For an irrational number such as √2, the Classpad determines the exact fraction to be

√2/1.

(fx-CP400 and fx-CG500)

'2020-09-15 EWS

'H Triple test

Local a,b,c,n,d,u

Input a

Input b

Input u, "λ? (rational)"

√(a^2 - 2 × u × a × b + b^2) ⇒ c

numerator(c) ⇒ n

denominator(c) ⇒ d

ClrText

Print {n, d}

If frac(n) = 0 and frac(d) = 0

Then

Print "H Triple", ColorGreen

Print {a, b, u}

Print "c ="

Print c

Else

Print "No Solution", ColorRed

IfEnd

Example:

a = 85, b = 374, λ = 1

Results:

c = 289,  n = 289, d = 1

Source:

Halbeisen, Lorezn and Hungrebühler, Nobert.  "Heron triangles and their elliptic curves" Journal of Number Theory 213 (2020) 232-253.  https://doi.org/10.1016/j.jnt.2019.12.005

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, October 10, 2020

### Sines and Cosines: Adding and Subtracting Angles

Sines and Cosines:   Adding and Subtracting Angles

Note:

Sine

sin(x + π/2) = sin(x) cos(π/2) + cos(x) sin(π/2) = cos(x)

sin(x - π/2) = sin(x) cos(π/2) - cos(x) sin(π/2) = -cos(x)

sin(π/2 - x)  = sin(π/2) cos(x) - cos(π/2) sin(x) = cos(x)

sin(x + π) = sin(x) cos(π) + cos(x) sin(π) = -sin(x)

sin(x - π) = sin(x) cos(π) - cos(x) sin(π) = -sin(x)

sin(π - x)  = sin(π) cos(x) - cos(π) sin(x) = sin(x)

Cosine

cos(x + π/2) = cos(x) cos(π/2) - sin(x) sin(π/2) = -sin(x)

cos(x - π/2) = cos(x) cos(π/2) + sin(x) sin(π/2) = sin(x)

cos(π/2 - x) = cos(π/2) cos(x) + sin(π/2) sin(x) = sin(x)

cos(x + π) = cos(x) cos(π) - sin(x) sin(π) = -cos(x)

cos(x - π) = cos(x) cos(π) + sin(x) sin(π) = -cos(x)

cos(π - x) = cos(π) cos(x) + sin(π) sin(x) = -cos(x)

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.

## Sunday, October 4, 2020

### TI-84 Plus CE: Lorenz Curves and the Gini Coefficient

TI-84 Plus CE:  Lorenz Curves and the Gini Coefficient

Introduction - Graphing Income Inequality

Developed by Max O. Lornez, the Lorenz curve displays the graphs of income distribution and income inequality.  Each point of represents a cumulative percentage of an income level.   An example of a Lorenz curve:

(25%, 9%):   The first 25% of a population earns 9% of the population's total income

(50%, 21%):  Half of the population earns only 21% of the total income.

(75%, 44%):  The bottom 75% of the population earns 44% of the total income.

(100%, 100%):  This represents the total population.

The Lornez curve is compared against a straight line which connects points (0%, 0%) to (100%, 100%).    The ratio between the top area and the whole curve is called a Gini coefficient.  If the Gini coefficient is 0, then there is no income inequality.  On the other hand, the closer that the Gini coefficient is to 1, there is more income inequality.  The diagram below is a Lorenz curve.

Calculating the Gini Coefficient

Let:

A = the area above the Lorenz  curve and below the straight line

B = the area above the x axis and below the Lorenz curve

W = the total area = A + B = 1/2 * max(x value) * max(y value)

Note: that the total area is the area of a right triangle

The Gini coefficient is defined as:

G = A / (A + B) = (W - B) / B

TI-84 Plus CE Program: LORENZ

430 bytes

"2020-09-13 EWS"

Menu("LORENZ CURVE", "EQUAL PERCENTILE", 1, "DATA", 2)

Lbl 1

Input "DATA?", L4

dim(L4) → N

cumSum(L4) → L6

seq(100J/N, J, 1, N) → L3

L3 → L5

Goto 3

Lbl 2

Disp "ASCENDING ORDER: Y"

Input "X DATA?", L3

Input "Y DATA?", L4

cumSum(L3) / sum(L3) * 100 → L5

sumSum(L3 * L4) / sum(L3 * L4) * 100 → L6

Goto 3

Lbl 3

"BELOW"

augment( {0}, L5 ) → L5

augment( {0}, L6 ) → L6

sum( seq(.5 * (L5(J) - L5(J-1)) * (L6(J) + L6(J-1)) /2 , J, 2, dim(L6) ) ) → B

"WHOLE"

.5 * max(L5) * max(L6) → W

(W - B) / W → G

Disp "GINI INDEX:", G

Pause

Func

PlotsOff

FnOff

FnOn 1

PlotsOn 1

10 → Xscl : 10 → Yscl

Plot1( xyLine, L5, L6, □, RED)

"max(L6)*X/100" → Y1

ZoomStat

There are two options:

1. Equal Percentile:  Enter the percentage of each bin.  The percentile of each class is divided equally. Example:  for ten data points, the percentiles are split in 10% increments.

(10%, y1%)
(20%, y2%)
(30%, y3%)
(40%, y4%)
(50%, y5%)
(60%, y6%)
(70%, y7%)
(80%, y8%)
(90%, y9%)
(100%, y10%)

2.  Data:  Enter x and y data.   For y data, make sure that list has all of its elements in ascending order.

The graph displays in values of percents.  X Axis: 0 to 100 (representing 0% to 100%).  Y Axis: 0 to 100 (representing 0% to 100%).

Examples

Example 1:  Equal Percentile

The total health spending for high average per capita in 10% percentiles in 2002.  (see source for background information)

Percentile Percent of Health Spending
10% 0%
20% 0.1%
30% 0.6%
40% 1.2%
50% 2%
60% 3.4%
70% 5.4%
80% 9.1%
90% 16.5%
100% 61.7%

Enter Option 1: Data.

Gini Index: 0.8633

List = { 0, .1, .6, 1.2, 2, 3.4, 5.4, 9.1, 16.5, 61.7 }

Example 2:  Data

Hourly employees of a company and their wages:

Number of Employees Hourly Wage
156 \$15.00
195 \$30.00
53 \$50.00
49 \$70.00

X Data:  {156, 195, 53, 49}
Y Data:  {15, 30, 50, 70}

Gini Index:  0.6379627898

Source:

Reindhardt, Uwe E.   "The Construct of Lorenz Curves and of The Gini-Coeficient to Decpict Degrees in Inequality in Health Care"  Princeton University, WWS 597  (Political Economy of Health Systems)
Retrieved August 26, 2020

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, October 3, 2020

### TI-84 Plus CE and HP 41C: Method of Successive Substitutions

TI-84 Plus CE and HP 41C:  Method of Successive Substitutions

Repeating the Calculation Again and Again

With an aid of a scientific calculator, we can solve certain problems of the form:

f(x) = x.

Examples include:

tan cos sin x = x

e^-x = x

atan √x = x

sin cos x = x

(acos x) ^ (1/3) = x

In any case with trigonometric functions, the angle mode will need to be in radians.  You will also need a good guess to get to a solution and to know that at some real number x, f(x) and x intersect.

Take the equation ln(3*x) = x with initial guess x0 = 1.512

Depending on the operating of the scientific calculator the keystrokes would be:

AOS:

1.512 [ = ]

Loop:  [ × ] 3 [ = ] [ ln ]

RPN:

1.512 [ENTER]

Loop:  3 [ × ] [ ln ]

ALG:

1.512 [ENTER/=]

Loop:  ln( 3 * Ans) [ ENTER/= ]

Repeat the loop as many times as you like and hope you start seeing the answers converge.   After repeating the loop over and over and over again, at six decimal answers, the readout will be about 1.512135.

An approximate answer to ln(3x) = x, x ≈ 1.512134552

If your calculator has a solve function, you can check the answer, but this method can be useful if your calculator does not have a solve function.

The program SUCCESS illustrates this method.

TI-84 Plus CE Program (TI-83 Family) Program:  SUCCESS

285 bytes

"2020-09-08 EWS"

Disp "SUCCESIVE SUBSTITUTION", "F(X)=X"

Disp "USE QUOTES FOR F(X)"

Input "F(X)? ", Y1

Input "GUESS? ", G

Input "PRECISION? ", P

0 → I

1 → T

Repeat T<10^-P

Y1 → Z

abs(Z - X) → T

Z → X

I + 1 → I

If I > 200

Then

Disp "ITERATIONS EXCEEDED", "NO SOLUTION FOUND"

Stop

End

End

ClrHome

Disp "SOLUTION=",  round(X,P), "ITERATIONS=", I, "ABS DIFF", T

HP 41C/DM41 Program: SUCCESS

This program calls on the subroutine, FX.   FX is where you enter f(x).  End FX with the RTN command.

01 LBL^T SUCCESS

02 ^T F<X>=X

03 AVIEW

04 PSE

05 ^T GUESS?

06 PROMPT

07 STO 00

08 ^T PRECISION?

09 PROMPT

10 STO 02

11 0

12 STO 03

13 1

14 STO 04

15 LBL 01

16 RCL 00

17 XEQ ^FX

18 STO 01

19 RCL 00

20 -

21 ABS

22 STO 04

23 RCL 01

24 STO 00

25 1

26 ST+ 03

27 200

28 RCL 03

29 X>Y?

30 GTO 02

31 RCL 02

32 CHS

33 10↑X

34 RCL 04

35 X>Y?

36 GTO 01

37 ^T SOL=

38 ARCL 01

39 AVIEW

40 STOP

41 ^T ITER=

42 ARCL 03

43 AVIEW

44 STOP

45 ^T DIFF=

46 ARCL 04

47 AVIEW

48 STOP

49 GTO 04

50 LBL 02

51 ^T NO SOL FOUND

52 AVIEW

53 STOP

54 LBL 04

55 END

Examples for FX:

f(x) = sin cos x.

Program:

LBL ^FX

COS

SIN

RTN

f(x) = e^-x

Program:

LBL ^FX

CHS

E↑X

RTN

Be aware, some equations cannot be solved in this manner, such as x = π / sin x and x = ln(1 / x^4).

Cheung, Y.L. "Using Scientific Calculators to Demonstrate the Method of Successive Substitutions"  The Mathematics Teacher.  National Council of Teachers of Mathematics.  January 1986, Vol. 79 No. 1 pp. 15-17  http://www.jstor.com/stable/27964746

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.

## Sunday, September 27, 2020

### Financial Calculators: Deferred Mortgages: Solving for Payment and Price

Financial Calculators:  Deferred Mortgages: Solving for Payment and Price

Finance Now, Pay Later!

When a customer financing a loan or mortgage, and the customer can enjoy the benefits for a period of months prior to being required to make the first payment, we are dealing with a deferred mortgage.   Interest is accrued from the beginning of the mortgage.

The procedures outlined on this blog entry can be applied to any financial calculator* with time value of money keys, such as the HP 12C and the HP 10bII+ (see source below).

* The procedure should be fine for most financial calculators.   Check your manual for details.

Deferred Mortgage:  Finding The Monthly Payment

Part 1:

Set the calculator to END mode.

N:  Enter the number of deferred payments minus 1

I:   Enter the interest rate of the loan

PV:  Enter the borrowed amount as a negative number

PMT:  Set to 0

Solve for FV

Part 2:

PV = FV from part 1   ( RCL FV, STO PV )

N:  Enter the number of payments of the term

I = interest rate of the loan

FV:  Enter the balloon payment as a negative number.  If there is no balloon payment, enter 0.

Solve for PMT, this is your payment of the deferred mortgage.

Example 1:

A homeowner finances a house for \$455,000.00.   The mortgage lasts for 30 years at 2.86%.   No payment is due for the first six months of the mortgage.

Part 1:

N: 6 -1 = 5

I:  2.86% annual rate, about 0.24% per month

PV:  -455000.00

PMT:  0.00

FV = 460447.99

Part 2:

PV:  460447.99

N:  30* 12 = 360

I:  2.86% annual rate, about 0.24% per month

FV:  0.00

PMT = -1906.67

The monthly payment is \$1,906.67.

Example 2:

A homeowner purchases a fixer-up property for \$149,000.00.  The buyer secures a 15-year mortgage at 4%.  The end of the loan requires a \$1,000.00 balloon payment but allows the buyer to defer the first payment for five months.

Part 1:

N:  5 - 1 = 4

I:  4% annual rate, about 0.33% per month

PV:  -149000.00

PMT: 0.00

FV = 150996.62

Part 2:

PV:  150996.62

N:  15 * 12 = 180

I:  4% annual rate, about 0.33% per month

FV: -1000.00

PMT = -1112.84

Deferred Payment:  Calculating the Price of the Mortgage

Part 1:

Set the calculator to END mode.

N:  Enter the number of payments of the term

I:   Enter the interest rate of the loan

PMT: Enter the payment as a positive number

FV: Enter the balloon payment as a positive number.  If there is no balloon payment, enter 0.

Solve for FV

Part 2:

FV = PV from part 1   ( RCL PV, STO FV )

N:  Enter the number of deferred payments minus 1

I = interest rate of the loan

Set PMT to 0

Solve for PV, this is your price of the deferred mortgage.

Example 3:

An owner enters a lease which requires at monthly payment of \$495.00.  The lease lasts for 8 years at 6.69%.  There is no balloon payment at the end of the lease.  The lease allowed the owner to defer the first required payments for three months.  What is the value of the lease?

Part 1:

N:  8 * 12 = 96

I:  6.69% annual rate, about 0.56% per month

PMT:  495.00

FV:  0.00

PV = -36721.17

Part 2:

FV:  -36721.17

N:  3 - 1 = 2

I:  6.69% annual rate, about 0.56% per month

Set PMT to 0

PV = 36315.13

The value of the lease is \$36,315.13.

Example 4:

An owner executes a 30-year, 3% mortgage with the required payment of \$1,005.85.  The mortgage allows for the first payment to be deferred for six months.  A \$1,000.00 balloon payment is required.  What is the price of the mortgage?

Part 1:

N:  30 * 12 = 360

I:  3% annual rate, 0.25% per month

PMT:  1005.85

FV:  1000.00

PV = -238983.97

Part 2:

FV:  -238983.97

N:  6 - 1 = 5

I:  3% annual rate, 0.25% per month

Set PMT to 0

PV = 236018.94

The value of the lease is \$236,018.94.

And that is how we work with deferred mortgages.

Source:

Greynolds Jr., Elbert B. and Aronofsky, Julius S.  Practical Real Estate Financial Analysis: Using The HP 12C Calculator:  A Step-by-Step Approach   Real Estate Education Company: Dearborn Financial Publishing, Inc.  1983.  ISBN 0-88462-378-5

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, September 26, 2020

### Retro Review: TI-36 Solar

Retro Review:  TI-36 Solar

Just the Facts:

Model:  TI-36 Solar

Company: Texas Instruments

Type: Scientific

Display:  10 digit with 2-digit exponents

Battery:  Solar

Logic: AOS

Memory Registers: 1

Years: 1984-1990

Features:

*  Complex Number Arithmetic

*  Rounding Numbers (to fixed number setting)

*  Base Conversions

*  Normal Distribution

*  Single-Variable Statistics

Examples with Complex Numbers

MODE 5:  CPLX

There are two separate registers to hold parts of complex numbers:

[ a ]:  Real part (rectangular),  Radius (polar)

[ b ]:  Imaginary part (rectangular), Angle (polar)

Example 1:  (4 + 3i) * (11 - 2i)

4 [ a ] 3 [ b ] [ × ] 11 [ a ] 2 [ +/- ] [ b ] [ = ]

Display:  50

Press [ b ], Display:  25

Result:  50 + 25i

Example 2:  Convert 3 + 2.4i to polar form, degrees

3 [ a ] 2.4 [ b ] [ INV ] (R>P)

Display:  3.841874542

Press [ b ],  Display:  38.65980826

3 + 2.4i = 3.841874542 ∠ 38.65980826°

Examples with Normal Distribution

MODE 6:  STAT

There are three functions that determine the area under the normal distribution curve:

P(t) from - ∞ to t,  lower tail curve

R(t) from 0 to t

Q(t) from t to ∞, upper tail curve

Note that for any t, P(t) + Q(t) = 1.

Also note that P(t), R(t), and Q(t) will operate on the standard normal curve, where μ = 0 and σ = 1, regardless of the amount of data points entered in Statistics mode through Σ+.

For z = t =2:

2 [ INV ] ( P(t) ) returns 0.97725

2 [ INV ] ( R(t) ) returns 0.47725

2 [ INV ] ( Q(t) ) returns 0.02275

Comparison:  TI-36 Solar vs. TI-35 Plus

The TI-36 Solar and TI-35 Plus have the same set of functions and features.  You can see my retro review from 2017 of the TI-35 Plus here:  http://edspi31415.blogspot.com/2017/09/retro-review-texas-instruments-ti-35.html

There are several keyboard differences:

Shift key is marked [ INV ] (with 2nd above it) for the TI-36 Solar, and the shift key is marked [ 2nd ] for the TI-35 Plus.

The equals key is twice in vertical height, covering the spans of the bottom two rows on the TI-35 Plus.

The top three rows* (all of the shift markings remain intact):

TI-36 Solar:

[CE/C] [ 1/x ] [ a ] [ b ] [ AC ]

[ hyp ] [ sin ] [ cos ] [ tan ] [ DRG ]

[ INV ] [ x^2 ] [ log ] [ ln x ] [ y^x ]

TI-35 Plus:

[ 2nd ] [ x^2 ] [ log ] [ ln x ] [ OFF ]

[ hyp ] [ sin ] [ cos ] [ tan ] [ DRG ]

[ y^x ] [ 1/x ] [ a ] [ b ] [ ÷ ]

The [ hyp ] key has the hyp^-1 label over it on the TI-35 Plus.

*not counting the [ON/C] key above all the rows on the TI-35 Plus

Comparison:  TI-36 Solar vs. the original TI-36X Solar

Here is my review from 2018 for the TI-36X Solar:  http://edspi31415.blogspot.com/2018/09/retro-review-texas-instruments-ti-36x.html

The TI-36X Solar:

*  does not have the complex arithmetic mode of the TI-36 Solar

*  adds the Boolean functions AND, OR, XOR, XNOR, and NOT to the BIN, OCT, and HEX mode

*  adds a second shift key, [ 3rd ]

*  there is no [ MODE ] key, every mode is selected through [ 3rd ] (key) combos

*  adds 8 scientific constants and 10 metric/US conversions

Verdict

Like the TI-35 Plus, the TI-36 Solar is a step up from the TI-30 series (1980s versions of TI-30).   Again, the TI-34 (1987) has the Boolean functions and fraction functions that the TI-36 Solar doesn't.  You don't have to worry about batteries at all since the TI-36 Solar runs entirely on solar/light power.

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.

## Sunday, September 20, 2020

### Sumat 6

Sumat 6

Introduction

The Addimult Sumat 6 is a mathmatical aid designed to aid the user in addition and subtraction calculations.  Addimult was primarily based in Germany and Liechtenstein, which produced mechanical slides of allowing the user to add and subtract numbers of different amounts of digits (usually from 5 to 9).    Addimult produced sliders from the 1930s to the 1960s.

This summer, I found and purchased a Sumat 6 in antique shop in Manhattan Beach, California.  It was fortunate that the Sumat 6 came with a nice pouch, which was still intact and instructions.   It is a very classy machine which held up well for at least a 50 year old machine.

The Sumat 6 presented today has a six digit capacity.  The slider is made of metal and has two sides:

The Addition Side  (slider bar on top)

The Subtraction Side (slider bar on the bottom)

The Sumat 6, like all the mechanical slides produced at the time, has a metal stylus.  The stylus is used to push columns up and down in holes.  On top of each column has a circle that shows its value.  The markers in each column are either metallic silver or painted red.  For example, on the Addition side, a column that shows three red markers followed by seven silver markers gives the column a value of 3.   On the Subtraction side, a column that shows seven red markers followed by three silver markers shows a value of 3.

The value changes depending on what direction you push the slide:

Operation Slide Down Slide Up
Subtraction value decreases value increases

There are two additional markers, shown in red:  the up arrow and the down arrow.

Red Up Arrow ( ↑ ) : Push the next left column down 1.   Scroll the current column all the way up (0 on the Addition side, 9 on the Subtraction side)

Red Down Arrow ( ↓ ) : Push the column down one spot (to 0 on the Addition side, 9 on the Subtraction side)

Updating one column does not automatically update other columns, so you need to keep your addition and subtraction processes in your head as you are calculating.

Examples

Example 1:  425 + 784

Use the Addition side.   Set the sliders to 000425.

Start with the ones digit, which in this case is the right-most column.  Slide it down four notches.  So far, so good. Readout should have 000429.

Now the tens, slide the column down 8. Note that after 8 notches we hit the red up arrow.   Slide the hundred column down 1  and reset the tens column to 0.  You are done in the tens column since 8 notches are slid.  Readout should have 000509.

Finally the hundreds column, slide it down 7 notches.  Note after 5 notches, we hit the red up arrow again.   Time to slide the thousands column down 1 and reset the the hundreds column to 0.   We need to slide the hundreds column 2 more notches (5 of the 7 have been used).    The readout now has 001209.

The answer:  425 + 784 = 1209

Example 2:  1365 - 746

Use the Subtraction side.  Set the sliders to 001365.

In this problem the right-most column represent the ones digit.

Start with the ones digit and slide it down 6.  Note after six notches until the red up arrow is reached.   Slide the tens column down 1 and reset the ones column to 9.  Readout now should read 001359.

Now slide the tens column down 4.  Readout:  001319.

Now the hundreds, slide it down seven notches.  After four notches, the red up arrow is reached.   Slide down the thousands column and reset the hundreds column to 9.  We have three notches left, so slide the hundreds column down 3.  Readout:  000619.

We are done.

The answer:  1365 - 746 = 619

Sources

International Slide Rule Museum "Mechanical Slide & Rotary Adders" 2013-2018.  https://www.sliderulemuseum.com/Adders.htm   Retrieved September 5, 2020

Riches, David M.  "Addimult" Mathematical Instruments: A private collection.  August 2020.  http://www.mathsinstruments.me.uk/page25.html   Retrieved September 5, 2020.

Please visit or support the resources above!

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, September 19, 2020

### Casio fx-9750GIII: Beta Curve Fit

Casio fx-9750GIII:  Beta Curve Fit

The program BETAFIT will fit data to the curve

Y = A * x^B * (1-x)^C

Restrictions:  0 < x < 1 and y > 0

Derivation

General Equation:

Y = A * x^B * (1-x)^C

The equation can be transformed into a multilinear regression form by:

Y = A * x^B * (1-x)^C

ln Y = ln (A * x^B * (1-x)^C)

ln Y = ln A + ln (x^B) + ln (1-x)^C

ln Y = ln A + B * ln x + C * ln (1 - x)

y' = a' + b * x1 + c * x2

where:

y = ln Y

a = ln A,  A = e^a

x1 = ln x

x2 = ln(1 - x)

To find a Beta regression fit:

1.  Enter the x data.  Take two transformations:  ln x and ln(1 - x).   Recall 0 < x < 1.

2.  Enter the y data.  The the transformation ln y.  Recall y > 0.

3.  Execute multilinear regression: y' = a + b * x1 + c * x2.   See the notes above.

4.  Solve for the coefficients:

A = e^A

B = b

C = c

Matrix Setup:

X a = y

X Columns:  [ 1, ln x, ln(1 - x) ]

y Columns: [ ln y ]

Casio fx-9750GIII Program:  BETAFIT

Size: 300 Bytes

"2020-08-30 EWS"

"X DATA"? → List 1

"Y DATA"? → List 2

List 1 → List 3

Fill(1, List 3)

ln List 1 → List 4

ln (1 - List 1) → List 5

ln List 2 → List 6

List→Mat(List 3, List 4, List 5) → Mat B

List→Mat(List 6)→Mat C

(Trn Mat B × Mat B)^-1 × Trn Mat B × Mat C → Mat A

e^Mat A[1,1] → A

Mat A[2, 1] → B

Mat A[3, 1] → C

ClrText

Locate 1,3,"Y = A X^B (1-X)^C"

Locate 1,4,"A="

Locate 4,4,A

Locate 1,5,"B="

Locate 4,5,B

Locate 1,6,"C="

Locate 4,6,C

Examples

Graphs are not included in the program.

Example 1:

Data:

(0.1, 0.74)

(0.3, 0.7681)

(0.5, 0.55)

(0.7, 0.2779)

(0.9, 0.053)

A = 2.199360522

B = 0.3998640121

C = 1.599725605

Example 2:

Data:

(0.1, 0.015)

(0.3, 0.228)

(0.5, 1.24)

(0.7, 6.75)

(0.9, 100.44)

A = 1.261477517

B = 2.015236182

C = -1.992644053

Source:

Kolb, William M.  Curve Fitting For Programmable Calculators IMTEC.  Bowie, MD 20716.  1982.  ISBN-10:  0-943494-00-01

Stay safe and sane everyone.  Happy Birthday Press Your Luck (no whammies) Blessings,

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.

## Tuesday, September 15, 2020

### New TI-Nspire CX/CX II Update

New TI-Nspire CX/CX II Update

Texas Instruments offers a software update:  5.2.   New to version 5.2:  Python.

Both the handheld software and computer software have the new update.

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.

## Sunday, September 13, 2020

### Numworks: Generating a Colorful Matrix

Numworks:  Generating a Colorful Matrix

Introduction

Today's script generates a 3 x 3 matrix of random integers from 1 - 9 which each of the numbers are assigned a color.  The numbers are displayed in a 3 x 3 grid using the 320 x 240 pixel screen.

The colors which are assigned to each number are:

1:  Shamrock Green  (0, 158, 96)

2:  Denim Blue (21, 96, 189)

3:  Navy Blue (0, 0, 128)

4:  Indigo (75, 0, 130)

5:  Red (255, 0, 0)

6:  Rose (255, 0, 127)

7:  Brown (101, 67, 33)

8:  Orange (255, 127, 39)

9:  Gold (255, 223, 0)

Numworks Python Script:  colormtx.py

from math import *

from random import *

from kandinsky import *

# 2020-08-25 EWS

# color arrays

# red

mr = [ 0, 21, 0, 75, 255, 255, 101, 255, 255 ]

# green

mg = [ 158, 96, 0, 0, 0, 0, 67, 127, 223 ]

# blue

mb = [ 96, 189, 128, 130, 0, 127, 33, 39, 0 ]

# set up matrix

mat = [ [ 0, 0, 0 ], [ 0, 0, 0 ], [ 0, 0, 0 ] ]

# generate random numbers, assign colors

for r in range(3):

for c in range(3):

mat[ r ][ c ] = randint(1,9)

x = 80 + 80 * c

y = 60 + 60 * r

s = mat[ r ][ c ]

draw_string(str(s), x, y, color(mr[s-1], mg[s-1], mb[s-1])

Remember that the index of arrays and matrices go from 0 to n-1.

Examples

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, September 12, 2020

### Casio fx-9750GIII: Happy Integers

Casio fx-9750GIII: Happy Integers

What Makes an Integer Happy?

1.  Take a positive integer

2.  Take the sum of the squares of its integers

3.  Repeat the process until:

a.   You repeat a previous result or

b.   You obtain a sum of 1.

In the cases that you eventually reach 1, that number is defined as a happy integer.

23:

2^2 + 3^2 = 13

1^2 + 3^2 = 10

1^2 + 0^2 = 1

23 is a happy integer.

24:

2^2 + 2^2 = 4

4^2 = 16

1^2 + 6^2 = 37

3^2 + 7^2 = 58

5^2 + 8^2 = 89

8^2 + 9^2 = 145

1^2 + 4^2 + 5^2 = 42

4^2 + 2^2 = 20

2^2 + 0^2 = 4    (see first addition - repeat)

24 is not a happy integer.

The sequence of sums of squares of the integer's digits is known as a cherry sequence.

Casio fx-9750GIII: HAPPY

(316 bytes)

"2020-08-20 EWS"

"N>0, INTEGER: N"? → N

{ 0 } → List 1

Intg log N → D

N ÷ 10^D → W

Lbl 3

0 → T

For 0 → I To D

T + (Intg W)^2 → T

(W - Intg W) × 10 → W

Next

Augment(List 1, { T }) → List 1

ClrText

Locate 1, 4, T

For 1 → I To 100

Next

T = 1 ⇒ Goto 1

For 1 → I To Dim List 1 - 1

T = List 1[ I ] ⇒ Goto 2

Next

T → W

Intg log W → D

W ÷ 10^D → W

Goto 3

Lbl 1

ClrText

Locate 1, 3, W

Locate 1, 4,"IS A HAPPY INTEGER"

Stop

Lbl 2

Locate 1, 3, N

Locate 1, 4, "NOT A HAPPY INTEGER"

Stop

Notes:

(1)  10^ is shown as a subscript 10 on the calculator.

(2)  The program sequence

ClrText

Locate 1, 4, T

For 1 → I To 100

Next

creates a timer.  This allows the calculator to show intermediate results for a short time.

(3)  Intermediate sums of squares are stored in List 1.  Other than the first 0 (an element is required to start a list in Casio programming), the rest of the sequence is known as Cheery Sequence.

Examples

N = 19;  Happy Number

N = 77; Not a Happy Number

N = 230; Happy Number

N = 562; Not a Happy Number

Sources:

Duncan, Donald C.  Happy Integers.  The Mathematics Teacher, Vol 65. No. 7  November 1972, pp. 627-629  https://www.jstor.org/stable/27959021

Happy Number.  GeeksforGreeks.  https://www.geeksforgreeks.org/happy-number  Updated February 4, 2020.  Accessed August 19, 2020.  (website under maintenance)

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.

## Sunday, September 6, 2020

### Retro Review: Sharp EL-512 Scientific Calculator

Retro Review: Sharp EL-512 Scientific Calculator

Just The Facts:

Model:  EL-512
Company: Sharp
Type:  Keystroke Programmable
Display:  10 digits, 8 digits with 2 digit exponents
Battery:  Battery: 2 x LR 44
Logic: AOS
Memory Registers: 10; 9 with an M registers.
Programming Memory: 128 steps

Years:  1984-1987

Basic Information:

The manual can be found here:

Features

* Trigonometric, Hyperbolic, Logarithmic, and Exponential Functions
* Constant Arithmetic
* Automatic Multiplication
* Convert to Degrees-Minutes-Seconds
* Linear Regression

Constant Arithmetic

Pressing the equals key after a completed arithmetic operation will put the EL-512 into automatic arithmetic mode. This works only for addition, subtraction, and multiplication.

Keystrokes Interpretation Examples
A [ + ] B [ = ]
C [ = ]
D [ = ]
A + B
C + B
D + B
150 [ + ] 80 [ = ] 230
76 [ = ] 156
52 [+/-] [ = ] 28
A [ - ] B [ = ]
C [ = ]
D [ = ]
A - B
C - B
D - B
150 [ - ] 80 [ = ] 70
76 [ = ] -4
52 [+/-] [ = ] -132
A [ × ] B [ = ]
C [ = ]
D [ = ]
A × B
C × B
D × B
20 [ × ] 4 [ = ] 80
5 [ = ] 100
0.25 [ = ] 5

Automatic Multiplication

Automatic (implied) multiplication occur in several areas:

The Famous A / BC Problem:

A [ ÷ ] B [ ( ] C [ ) ] [ = ]   returns A / (B * C)
Example:  9 [ ÷ ] 3 [ ( ] 2 [ ) ] [ = ]  returns 1.5

A [ ÷ ] B [ × ] C [ = ]   returns A / B * C
Example:  9 [ ÷ ] 3 [ × ] 2 [ = ] returns 6
.
Multiply by π:

A [ π ] returns A * π automatically.
Example:  5 [ π ] returns 15.70796327

Implied Multiplication with Stored Numbers

With a stored number in a number register Kn:
A [ Kn ] returns A * Kn automatically
Example:  11.5 [ 2ndF ] (STO) 1;   5 [ Kn ] 1 returns 57.5

This is a very neat shortcut in keystroke programming.

The sequence [ 2ndF ] ( →HEX ) converts the number to hexadecimal form and changes the EL-512 to Hexadecimal mode.  Enter the digits A - F, by pressing [ 2ndF ] [ 0 ], [ 2ndF ] [ 1 ], etc.   I like the placement of A - F since A = 10, B = 11, etc.   Pressing the equals key returns the EL-512 to Decimal mode.

Unfortunately no Boolean functions are offered.

Linear Regression

The memory keys act as data point entry.  In this mode, the multiplication key is used to indicate frequency.  The linear regression line is y = a + bx, where a is the intercept and b is the slope.

Programming

The programming model for the EL-512 is algebraic keystroke, which the manual refers to as Multiple Formula Reserve.  Programs are entered "blindly" so make sure that you have the program written down before entering it.

You will also need to enter the program as a test case.

The program space is 128 steps between 4 program spaces.  Every time a new program is entered, the old program in that slot is automatically cleared.  The LRN indicator shows that the EL-512 is in learn mode.

[ x ]:  Asks the user to enter number.  Prompt numbers start with 1 and increases by 1.  This does not affect any storage registers.  Numbers entered after the [ x ] during program do not count as steps.   In run mode, enter the number, then press [ COMP ].

[ 2ndF ] (LOOK):  This allows the program to temporarily stop to show the displayed value.  Continue the program in run mode by pressing [COMP].

[ 1: ], [ 2: ], [ 2ndF ] ( 3: ), [ 2ndF ] ( 4: ):  In run mode, these keys and key sequences runs the program slot.

There are no loops, integer, fraction, sign functions, or comparisons. Hence this model's programming is strictly for formulas only.

Sharp EL-512 Program:  Rating Microphones in dBm

dBm = 10 log ( (E^2) / (0.001 * Z)) - 6

E:  voltage, prompt [ 1 ]
Z:  resistance (ohms), prompt [ 2 ]

Program:

[ x ]
(enter E)
x^2
÷
0.001
÷
[ x ]
(enter Z)
=
log
×
10
-
=

Examples:

E = 40, Z = 80, Result:  37.01029996
E = 70, Z = 100, Result:  40.9019608

Source:
Davis, Don and Davis, Carolyn.  Sound System Engineering.  Howard W. Sams & Co. Inc:  Indianapolis.  1975  ISBN-10:  0-672-21156-4

Sharp EL-512 Program:  Heron's Formula

Area = √(S * (S - A) * (S - B) * (S - C)) where S = (A + B + C) / 2

A:  length of side A, prompt [ 1 ]
B:  length of side B, prompt [ 2 ]
C:  length of side C, prompt [ 3 ]

Program:

[ x ]
(enter A)
STO 1
+
[ x ]
(enter B)
STO 2
+
[ x ]
(enter C)
STO 3
=
÷
2
=
STO 4
×
Kn 4
Kn 1
)
×
(
Kn 4
-
Kn 2
×
(
Kn 4
-
Kn 3
=

Examples:
A = 15.6, B = 13.8 , C = 14.8;  Area: 93.29390923
A = 48, B = 42, C = 57; Area:  986.9860371

Verdict

I think the most unique feature to the EL-512 is the implied multiplication.   I wish the programming functions had integer and fraction functions and even some comparisons.  The calculator is small and compact and fits very nicely in the wallet.   The keys, even though they are small to me, are nice and responsive.

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, September 5, 2020

### Casio fx-9750GIII: Combination Matrices

Casio fx-9750GIII:  Combination Matrices

Introduction

The program COMBMTRX creates an aligned combination triangle with rows 0 to W-1 and columns 0 to W-1.  The matrix is a square matrix with size W x W.

1.  Pascal

n NCR k

2.  Catalan

(n - k + 1) / (n + 1) * [ n+k NCR n ]

3.  Borel

1 / (n + 1) * [ 2n+2 NCR n-k ] * [ n+k NCR n ]

4.  User Function

f(n, k,  h(n,k) NCR g(n,k))

"Blank" spaces will be filled with 0.

Casio fx-9750GIII Program:  COMBMTRX

(320 bytes)

Note:  On the program screen, nCr will be symbolized as a bold C

"2020-08-11 EWS"

"COMBINATION MATRIX"

"SIZE"? → W

Identity W → Mat A

Lbl 1

"(N)nCr(K)" → fn1

Goto 5

Lbl 2

"(N-K+1)÷(N+1)×(N+K)nCr(N)" → fn1

Goto 5

Lbl 3

"1÷(N+1)×(2N+2)nCr(N-K)×(N+K)nCr(N)" → fn1

Goto 5

Lbl 4

"F(N,K)"? → fn1

Goto 5

Lbl 5

For 1 → I To W

For 1 → J To I

I-1 → N

J-1 → K

fn1 → Mat A[I,J]

Next

Next

Mat A

Examples

Size: 5

Option 1:  Pascal

[[ 1 0 0 0 0 ]

[ 1 1 0 0 0 ]

[ 1 2 1 0 0 ]

[ 1 3 3 1 0 ]

[ 1 4 6 4 1 ]]

Option 2:  Catalan

[[ 1 0 0 0 0 ]

[ 1 1 0 0 0 ]

[ 1 2 2 0 0 ]

[ 1 3 5 5 0 ]

[ 1 4 9 14 14 ]]

Option 3:  Borel

[[ 1 0 0 0 0 ]

[ 2 1 0 0 0 ]

[ 5 6 2 0 0 ]

[ 14 28 20 5 0 ]

[ 42 120 135 70 14 ]]

Option 4:  User

f = (N+K+1)nCr(K) ÷ (N=1)

(in fraction form)

[[ 1 0 0 0 0 ]

[ 1/2 3/2 0 0 0 ]

[ 1/3 4/3 10/3 0 0 ]

[ 1/4 5/4 15/4 35/4 0 ]

[ 1/5 6/5 21/5 56/5 126/5 ]]

Source:

Cai, Yue and Yan, Catherine.  "Coutning with Borel's Triangle"  Elsevier B.V. Discrete Mathematics.   November 15, 2018  https://arxiv.org/pdf/1804.01597.pdf

Retrieved August 9, 2020

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.

## Sunday, August 30, 2020

### Numworks: Quadratic Equation and Newton's Method - Do Guesses Matter?

Numworks: Quadratic Equation and Newton's Method - Do Guesses Matter?

Introduction

Let A, B, C, be positive, non-zero coefficients of the quadratic equation:

Ax^2 + Bx - C = 0 with A > 0, B > 0, C > 0

First, start with an initial guess x0 = 0.  Count how many iterations it takes for the method to reach a suitable answer.   For this experiment, we will use a tolerance of 8 decimal places (tol = 1E-8), setting a maximum of 200 iterations.

Consider a "reduced" equation to obtain guesses for the original equation:

Ax^2 - C = 0

Hence, our initial guesses are x0 = √(C/A) and x0 = -√(C/A)

Using Newton's Method to determine the roots with a guess of x0:

x_n+1 = x_n - [Ax^2 + Bx - C]/[2Ax + B]

So which of the following guesses gets us to a solution faster?

x0 = 0

x0 = √(C/A)

x0 = -√(C/A)

The Python script below tests the question.

Python Test Script:  guesttest.py

from math import *

def testf(a,b,c,w0):

n=1

w1=1

while abs(w1)>1e-8

w1=(a*w0**2+b*w0-c)/(2*a*w0+b)

w0=w0-w1

n=n+1

if n==201:

print('Exceeded iterations')

break

print('Root: '+str(w0)

print('Iterations: '+str(n))

return

# EWS 2020-08-10

print("y=ax**2+bx-c=0")

print("a>0,b>0,c>0")

a=float(input('a? '))

b=float(input('b? '))

c=float(input('c? '))

# initial conditions

x1=0

x2=sqrt(c/a)

x3=-sqrt(c/a)

# results

print('x1: '+str(x1))

testf(a,b,c,x1)

print('----')

print('x2: '+str(x2))

testf(a,b,c,x2)

print('----')

print('x3: '+str(x3))

testf(a,b,c,x3)

print('----')

Results

Test Results - Iterations Used to get to a Solution

Ax^2 + Bx - C = 0 with A > 0, B > 0, C > 0

A B C x0 = 0 x0 = √(C/A) x0 =-√(C/A)
1 1 4 6 6 8
1 4 4 6 6 error reached
1 5 4 6 6 9
1 5 6 6 6 12
2 5 6 6 6 8
3 5 6 7 6 7
8 13 81 8 6 6
16 13 81 8 5 6
32 13 81 9 5 5
64 13 81 9 5 5
1 40 10 5 6 6
1 40 25 5 6 6
1 40 40 5 6 7
1 40 55 6 6 8
10 18 42 7 6 7
10 18 52 7 6 6
10 18 62 7 6 6
10 18 72 7 6 6

From the data presented, I think it is inconclusive of whether which guess generally makes for getting to the solution faster.   What do you find?

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, August 29, 2020

### Radio Shack EC-4019: Catalan and Borel Triangles

Radio Shack EC-4019:   Catalan and Borel Triangles

Introduction:   Catalan and Borel Triangles

Catalan numbers counts a number of lattice paths, straight lines with segment of length 1, in the Cartesian plane from the origin (0,0) to the point (n,k).  There path does not go above the line y = x.

Entries in Borel's Triangle depend on the entries of Catalan's Triangle.  There are various interpretations of how counting relate to Borel's triangle, including counting the number of Dyck path of semi-length n+1, counting path in leaf-market binary trees, and set of binary trees with n+1 vertices with k marked vertices with no markings on the tree's right spine.  Please see the source below for more details.

Formula Derivation

You can find any entry in Catalan's triangle by the formula:

C = (n - k + 1) / (n + 1) * COMB(n + k, n)

where:

1.  k ≤ n, I do believe that k and n need to be integers, and

2.  COMB is the nCr, combination function, where for any x and y:

COMB(x, y) = x! / ( y! * (x - y)! )

We can simplify the formula for Catalan's triangle by:

= (n - k + 1) / (n + 1) * COMB(n + k, n)

= (n - k + 1) / (n + 1) * (n + k)! / (n! * (n + k - n)!)

= (n - k + 1) / (n + 1) * (n + k)! / (n! * k!)

= (n - k + 1) / (n + 1) * (n + k)! /n! * 1/k!

Since (n + 1) * n! = (n + 1) * n * (n - 1) * (n - 2) * ... = (n + 1)!

= (n - k + 1) * (n + k)! / ((n + 1)! * (n - k)!)

Observe that

C / (n-k+1) = (n + k)! / ((n + 1)! * (n - k)!)

Similarly, you can find any entry in Borel's triangle by the formula:

= 1 / (n + 1) * COMB(2n + 2, n - k) * COMB(n + k, n)

= 1/ (n + 1) * (2n + 2)! / ((n - k)! * (n + 2 + k)!) * (n + k)!/(n! * k!)

= (2n + 2)! / ((n - k)! * (n + 2 + k)!) * (n + k)!/((n+1)! * k!)

= (2n + 2)! / ((n - k)! * (n + k + 2)!) * Ca

Radio Shack EC-4019 Programs:  Catalan and Borel Triangle Numbers

To run the program:

1.  Store k in memory register 1.  Keystrokes:  k [ Kin ]  [ 1 ]

2.  Store n in memory register 2.  Keystrokes:  n [ Kin ] [ 2 ]

3.  To find the Catalan Triangle, run program I.

4.  To find the Borel triangle number, run program I, then immediately run program II.  Program II depends on the result of program I.

Make sure that k ≤ n, as the programs assume that your inputs are valid.

Program I:  Catalan Triangle Number

(25 steps)

(small x:  multiply key,  slash: divide key)

[(---

Kout 2

-

Kout 1

+

---)]

[(---

Kout 2

+

Kout 1

---)]

x!

/

[(---

Kout 2

+

1

---)]

x!

/

Kout 1

x!

=

Program II: Borel Triangle Number

(28 steps)

(small x:  multiply key,  slash: divide key)

x

[(---

2

Kout 2

+

2

---)]

x!

/

[(

Kout 2

-

Kout 1

+

1

)]

x!

/

[(

Kout 1

+

Kout 2

+

2

---)]

x!

=

Examples

k = 2,  n = 6,  Catalan (I):  20,  Borel (II): 4004

k = 3, n = 5,  Catalan (I): 28, Borel (II): 616

k = 4, n = 4,  Catalan (I): 14, Borel (II): 14

Source:

Cai, Yue and Yan, Catherine.  "Coutning with Borel's Triangle"  Elsevier B.V. Discrete Mathematics.   November 15, 2018

Retrieved August 9, 2020

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.

### HP 42S/DM42: Height of a Fire, Time to Clear a Corridor

HP 42S/DM42:  Height of a Fire, Time to Clear a Corridor HP 42S/DM42/Free42 Program:  FIREHGT The program FHGT approximates the height of a...