HP41: Formula Evaluation ROM

06062017, 05:27 PM
(This post was last modified: 06062017 05:34 PM by Ángel Martin.)
Post: #1




HP41: Formula Evaluation ROM
Quick test, answer yes/no to the following:
1. Are you tired of deconstructing formulas to program them in your RPN calculator? 2. Do you secretly wish there was possible to type math expressions like in a Sharp calculator or (gasp!) an AOS machine? If your answer to any or both above was "yes" you're in luck  assuming that is you own a 41CX and have the capability to burn ROM images for it  like Clonix/NoVoRAM, MLDL2k, and of course the LC board. From the MartinMcClure MCODE headquarters (developers of the 16C Simulator) comes now the "Formula Evaluation ROM". a 4k Module that allows you to evaluate directly mathematical formulas typed in ALPHA without the need for any FOCAL programs. A sizeable set of functions and operators are included, including the functions in the original OS plus the complete hyperbolic set. Plus a custom Formula Editor to make the entering process a breeze = including curved parenthesis and other special characters for better legibility. And there's more: the module includes formulaaware versions of SV and IT, ready to be put to their paces to solve for equation roots and calculate numerical integrals of the function written in ALPHA  no RPN programs in RAM necessary. Soon to a TOS / CL_Library near you, we're polishing the last touches before the official release. Gamma testers welcome, holler if interested. Cheers, 'AM "To live or die by your own sword one must first learn to wield it aptly." 

06062017, 05:38 PM
Post: #2




RE: HP41: Formula Evaluation ROM
I agree with you Angel. When RPN programmable calculators were kings, programming expressions in RPN (and using smart tricks to save intermediate results) was THE way to go. Hardly anyone complained. But after over 35 years of programming highlevel languages (Basic, Pascal, C, C++, Matlab, R, Python, Perl, PHP, Java, Javascript, and so on) where we use algebraiclike expressions that are easy to read (and easy to fix or edit), I am beginning to lose adoration with using RPN to code long and/or numerous expressions.
Ironically RPL calculators allow you to cheat and EVALuate algebraic expressions enclosed in singlequote strings. It's time to bring RPN engines to par with RPL. So your solution is most welcome. Namir 

06062017, 06:12 PM
Post: #3




RE: HP41: Formula Evaluation ROM
How is it done Angel ?
Did you pull some things from the AEC rom or is this a new masterpiece of your own devising ? :) 

06062017, 06:46 PM
Post: #4




RE: HP41: Formula Evaluation ROM
(06062017 06:12 PM)Gene Wrote: How is it done Angel ? Entirely new code, nothing from the AECROM which did the FOCAL selfprogramming, not the formula interpretation like ours do. It's all new ideas, Greg's design of a "symbolic buffer" where the intermediate steps (values, functions and status) are pushed to and popped from as required according to the syntax. A beauty to see in action ;) "To live or die by your own sword one must first learn to wield it aptly." 

06062017, 06:53 PM
Post: #5




RE: HP41: Formula Evaluation ROM
Greetings, Massimo +×÷ ↔ left is right and right is wrong 

06062017, 07:16 PM
(This post was last modified: 06062017 07:18 PM by Luigi Vampa.)
Post: #6




RE: HP41: Formula Evaluation ROM
[OFF TOPIC]
Dear Ángel, You are unbelievable boy! I wish you devoted your gifted mind to the HP42s sometime in the future :0) At some point, you must find HP41's limits, if any ;0) Saludos Saluti Cordialement Cumprimentos MfG BR + + + + + Luigi Vampa + Free42 '<3' I + + 

06062017, 07:18 PM
Post: #7




RE: HP41: Formula Evaluation ROM
BTW, the EVAL function also works with FINTG and FROOT from Ángel's Sandmath module as well if you are used to using these fine MCODE functions! I do like the SV and IT functions (which won't require any other module except Lib4, only they are FOCAL code, which reminds me I need to insure the full register usage is mentioned in the manual...), and there are some nice EVAL examples in the module. It is almost ready to release, and Ángel's documentation is worth reading (I love his formula entry program, it is the highlight of the module)...
Greg M 

06062017, 07:27 PM
Post: #8




RE: HP41: Formula Evaluation ROM  
06062017, 10:05 PM
(This post was last modified: 06062017 10:17 PM by pier4r.)
Post: #9




RE: HP41: Formula Evaluation ROM
(06062017 05:38 PM)Namir Wrote: I agree with you Angel. When RPN programmable calculators were kings, programming expressions in RPN (and using smart tricks to save intermediate results) was THE way to go. Hardly anyone complained. But after over 35 years of programming highlevel languages (Basic, Pascal, C, C++, Matlab, R, Python, Perl, PHP, Java, Javascript, and so on) where we use algebraiclike expressions that are easy to read (and easy to fix or edit), I am beginning to lose adoration with using RPN to code long and/or numerous expressions. Maybe because I do read formulas like sentences and I do not break down in my mind (except for parentheses and co), but I never used the RPN aside from very short formulas involving maximum 56 operators. Also on the free42 is the same. In the worst case I save intermediate parts and then I combine those. Otherwise I either write it down in the source code, so it may take a bit longer but I have a comment for it, or I write the algebraic form. Also, if the formula itself is not so "easy" in computational terms, like a summation, the overhead to convert the formula from algebraic to RPL code seems negligible, at least with the 50g. So in short, I agree with Namir. edit: I forgot. Kudos for the work, Angel. I saw a lot of those works for the 41 and I believe they are all very neat, unfortunately the 41 is outside my interest unless I misunderstood its capabilities (the 42s/free42 should be a superset of it, right?). Wikis are great, Contribute :) 

06072017, 02:33 AM
Post: #10




RE: HP41: Formula Evaluation ROM
So what limits ?
24 character alpha or is that removed ? Pending operations? How to scroll to replace a value ? 

06072017, 04:06 AM
Post: #11




RE: HP41: Formula Evaluation ROM
(06072017 02:33 AM)Gene Wrote: So what limits ? Gene, Alpha register is used, yes 24char limit on formula. However supported functions will be abbreviated to 1 to 3 chars (i.e S for Sine), up to 9 digit integer values allowed in functions, function precedence (^ over * / and MOD, * / MOD over + ), parenthesis used to override precedence. For this version we did our best to allow the 24 characters to yield the most formula, there are more steps to be taken in future versions of this. One trick explained in the manual to extend the formula will be to use part of the equation, save the result in Y instead of X (and yes the result can be saved to X, Y, Z, T, or L). Then complete the equation using Y for the previous partial result. Not sure what you mean by limits, but any calculation limits would be the same limit of the function/operation chosen (i.e. for Sine the parameter can be any value Sine accepts on the 41). Formula replacement is just to put another formula into the Alpha. The EVAL functions will be programmable, so support for storing and recalling the formula to a set of registers is done. A formula creation function is available to make easy formulas. Some example functions will be included on the ROM in FOCAL, i.e. quadratic formula. I am currently trying to break the release candidate version Angel last sent me, so far, so good! Greg 

06102017, 08:53 AM
(This post was last modified: 06102017 08:56 AM by Ángel Martin.)
Post: #12




RE: HP41: Formula Evaluation ROM
Module and manual now posted at TOS  Check the "What's New" section.
Also available on the CL web site: http://systemyde.com/pdf/Formula_Evaluation.pdf Thanks to Warren Furlow and Monte Dalrymple for hosting the documents. "To live or die by your own sword one must first learn to wield it aptly." 

06102017, 01:30 PM
Post: #13




RE: HP41: Formula Evaluation ROM
(06102017 08:53 AM)Ángel Martin Wrote: Module and manual now posted at TOS  Check the "What's New" section. Thanks to you and Greg for continuing to extend the '41 into new realms! Any idea if Michael will be making this new overlay available? Looks like it will be helpful if not necessary to use this effectively. Bob Prosperi 

06102017, 03:01 PM
Post: #14




RE: HP41: Formula Evaluation ROM
(06102017 01:30 PM)rprosperi Wrote: Any idea if Michael will be making this new overlay available? Looks like it will be helpful if not necessary to use this effectively. Actually this one is very intuitive, as for the most part (say 90% of functions) the same standard keys are used to type the function. Try iy out and you'll see what I mean. But of course I'd love to have a new overlay, I'm assuming Michael would need a minimum order volume though. "To live or die by your own sword one must first learn to wield it aptly." 

06102017, 08:34 PM
Post: #15




RE: HP41: Formula Evaluation ROM
(06102017 08:53 AM)Ángel Martin Wrote: Module and manual now posted at TOS  Check the "What's New" section. Awesome! Simply awesome! Thanks a lot for the new gem!! Alte the Best, Juergen 

06112017, 09:16 AM
(This post was last modified: 06122017 11:17 AM by Ángel Martin.)
Post: #16




RE: HP41: Formula Evaluation ROM
(06102017 08:34 PM)JurgenRo Wrote: Awesome! Simply awesome! Thanks a lot for the new gem!! Glad to see it's appreciated, a lot of work went into it! BTW I recently added more examples in the ROM, for the most common Orthogonal polynomials. The routines won't beat the speed of the MCODEbased functions in the SandMath and SandMatrix, but show how to use EVAL$ in a DSEcontrolled loop. Here's the code, including Legendre LEG$, Hermite HMT$, and Chebyshev's 1st. & 2nd. kinds HNX$, UNX$  all four in 50 steps, not bad at all. Enter the order "n" in Y and the argument "x" in X, then execute the routine. The result is left in X, and the previous order result in LastX. No data registers used. Code: 1 LBL "LEG$ "To live or die by your own sword one must first learn to wield it aptly." 

06112017, 03:47 PM
Post: #17




RE: HP41: Formula Evaluation ROM
Step 4: "(T1))/T"
The first character is an append sign. This makes sense as step 4 would overwrite step 3 otherwise. Thanks to Angel for the confirmation and help. 

06122017, 07:13 AM
(This post was last modified: 06122017 08:40 AM by Ángel Martin.)
Post: #18




RE: HP41: Formula Evaluation ROM
(06112017 03:47 PM)Gene Wrote: Step 4: "(T1))/T" And the same for line #35  and in general for every formula that spans two program steps. Here's another example to calculate the Lambert function W(x) This one requires calling EVAL$ twice because Newton's formula exceeds 24 chars, so we break it in two sections. Despite that it only takes 15 steps. Type: x, XEQ "WL$" => successive approximations shown until final result. Note that in some cases there may be some oscillations around the last decimal digit due to the Newton method. You can modify the program to cover for this contingency (the root cause is the X#Y? instruction at step #13, thus you can add X<>Y, RND, X<>Y RND right before the test is made  with the calculator in FIX 9). Code: 1 LBL "WL$ "To live or die by your own sword one must first learn to wield it aptly." 

06122017, 07:36 AM
(This post was last modified: 06122017 08:40 AM by Ángel Martin.)
Post: #19




RE: HP41: Formula Evaluation ROM
Well, here's a shorter version that only requires calling EVAL$ once  I should have remember those pesky precedence rules ;)
This version also adds the rounding to avoid the oscillations. Code: 1 LBL "WL$ "To live or die by your own sword one must first learn to wield it aptly." 

« Next Oldest  Next Newest »

User(s) browsing this thread: 1 Guest(s)