WP34s contributed programs. Where to send? - Printable Version +- HP Forums ( https://archived.hpcalc.org/museumforum)+-- Forum: HP Museum Forums ( https://archived.hpcalc.org/museumforum/forum-1.html)+--- Forum: Old HP Forum Archives ( https://archived.hpcalc.org/museumforum/forum-2.html)+--- Thread: WP34s contributed programs. Where to send? ( /thread-244016.html) |

WP34s contributed programs. Where to send? - Eduardo Duenez - 05-21-2013
I wrote a WP34s program to evaluate elliptic integrals of the second kind (i.e., to find the perimeter of ellipses) using the recent beautiful recursive formulas by Semjon Adlaj: http://www.ams.org/notices/201208/rtx120801094p.pdf Is there any repository or official place to submit code contributions?
Eduardo
Re: WP34s contributed programs. Where to send? - Thomas Klemm - 05-21-2013
Re: WP34s contributed programs. Where to send? - Namir - 05-22-2013
Many years ago I opted to get my ow web site where I can promptly post and update articles and listings for various calculators and mathematical software. If you feel that you have much to add, then having your own web site, under your direct control, is a good approach. Eddie Shore is another "member" of this web site who also has his own web site where he posts listings for various calculators. Namir
Re: WP34s contributed programs. Where to send? - Paul Dale - 05-22-2013
Send the code to Marcus, Walter or myself and we'll add it to the library over at the sourceforge site.
Re: WP34s contributed programs. Where to send? - Eduardo Duenez - 05-22-2013
Yes, I have seen the announcement on the forum, but I don't see any WP34s software listed there... For the time being I've sent the code to Pauli. Perhaps it'll make it to the Sourceforge repository eventually.
Eduardo
Re: WP34s contributed programs. Where to send? - Eduardo Duenez - 05-22-2013
Pauli, I sent you the program via "contact user" at the forum, but "less than" signs were removed from the message by the forum software, breaking the source code... Any alternatives?
Eduardo
Re: WP34s contributed programs. Where to send? - Paul Dale - 05-22-2013
I fixed things. The programs are on the sourceforge site (elliptic.wp34s and modified-AGM.wp34s) in the library directory.
- Pauli
Re: WP34s contributed programs. Where to send? - Eduardo Duenez - 05-23-2013
Oh, thanks!
Eduardo
Re: WP34s contributed programs. Where to send? - Eduardo Duenez - 05-23-2013
Quote: I found one minor error, not in the code, but in the comment documenting the functionality of EI2:
Quote: should read
Quote:
Re: WP34s contributed programs. Where to send? - Reth - 05-23-2013
I wish someone developed a new solver program that gives results like any HP calculator with solver.
Re: WP34s contributed programs. Where to send? - Thomas Klemm - 05-23-2013
Links for the lazy: Re: WP34s contributed programs. Where to send? - Walter B - 05-23-2013
Reminds me on an old fairy tale starter: "At a time when wishing had helped ..." The WP 34S software is open source. Everybody is free to write a better solver routine, e.g. you.
d:-/
Re: WP34s contributed programs. Where to send? - Thomas Klemm - 05-23-2013
This might be a good starting point: And then maybe debugging an emulator of either HP-34C or HP-15C. Or maybe the HP-48 series would be easier?
Kind regards
Re: WP34s contributed programs. Where to send? - Paul Dale - 05-23-2013
I don't have time at the moment. So it isn't going to be me. However, the source is available, the solver is nothing more than a keystroke program so go ahead and write your own and submit it or convince someone else to.
Re: WP34s contributed programs. Where to send? - Thomas Klemm - 05-24-2013
## Arithmetic-Geometric Mean
This is a Python-script: eps = 1e-14
And that's the program for the HP-42S: 00 { 29-Byte Prgm }
## Modified Arithmetic-Geometric MeanI've made some modifications to the formula presented in the paper. Be aware that x and y correspond to x - z and y - z.
This is a Python-script: eps = 1e-14
And that's the program for the HP-42S: 00 { 37-Byte Prgm }
## Perimeter of Ellipse00 { 37-Byte Prgm }
Using the example (a = 3, b = 2) that Gerson used in
2 ENTER 3
Kind regards
Re: WP34s contributed programs. Where to send? - Gerson W. Barbosa - 05-24-2013
Very nice! Accurate to at least 11 digits and less than 2 seconds on my HP-42S. This runs "ellipses" around the approximation I've used :-) Cheers,
Gerson.
Re: WP34s contributed programs. Where to send? - Thomas Klemm - 05-24-2013
This is Hugh Steers' C-program written in Python: def agm(b):
And that's the program for the HP-42S: 00 { 71-Byte Prgm }
Using your example (a = 3, b = 2) I got: 2 ENTER 3
Kind regards
Re: WP34s contributed programs. Where to send? - Gerson W. Barbosa - 05-25-2013
Thanks for converting Hugh's program! 4.06397418824The previous program returns 4.0639741721The exact result is 4.06397418010089574..There's loss of accuracy as b gets smaller, but the results are consistently greater than 4, unlike the previous program which will eventually give results below 4. IMO, this should go to the Software Library. Cheers,
Gerson.
Re: WP34s contributed programs. Where to send? - Eduardo Duenez - 05-29-2013
Quote: Note that the WP34s modified-AGM algorithm I wrote, although longer, is very robust. It keeps track of the last two iterations. As soon as one iteration fails to improve over the last one, the last one is returned. If at any point xn = yn, it also stops. The algorithm is guaranteed to stop, and to return the best possible answer limited only by the calculator's working precision. (I.e., no need to set up any small acceptable tolerance eps beforehand.) The algorithm is oblivious to the WP34s being in standard or double precision. The price paid is the use of 7 local registers (though only 2 stack levels).
Eduardo
Re: WP34s contributed programs. Where to send? - Walter B - 05-29-2013
Quote:Little is as cheap as local registers. Each and every program may use up to 144 of them (as long as memory is sufficient).
d:-)
Re: WP34s contributed programs. Where to send? - Paul Dale - 05-29-2013
In XROM code, even the memory part is free :) Not that I'm planning on including the elliptic integral code as a built in function.
Re: WP34s contributed programs. Where to send? - Gerson W. Barbosa - 05-29-2013
Is there still room for complex Zeta? Thanks!
Gerson.
Complex zeta function - Paul Dale - 05-29-2013
There possibly is room, the problem is finding an algorithm that converges in reasonable time. I don't know of any. For real zeta, I'm using Borwein's algorithm that converges rapidly & was state of the art when I implement this on the 34S. Unfortunately, for the complex number a + i b, this algorithm requires a number of steps proportional to |b|. I originally coded this in C using a fixed number of steps. The results were great for complex numbers near the real line but went wrong as they got further away. Adapting the code to use a variable number of terms would have been possible & the number of terms required can be calculated before starting the computation. However, we'd then have had a function whose run time was open ended. Calculating zeta(3 + 1e23 i) would have taken more than a while -- Wolfram alpha fails to calculate this for me. Try out the HP 41 program to see how long it takes :-) The might be some hope using the Lerch transcendent for which some series are known but I've not investigated their convergence characteristics. Implementing this function would buy us a pile of others for free so it would be my preferred route.
Re: WP34s contributed programs. Where to send? - Thomas Klemm - 05-29-2013
Why not using the 8-level stack?
Cheers Re: WP34s contributed programs. Where to send? - Thomas Klemm - 05-29-2013
Did you notice that my HP-42S program "AGM" uses a fixed amount of 4 loops? Very robust and guaranteed to stop. But I admit that I was a little sloppy with "MAGM": it might be possible that it doesn't terminate. But with the WP-34S we could use
Quote:
Cheers Re: Complex zeta function - Thomas Klemm - 05-29-2013
I could imagine that the problem to calculate
Quote:
It isn't premised that the holomorphic function converges fast on
Kind regards Re: WP34s contributed programs. Where to send? - Eduardo Duenez - 05-29-2013
Quote:
While one would (optimistically) expect the sequences xn and yn to pass the test In my implementation of the modified-AGM, I tried to achieve maximum precision, whether the digits be visible or not. Since the algorithm converges very quickly (quadratically), I think aiming for maximum precision is the right thing to do. The only relative drawbacks are sightly longer code and a few more local registers used.
Eduardo
Re: WP34s contributed programs. Where to send? - Thomas Klemm - 05-30-2013
You might still be able to reduce the size of the program using the simpler formulas after the transformation: Quote:
Cheers Re: WP34s contributed programs. Where to send? - Eduardo Duenez - 05-30-2013
Quote: Yes, this change of variables may shorten the program. I might implement some changes in the WP34s code later. (My original goal in implementing the algorithm was maximal accuracy, not code optimization. I wasn't too worried about speed due to the inherent efficiency of the algorithm.)
Thanks, |