New Version of the 41Z


A new version of the 41Z module is available and should be posted at TOS in a few days.

In addition to some bug fixing and code optimization, version 5C includes programs to calculate the Lambert W, and Bessel functions for complex variable and in all cases (yes, including negative and positive integer orders!).

Don't expect blazing performance on the coconut CPU (use V41 for that!) - but of course accurate results :)

I also separated the buffer functions into their own dedicated ROM, also available. That freed up some space on the 41Z module to add the new functions.

If used, the buffer module should be loaded in the next contiguous page after the 41Z. It's basically a diagnostics facility so there's no point in having it always on-line (which would turn the 41Z into another 12k ROM).

Your feedback and suggestions is welcome. Hope you enjoy it as much as I did programming them.



In case you're curious, here are the formulae used in the Bessel functions implementation:

Orders can be either real or complex. I use an iterative algorithm for J (and I) which is valid for Re(z)>0 and all orders but negative integers due to the Gamma singularities.

J(w,z) = SUM {U(k)|k=1,2,….} * (z/2)^w / G(w+1)

U(k) = -U(k-1) * (z/2)^2 / k(k+w)

U(0) = 1

Then I use the following two continuation rules:

1. for negative integers, J(-n,z) = (-1)^n * J(n,z)

2. for Re(z)<0, J(w,-z) = (-z)^w * (z)^(-w) * J(w,z)

For non-integer orders, Y and K are derived from J and I using the well-known formulas involving sin(pi z) and cos(pi z).

Y(w,z) = [ J(w,z) cos(w(pi)) - J(-w,z) ] / sin(w(pi))

K(w,z) = (pi/2) [ I(-w,z) - I(w,z) ] / sin(w(pi))

For integer orders however those don't work, and I have to resort to the more elaborate summations, as follows:

pi* Y(n,z) = 2[geu + Ln z/2] J(n,z) – SUM{(-1)^k fk(n,z)} – SUM{gk(n,z)}

(-1)^n+1 * 2 K(n,z) = 2 [geu + Ln z/2] I(n,z) – SUM{fk(n,z)} – (-1)^n * SUM{(-1)^k * gk(n,z)}

gk(n,x) = (z/2)^2k-n (n-k-1)! / k! ; k=0,2,…(n-1)

fk(n,z) = (z/2)^2k+n [H(k) + H(n+k)] / [k! (n+k)!] ; k=0,1,2,…..

H(n) = SUM {1/k}, k=1,2...n

Hope this helps.

Edited: 25 July 2010, 6:24 a.m.


Sounds like a cool update to an already cool module. Unfortunately my therapist highly recommended that I stay away from "imaginary" friends AND numbers and stick with reality and real numbers.




Unfortunately my therapist highly recommended that I stay away from "imaginary" friends AND numbers

mmm, that's strange, Are you sure you didn't imagine it?





I guess sometimes we need to have an "imaginary part" to understand our "real part"....


HI, Angel;

congratulations, great brain job! And thanks, o'course!

As soon as it is available I'll download and run it. For these days I'm delving into a 3421 unit and because I intend using it for some experiments, vectors and complex calculus are always welcome when dealing with AC measuring and related stuff.


Luiz (Brazil)


Not a problem Luiz, hope your adventures w/ the AC unit fare well...

If I'd only had the 41Z when I was in eng. school... although it may have ruined all my exams so on reflection it's probably better that I didn't.



I had an HP41C with one memory module, and later I bought an HP15C. This was 'heavy army' at that time (80´s), but the fact that I was so desperate to use them led me to study harder, mostly to write the programs for the HP41C.

If, at that time, I had access to all information I have now about the HP41´s internals and had the chance to build some of the stuff I see now, chances are that I'd have many subjects flunk... (is this construction correct? Never used the verb 'flunk' before...)


Luiz (Brazil)


Luiz; Since you asked; it's flunked, with the ed sounding like a lone t. Your english has improved from good (better than New Yorkers) to usually idiomatically correct in the last few years. Are you still studying?

I've had cause to use that verb, but never in the low level math, surveying and physics classes i took, just in waste of time classes like "critical thinking" (a.k.a. "agree with teacher") and "logic" (a.k.a. "forget Boole, let's all worship Aristotle for an entire semester").


Enhorabuena Angel ! Congrats again Angel ! Will 41Z run on either HP41X/Y/Z by HrastProgrammer and on Emu41 by Jean-François Garnier ?
I think it should and will ...

Thank you for your kind attention and reply, and

Best Regards from

Antoine M. "Kermit" Couëtte


Will 41Z run on either HP41X/Y/Z by HrastProgrammer and on Emu41 by Jean-François Garnier ?

I think so, there's not anything esoteric about the 41Z approach after all. It runs like a champ on V41 and i41CX...

Thanks for the praise, it's good to share things with appreciative folks like you.

Possibly Related Threads...
Thread Author Replies Views Last Post
  Last call for 41Z/SandMath Overlays... plus new ones Ángel Martin 0 709 12-12-2013, 10:27 AM
Last Post: Ángel Martin
  Sandmath/41Z overlays Bernd Grubert 1 693 10-29-2013, 03:32 PM
Last Post: 'Angel Martin
  41Z / SandMath Overlays: Ready at last! Ángel Martin 3 884 07-23-2013, 01:30 PM
Last Post: Ángel Martin
  Poll: SandMath and 41Z Overlays anyone? Ángel Martin 20 2,677 05-20-2013, 04:13 PM
Last Post: aurelio
  New version of 41Z - adds ZSTO Math Ángel Martin 0 345 10-21-2011, 02:21 PM
Last Post: Ángel Martin
  Complex Cubic Equation - 41Z Version Ángel Martin 3 631 10-19-2011, 04:23 PM
Last Post: Ángel Martin
  Sandmath-II and 41Z - questions to Angel Vincent Weber 19 2,135 10-04-2011, 12:21 PM
Last Post: Monte Dalrymple
  Updated SandMath-II and 41Z modules Ángel Martin 6 998 09-07-2011, 07:20 PM
Last Post: Gerson W. Barbosa
  41Z Overlay For 41CL Mark Hardman 14 1,626 06-17-2011, 02:03 AM
Last Post: Ángel Martin
  41Z - Just got POLARized... Ángel Martin 9 1,177 11-11-2010, 03:33 AM
Last Post: Geir Isene

Forum Jump: