HP Forums

Full Version: New Version of the 41Z
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

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.

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)

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.



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.

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?


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").

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