Sunday, October 17, 2021

Σ(1 / (a^n)) from n=1 to m

 Σ(1 / (a^n)) from n=1 to m


This blog entry covers the sum of the series:


Σ[1 / (a^n), n=1 to m] with n and m positive integers


Specific Cases:  a = 2 and a = 3


When a = 2:


m = 1:   1/2


m = 2:   1/2 + 1/4  = (2 + 1)/4 = 3/4


m = 3:   1/2 + 1/4 + 1/8 = (4 + 2 + 1)/8 = 7/8


m = 4:   1/2 + 1/4 + 1/8 + 1/16 = (8 + 4 + 2 + 1)/16 = 15/16


Going from the pattern,


Σ[1 / (2^n), n=1 to m] = 1/(2^m) * Σ[(2^n), n=0 to m-1] = (2^m - 1) / 2^m 


When a = 3:


m = 1:  1/3


m = 2:  1/3 + 1/9  = (3 + 1)/9 = 4/9


m = 3:  1/3 + 1/9 + 1/27 = (9 + 3 + 1)/27 = 13/27


m = 4:  1/3 + 1/9 + 1/27 + 1/81 = (27 + 9 + 3 + 1)/81 = 40/81


Going from the pattern,


Σ[1 / (3^n), n=1 to m] = 1/(3^m) * Σ[(3^n), n=0 to m-1]



Finding the General Formula and Proof


Let's presume that, for any a:


Σ[1 / (a^n), n=1 to m-1] = 1/(a^(m-1) * Σ[(a^n), n=0 to m-2]


Let's add 1/(a^m) to the series:  


Σ[1 / (a^n), n=1 to m-1]  + 1/(a^m)


= (1 + a + a^2 + ... + a^(m-3) + a^(m-2)) / (a^(m-1)) + 1 / (a^m)


= (a * (1 + a + a^2 + ... + a^(m-3) + a^(m-2)) + 1) / (a^m)


= (a + a^2 + a^3 + ... + a^(m-2) + a^(m-1) + 1) / (a^m)


= 1/(a^(m)) * Σ[(a^n), n=0 to m-1]



The general formula is now: 


Σ[1 / (a^n), n=1 to m] = 1/(a^(m)) * Σ[(a^n), n=0 to m-1]


Until next time,


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, October 16, 2021

Swiss Micros DM41X: Applications

Swiss Micros DM41X: Applications





Swiss Micros DM41X Program:  Euclid Algorithm


Registers:

R01:  A

R02: B

R03:  C  (used)


Finds the GCD of A and B, where A and B are positive integers and A > B.


01 LBL^T EUCLID

02 ^T GCD A>B

03 AVIEW

04 PSE

05 ^T A?

06 PROMPT

07 STO 01

08 ^T B?

09 PROMPT

10 STO 02

11 LBL 00

12 RCL 01

13 ENTER

14 ENTER

15 RCL 02

16 /

17 LASTX

18 X<>Y

19 INT

20 *

21 - 

22 STO 03

23 X=0?

24 GTO 01

25 RCL 02

26 STO 01

27 X<>Y

28 STO 02

29 GTO 00

30 LBL 01

31 ^T GCD=

32 ARCL 02

33 AVIEW

34 END


Examples:


A = 100, B = 20, GCD = 20

A = 78, B =24, GCD = 6


Swiss Micros DM41X Program: Fan Laws 


The program will calculate RPM_new (Revolutions per Minute), SP_new (Static Pressure), and BHP_new (Brake Horsepower).  


Inputs:

CFM_old:  Cubic Feet of Minute - old

CFM_new:  Cubic Feet of Minute - new

RPM_old:  Revolutions per Minute - old

SP_old:  Static Pressure - old

BHP_old:  Brake Horsepower - old


Outputs:

RPM_new

SP_new

BHP_new


01 LBL^T FANLAWS

02 CLA

03 ^T CFM.OLD?

04 PROMPT

05 STO 01

06 ^T CFM.NEW?

07 PROMPT

08 STO 02

09 X<>Y

10 /

11 STO 04

12 STO 06

13 ST* 06

14 STO 08

15 ST* 08

16 ST* 08

17 ^T RPM.OLD?

18 PROMPT

19 STO 03

20 ST* 04

21 ^T SP.OLD

22 PROMPT

23 STO 05

24 ST* 06

25 ^T BHP.OLD?

26 PROMPT

27 STO 07

28 ST* 08

29 ^T RPM.NEW=

30 ARCL 04

31 AVIEW

32 STOP

33 ^T SP.NEW=

34 ARCL 06

35 AVIEW

36 STOP

37 ^T BHP.NEW=

38 ARCL 08

39 AVIEW

40 END


Variables:


R01 = CFM.OLD

R02 = CFM.NEW

R03 = RPM.OLD

R04 = RPM.NEW

R05 = SP.OLD

R06 = SP.NEW

R07 = BHP.OLD

R08 = BHP.NEW


The program uses a lot of storage arithmetic.  


Example


Inputs:

CFM.OLD:  1250 CFM

CFM.NEW: 1600 CFM

RPM.OLD:  840 RPM

SP.OLD: 4 in

BHP.OLD: 7 BHP


Results:

RPM.NEW: 1075.2 RPM

SP.NEW: 6.5536 in

BHP.OLD:  14.680064 BHP


Source:

Calculated Industries "Sheet Metal/HVAC Pro Calc User's Guide" 2021


Swiss Micros DM41X Program: Johnson-Nyquist Noise Analysis


Equations Used:


Power (in Watts):


P = kb * T * Δf


RMS Voltage (in Volts):


v_n = √(4 * R * kb * T * Δf) = √(4 * R * P)


Current (in Amps):


i_n = √((4 * T * kb * Δf / R) = v_n / R


Inputs:


T = temperature in Kelvin  (°C + 273.15)

Δf = bandwidth, difference of frequencies in Hz

R = resistance in ohms (Ω)


Constants:  Boltzmann's Constant

kb ≈ 1.380649 * 10^-23 J/K


Program:


01 LBL^T NOISE

02 ^T TEMP? <K>

03 PROMPT

04 ^T BANDWIDTH?

05 PROMPT

06 *

07 1.308649E-23

08 *

09 ^T POW=

10 ARCL X

11 AVIEW

12 STOP

13 ^T R?

14 PROMPT

15 *

16 LASTX

17 X<>Y

18 4

19 *

20 SQRT

21 ^T V=

22 ARCL X

23 AVIEW

24 STOP

25 X<>Y

26 /

27 ^T I=

28 ARCL X

29 AVIEW

30 END


Example:


Temperature:  299.68 K

Bandwidth:  10,500 Hz

Resistance:  1375 Ω


Results:


Power:  4.3444E-17 W

Volts:  4.8882E-7 V

Current:  3.5550E-10 A


"Johnson-Nyquist Noise" Wikipedia.  Retrieved February 15, 2015 https://en.wikipedia.org/wiki/Johnson%E2%80%93Nyquist_noise




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, October 11, 2021

Comparison Between HP 17B and 17BII+

 Comparison Between HP 17B and 17BII+


This is a quick comparison between the original HP 17B and the current (since 2007) silver HP 17BII+ calculators. I hope the 17BII+ is still being produced and sold, it has been quite a while since an update to the 17BII+.  


The main features of the 17B family have remained constant since the original 17B came to the markets in early 1988:


*  Time Value of Money with Amortization

*  Business Calculations including Percent Change, Cost/Sell/Margin/Markup

*  Four Regression Models:  Linear, Logarithm, Power, Exponential

*  Bond Calculations

*  Depreciation including Straight Line, Sum of the Year's Digits, and Accelerated Cost Recovery

*  Days Between Dates, 10 Alarms, Clock

*  10 Memory Registers with Storage Arithmetic

*  Can use the HP 82240 Infrared Printer (82240A/82240B); even though they are well out of production by now


HP 17B

HP 17BII+

HP 17B Mode Menu

HP 17BII+ Mode Menu

Now for the differences:


HP 17B:  (1988)

*   Available Memory:  6,752 bytes

*   Batteries:  3 x LR 44

*   Case Colors:   Brown, Peach-Orange shift key and text

*   Shift functions are printed above the keys


HP 17BII+:  (2007 - present)

*   Available Memory:  about 31,000 bytes

*   Batteries:  2 x CR2032

*   Case Colors:  Silver, Electric Blue shift key and text

*   Shift functions are printed below the function

*   Double line print option  

*   Currency conversion mode

*   RPN mode (this was added to the HP 17BII in 1990)


I did a quick speed test on the equation:


Σ(I:1:525:1:I)  (Result:  138,075)


The original HP 17B won the speed test.


HP 17B Solver

HP 17BII+ Solver


That is about it.   I love the 17B series, which has a rich set of financial functions and a robust solver that includes ore functions that most calculators have.  (including integer part, fractional part, signum, solve if, Σ, date functions, and yes, the Let and Get functions!)

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

n = a^m + b

 n = a^m + b



Calculators:  Swiss Micros DM41X, HP-32S/32SII, Casio fx-9750 GIII


n = a^2 + b


The following program breaks down a positive integer n into n = a^2 + b, where a is √n rounded to the nearest integer in attempt to minimize abs(b).    


Examples:

  

800 = 28^2 + 16

662 = 26^2 - 14

525 = 23^2 - 4


This technique is useful, especially with the HP 32S and HP 32SII.  Normally, real numbers take up 9.5 bytes of memory on the HP 32S series.  Integers 0 - 100 only consume 1.5 bytes of memory for the original HP 32S and the range is extended to 0 - 254 for the HP 32SII.  


When the program terminates, b is on the X stack while a is on the Y stack.  


HP 41C/Swiss Micros DM41X Program:  SQPLUS


01 LBL^T SQPLUS

02 FIX 0

03 ENTER 

04 SQRT

05 RND

06 X^2

07 -

08 LASTX

09 SQRT

10 X<>Y

11 FIX 4

12 RTN


HP 32S and HP 32SII Program: SQPLUS


S01 LBL S

S02 FIX 0

S03 ENTER

S04 SQRT

S05 RND

S06 x^2

S07 -

S08 LASTx

S09 SQRT

S10 x<>y

S11 ALL

S12 RTN


Example:  684


Result:

Y:  26

X:  8 

(26^2 + 8 = 684)


Additional Powers


Now let's extend the problem to include higher powers.  


n = a^m + b


We can estimate a by:


n ≈ a^m

ln n ≈ ln(a^m)

ln n ≈ m * ln a

ln n / m ≈ ln a


a ≈ e^(ln n / m)


Round a to the nearest integer.  Use this a to find b.


n = a^m + b


b = n - a^m


The script brkpower.py (225 bytes) calculates a and b for powers m = 2 to 6.  This script was created on the Casio fx-9750GIII.


Casio fx-9750GIII Micro python Script:  brkpower.py


# 2021-07-17 ews

from math import *

print("n = a**m + b")

n=float(input("n? "))

m=2.0

while m<7:

  a=int(exp(log(n)/m)+.5)

  b=n-a**m

  s="{:.0f} = {:.0f}**{:.0f} + {:.of}".format(n,a,m,b)

  print(s)

  m+=1


Example:  n = 860


Results:

860 = 29**2 + 19         (860 = 29^2 + 19) 

860 = 10**3 + -140     (860 = 10^3 - 140, and so on)

860 = 5**4 + 235

860 = 4**5 + -164

860 = 3**6 + 131


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, October 9, 2021

Swiss Micros DM41X and HP Prime: Rounding Numbers to One Significant Digit

Swiss Micros DM41X and HP Prime:  Rounding Numbers to One Significant Digit





Introduction


This blog entry deals with rounding numbers to one significant digit, that is the first non-zero numbers.  The general 5/4 rounding rules are used:  round up if you are next digit is 5 or more.  


Examples:  


72.28 rounds to 70


78.28 rounds to 80


0.0283 rounds to 0.03


Rob Eastaway, author of Maths On the Back of an Envelope (see source below), introduces the concept of Zequals.  Zequals is the practice of rounding numbers to one significant digit, with it's symbol similar to the symbol for the constellation Aquarius the Water Bearer ( ♒ ).  The aim for rounding numbers to one significant digit is to aid in estimating arithmetic operations and make mental mathematics easier.   


Is it always spot on?


The program RONE (Round to ONE Significant Digit) rounds positive, non-zero numbers to one significant digit.   An algorithm to do so may look like this:


Number:  x

a = log(x)

If a≥0, then a=int(a)

If a<0, then a=int(a)-1

n = int(x / (10^a) + 1/2) * 10^a


We can also use:

n = round(x / (10^a),0) * 10^a



I have included the HP Prime PPL code for RONE.  RONEARITH for the HP Prime compares the actual versus rounded calculation for the four arithmetic functions.





Swiss Micros DM41X Program:  RONE


01 LBL^T ZONE

02 CF 01

03 ENTER

04 LOG

05 X<0?

06 SF 01

07 INT

08 FS? 01

09 - 

10 FS? 01

11 -

12 10^X

13 /

14 LASTX

15 X<>Y

16 2

17 1/X

18 + 

19 INT

20 *

21 CF 01

22 RTN

23 END


Examples:  


52.4564 XEQ RONE returns 50.0000


0.06834 XEQ RONE returns 0.0700

 

HP Prime Program:  RONE


EXPORT RONE(n)

BEGIN

// Round to one significant digit

LOCAL a;

a:=LOG(n);

IF a<0 THEN

a:=IP(a)-1;

ELSE

a:=IP(a);

END;

RETURN ROUND(n/ALOG(a),0)*ALOG(a);

END;


HP Prime Program:  RONEARITH


EXPORT RONEARITH()

BEGIN

// 2021-07-26 EWS

// Input form

LOCAL c,x,y,r,t,l;

l:={"+","-",CHAR(#D7h),CHAR(#F7h)};

INPUT({x,y,{c,l}},

"1 Sig Digit Arithmetic",

{"x: ","y: ","OP: "},

{"x>0","y>0","Arithmetic Operation"});


 PRINT();


IF c==1 THEN

PRINT(STRING(x)+"+"+STRING(y));

r:=ZR(x)+ZR(y);

t:=x+y;

END;


IF c==2 THEN

PRINT(STRING(x)+"-"+STRING(y));

r:=ZR(x)-ZR(y);

t:=x-y;

END;


IF c==3 THEN

PRINT(STRING(x)+CHAR(#D7h)+STRING(y));

r:=ZR(x)*ZR(y);

t:=x*y;

END;


IF c==4 THEN

PRINT(STRING(x)+CHAR(#F7h)+STRING(y));

r:=ZR(x)/ZR(y);

t:=x/y;

END;  


PRINT("Estimate: "+STRING(r));

PRINT("Actual: "+STRING(t));    

   

END;


ZR(n)

BEGIN

// Round to one significant digit

LOCAL a;

a:=LOG(n);

IF a<0 THEN

a:=IP(a)-1;

ELSE

a:=IP(a);

END;

RETURN ROUND(n/ALOG(a),0)*ALOG(a);

END;



Source:


Eastaway, Rob.   Maths On the Back of an Envelope  HarperCollins Publishers:  Dublin, Ireland  3rd Ed.  2021.  ISBN 978-0-00-844449-5


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. 


Friday, October 8, 2021

My Favorite Math YouTube Channels, Podcasts and Blogs

My Favorite Math YouTube Channels, Podcasts and Blogs


Time for some shout outs!  


YouTube Channels:


hpcalc.org.   This channel has talks regarding calculators and has videos of the HHC conference of recent years, including HHC 2021 which took place on October 2 and 3, 2021.

https://www.youtube.com/c/hpcalc


blackredpen.  A channel dedicated to calculus and higher level mathematics topics. The author (his name is not listed as of today)  emphasizes fun and humor in the videos, as well as how to solve seemingly difficult integrals and mathematical problems.

https://www.youtube.com/c/blackpenredpen/featured


Dr. Trefor Bazett.  Dr. Bazett is an Assistant Teaching Professor at the University of Victoria, Canada.  His channel covers statistics, game theory, logic, calculus of all levels, physics, and more.  Bazett has playlists covering courses in calculus and differential equations.   

https://www.youtube.com/c/DrTreforBazett


Calculator Culture.   This channel reviews modern and vintage calculators of all brands: Sharp, Hewlett Packard, Casio, Texas Instruments, Swiss Micros. This channel is relatively a young channel, about a year old.  I credit this channel for inspiring me to purchase a Casio fx-7500g. 

https://www.youtube.com/c/CalculatorCulture


Podcasts:

Math & Physics Podcast.  A treat for both the ears.  The Math & Physics Podcast is hosted by Parker Levesque and Rayhan Walia (Ray), two students from the University of Toronto.  Recently they started to post live podcast episodes on their YouTube Channel.  I primarily listen to their podcast through Apple podcast, they are also on Spotify.


Website:

https://mathandphysics.podbean.com/

YouTube Channel:

https://www.youtube.com/c/MathPhysicsPodcast


Blogs:


Fractal Kitty.  Mathematics meets Creativity, Birds, and Coding. 

https://fractalkitty.com/


1729.  A blog about calculus, integrals, derivatives, complex analysis, and differential equations.

https://www.1729.live/


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. 


HHC 2021 Conference Videos and HP 82204B Infrared Printer

HHC 2021 Conference Videos and HP 82204B Infrared Printer


HHC 2021 Conference


The HHC 2021 Conference took place in Nashville, TN on October 2 and 3, 2021.  It is the first in-person U.S. HP Calculator calculator conference since the pandemic.   Videos of each of the talks are posted, special thanks to hpcalc.org and Eric Rechlin.   


My gratitude always for all you do, Eric and HHC.   


View the HHC 2021 Playlist here:  


https://www.youtube.com/playlist?list=PLm3uGMWM_GJY7Jo8aU47X6DJnitsEZsfy


Topics include:

*  Calculator Bibliography Update - Felix Gross

*  Calculator Challenge - Bob Prosperi

*  What's on the HHC USB Drive - Eric Rechlin.  You can order USB drive from the hpcalc.org site:  https://commerce.hpcalc.org/.  Please allow a couple of weeks due to demand.

*  Computing Logarithms by Integration - Richard Schwartz

*  HP 9808A/B Unicorn - The Product that Almost Was - Chuck McCord

*  Starting a Fire - Richard Schwartz

*  What's New in the PPC Archive Version 2.39 - Jake Schwartz

*  Techniques for Digitally Preserving Technical Manuals and Other books - Eric Rechlin

*  Calculator Ad Price Analysis - Gene Wright

*  Lines and Graphs - Gene Wright

*  Diagnosing Problems with the HP-19C with Focus on the Printer - Jim Johnson

*  Remembering Thomas M. Whitney - Jim Johnson (R.I.P. Mr. Whitney  - condolences and comfort to the Whitney family) 

*  CC41 A Touch Typist's Calculator - Craig Bladow  (RPN emulator)  

*  Something About Keyboards - David Ramsey

*  Make Your Own Slide Rule - Richard Schwartz

*  What We Started - Richard Nelson

*  6502 Calculator Projects - Joey Shepard

*  History of Floating Point Processors - Eric Smith

*  Accuracy Comparisons, 7 Methods & 30 Programs - Richard Nelson

*  Another Perspective of the Scanning Projects - Content - Bob Prosperi

*  Award Winners


HP 82204B Printer


Another tick box checked.   I purchased an HP 82240B Infrared Printer, which allow printouts from a lot of legendary HP calculators including (not an-all inclusive list) the 42S, 17B family, 32S family, 27S, 48 family, and the Swiss Micros DM41X and DM42.


The printer works on 4 AA batteries, I still have to buy an appropriate AC adapter for it.   


The printer works beautifully.   Check out the HP 82240B and some printouts using the HP 17BII+. 








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, October 4, 2021

Simple Generating Functions

 Generating Functions 


Generating a Sequence Via a Function


A generating function, g(x), can be expressed as a power series polynomial.  The coefficients of such polynomials make up the generating sequence.


g(x) = Σ( c_k * x^k, k=0 to ∞) = c_0 + c_1 * x + c_2 * x^2 + c_3 * x^3 + ....


The generated sequence is {c_0, c_1, c_2, c_3, ... }.


A simple approach is find the Maclaurin Series (Taylor Series about the point 0) of g(x).


Example:


g(x) = 2 ÷ (1 - 3*x)


The Maclaurin Series of g(x) is:


2 + 6*x + 18*x^2 + 54*x^3 + 162*x^4 + 486*x^5 + ...


with the sequence of { 2, 6, 18, 54, 162, 486 ... }


Some Simple Generating Functions

1 ÷ (1 - x) = 1 + x + x^2 + x^3 + x^4 + ....

÷ (1 - x) = b + b + b^2 + b^3 + b^4 + ....

1 ÷ (1 - a*x) = 1 + a*x + a^2*x^2 + a^3*x^3 + a^4*x^4 + ....

1 ÷ (1 - x)^2 = 1 + 2*x + 3*x^2 + 4*x^3 + 5*x^4 + ....

1 ÷ (1 + x) = 1 - x + x^2 - x^3 + x^4 - x^5 + ....



(as pictures the size of 3" x 5" index cards:  let me know if you want more posts like this - 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, October 3, 2021

HP Prime Python: Complex Number Arithmetic and Lambert Function - and Firmware Update!

 HP Prime Python:  Complex Number Arithmetic and  Lambert Function

HP Prime Python:  Complex Number Arithmetic and  Lambert Function - and Firmware Update!


Firmware Update!


There is a new firmware update (10/1/2021) - v. 14596 for both the Hardware versions (Version 1 and Version 2) of the HP Prime.   The link to the MHPoC entry and download links:  


HPMoC Thread:

https://www.hpmuseum.org/forum/thread-17538-post-152707.html#pid152707


HP Prime Hardware 1 Download:

https://www.hpcalc.org/details/7469


HP Prime Hardware 2 Download:

https://www.hpcalc.org/details/7783


Now on to complex numbers and the Lambert function.


Python File Introduction

A work around of having separate Python files is to create separate apps for each application.  Both applications are available to download at the blog. 


Complex Number Arithmetic


The HP Prime App "Python-Complex Arithmetic" performs the four arithmetic functions on two complex numbers.


Script:


from cmath import *

print("Complex Number Arithmetic")

x1=float(input("real_1: "))

# input values are not auto printed

print(x1)

y1=float(input("imag_y: "))

print(y1)

z1=complex(x1,y1)

print("z1 = "+str(z1))


x2=float(input("real_2: "))

print(x2)

y2=float(input("imag_2: "))

print(y2)

z2=complex(x2,y2)

print("z2 = "+str(z2))


print()

print("z1 + z2 = "+str(z1+z2))

print("z1 - z2 = "+str(z1-z2))

print("z1 * z2 = "+str(z1*z2))

print("z1 / z2 = "+str(z1/z2))


Example:

x1 = 9

y1 = -8  (use [ +/- ] to enter negative numbers)


x2 = -1

y2 = 4


Results:

z1 = 9-8j

z2 = -1+4j


z1 + z2 = 8-4j

z1 - z2 = 10-12j

z1 * z2 = 23+44j

z1 / z2 = -2.411764705882353-1.647058823529412j



Lambert W Function


The HP Prime App "Python-Lambert W Function" approximates the Lambert W function.   The Python script estimates w given complex number z using Newtons Method:


w * e^w = z


Script:


from cmath import *

print("Lambert W Function - approx")

print("w * exp(w) = z, find w")

zr=float(input("z_real: "))

print(zr)

zj=float(input("z_imag: "))

print(zj)

z=complex(zr,zj)

w0=complex(1,1)

w1=complex(1,1)


while abs(w1)>1*10**-10:

 w1=(w0*exp(w0)-z)/(exp(w0)+w0*exp(w0))

 w0=w0-w1


# round low parts to zero

# z.real, z.imag are read only

wr=w0.real

if abs(wr)<1*10**-10:

 wr=0

wj=w0.imag

if abs(wj)<1*10**-10:

  wj=0

w0=complex(wr,wj)

  

print("w = "+str(w0))



Example:


Input:  -1.57079362679 (about π/2)

Result:  approx -1.223152769062088e-06+1.57079554811127j  


Input:  2+3j

Result:  approx 1.090076534485791+0.5301397207748389j



Source:

Wikipedia.  "Lambert W Function" Last updated June 13, 2021.   

https://en.wikipedia.org/wiki/Lambert_W_function Retrieved July 9, 2021


Download both apps here (zip file):  

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


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, October 2, 2021

Swiss Micros DM41X: Working With Alpha Strings

Swiss Micros DM41X: Working With Alpha Strings





This first blog in the October series for the DM41X will cover basic tips and tricks for working with alpha strings.  


Considerations


Alpha characters are marked in blue on the Swiss Micros DM41X and the HP 41C series.  Alpha characters and the shift characters are shown on the back of the calculator.  


The alpha string can hold up to 24 characters total.  All letters are upper case, with the only lower case letters available are a, b, c, d, and e.  


Let's start with clearing the alpha register.   Usually, when a new alpha string is started, it will replace the contents of the alpha register.  However, ARCL and |- add to the string.  A sure way to make sure that the alpha register is cleared by executing the Clear Alpha (CLA) command.


You can attach the contents of a register, including stack register characters, to the end of the alpha register by using the ARCL command.  


ALENG returns the length of the alpha string.  


You can store strings by using ASTO.  But please be aware, each register can only hold up to six characters.   Example:  an attempt to store EDWARDS to R00 will only store EDWARD.  



Swiss Micros DM41X Program 1:  ALP1


Notes:


To attach strings together, use the append symbol (|-) as the first symbol of the string. Press [ alpha ], [ shift ], [ XEQ ] for the append symbol.  


33 XTOA adds an exclamation point (shown as a small 1 or a small exclamation point).   XTOA is present for the HP 41CX, HP 41C with the Extended Module, or the Swiss Micros DM41X.  XTOA appends characters to the end of the string.   Some XTOA characters include:


12 µ

33 !

34 "

36 $   

37 % (also [ alpha ], [ shift ], G)

63 ?  (also [ alpha ], [ 3 ])


Program:


Goal:  Build "HELLO WORLD, I AM THE 41!" from two strings and 33 XTOA.  If you have an HP 41C without the extended functions, the 33 XTOA must be ignored.  


01 LBL^T ALP1

02 CLA

03 ^T HELLO WORLD,

04 ^T |- I AM THE 41

05 33

06 XTOA

07 AVIEW

08 END


Swiss Micros DM41X Program 2:  ALP2


Goal:

Store 41 in R00.

"HELLO WORLD, I AM THE "

Alpha recall R00.


01 LBL^T ALP2

02 FIX 0

03 41

04 STO 00

05 ^T HELLO WORLD,

06 ^T |- I AM THE

07 ARCL 00

08 AVIEW

09 FIX 4

10 END


Swiss Micros DM41X Program 3:  ALP3


Goal:

Ask for two numbers and store them in R01 and R02, respectively.

Multiply them and store the result in R03.

Build the string "{R01} * {R02} = {R03}"


01 LBL^T APL3

02 FIX 0

03 CLA

04 CLX

05 ^T R01?

06 PROMPT

07 STO 01

08 CLA

09 ^T R02?

10 PROMPT

11 STO 02

12 RCL 01

13 *

14 STO 03

15 CLA

16 ARCL 01 

17 ^T |- *

8 ARCL 02

19 ^T |- = 

20 ARCL 03

21 AVIEW

22 FIX 4

23 RTN

24 END


Example:  R01 = 11, R02 = 24

Result:  "11*24=264" 


Swiss Micros DM41X Program 4:  ALP4


Ask what is user's name.   Then store the name in:

"HELLO, {NAME} ."


Remember, ASTO stores only the left four characters.  


01 LBL^T ALP4

02 CLA

03 ^T NAME?

04 PROMPT

05 AON

06 ASTO 00

07 CLA

08 ^T HELLO,

09 ARCL 00

10 ^T |- .

11 AVIEW

12 END


Example:  LAUREN  (it's already in Alpha mode because of the AON command)

HELLO, LAUREN.


Hope you find this helpful, 


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. 


Σ(1 / (a^n)) from n=1 to m

 Σ(1 / (a^n)) from n=1 to m This blog entry covers the sum of the series: Σ[1 / (a^n), n=1 to m] with n and m positive integers Specific Cas...