Solver and Integrator: Program questions

Post here to share useful tips and tricks, to ask questions about using your DM42 or to report software-related problems
mcc
Posts: 277
Joined: Fri Jun 23, 2017 5:10 am

Solver and Integrator: Program questions

Post by mcc »

Hi,

are the Solver and the Numerical Integrator of the DM42 available as code (FOCAL I think it is)?

Is it possible to program the behaviour of the menu of the Integrator into another program with own code ...
I mean the simultanous setting of variables like LLIM, ULIM and ACC and an action (start the integration) in
one menu?

Thanks a lot for any help!
Cheers!
Meino
DM 42 - SN: 00373, Firmware release v.:3.22. / DMCP 3.24. as compiled by SwissMicros
Thomas Okken
Posts: 1100
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: Solver and Integrator: Program questions

Post by Thomas Okken »

Free42 is written entirely in C and C++. The source code is available, but it's not FOCAL.

Creating a menu where you can do both data entry and program execution is possible using the Programmable Menu. Look for KEYG, KEYX, and MENU in the HP-42S manual, pages 145-148. I believe there are more elaborate examples in the Programming Examples and Techniques book.
mcc
Posts: 277
Joined: Fri Jun 23, 2017 5:10 am

Re: Solver and Integrator: Program questions

Post by mcc »

Hi Thomas,

I had hoped, that there would be an alternative implementation of the Solver/Integrator in FOCAL out there "in the wild" ... but I didn't
find some, too.

Thanks for the info about how to get such a menu...I will check the manuals! :)

Cheers!
mcc
DM 42 - SN: 00373, Firmware release v.:3.22. / DMCP 3.24. as compiled by SwissMicros
User avatar
ijabbott
Posts: 253
Joined: Fri Dec 15, 2017 2:34 pm
Location: GB-MAN

Re: Solver and Integrator: Program questions

Post by ijabbott »

mcc wrote:
Wed Jul 03, 2019 3:57 am
I had hoped, that there would be an alternative implementation of the Solver/Integrator in FOCAL out there "in the wild" ... but I didn't
find some, too.
The solver and integrator are probably implemented in some pre-HP48 version of System RPL (SysRPL), or possibly Saturn assembly language for speed. It's interesting to note that underneath the four-level stack-based FOCAL environment of the HP-42S, there is lurking a more powerful stack-based environment that is out of reach to the HP-42S user!
User avatar
Walter
Posts: 3070
Joined: Tue May 02, 2017 11:13 am
Location: On a mission close to DRS, Germany

Re: Solver and Integrator: Program questions

Post by Walter »

ijabbott wrote:
Wed Jul 03, 2019 9:55 am
The solver and integrator are probably implemented in some pre-HP48 version of System RPL (SysRPL), or possibly Saturn assembly language for speed. ...
I assume the basic procedures are older since they were implemented on HP-34C and -15C before the rise of RPL already. I don't think HP did redesign these - don't you ever change a working algorithm!
WP43 SN00000, 34S, and 31S for obvious reasons; HP-35, 45, ..., 35S, 15CE, DM16L S/N# 00093, DM42β SN:00041
User avatar
akaTB
Posts: 794
Joined: Tue May 02, 2017 1:56 pm
Location: Milan, Italy

Re: Solver and Integrator: Program questions

Post by akaTB »

ijabbott wrote:
Wed Jul 03, 2019 9:55 am
underneath the four-level stack-based FOCAL environment of the HP-42S, there is lurking a more powerful stack-based environment that is out of reach to the HP-42S user!
Thanks God!
You still had a 2 line display...
Greetings,
    Massimo
ajcaton
-+×÷ left is right and right is wrong :twisted: Casted in gold
User avatar
ijabbott
Posts: 253
Joined: Fri Dec 15, 2017 2:34 pm
Location: GB-MAN

Re: Solver and Integrator: Program questions

Post by ijabbott »

Walter wrote:
Wed Jul 03, 2019 11:04 am
ijabbott wrote:
Wed Jul 03, 2019 9:55 am
The solver and integrator are probably implemented in some pre-HP48 version of System RPL (SysRPL), or possibly Saturn assembly language for speed. ...
I assume the basic procedures are older since they were implemented on HP-34C and -15C before the rise of RPL already. I don't think HP did redesign these - don't you ever change a working algorithm!
Maybe they left those in assembler, though presumably lots of the HP-41CX code was converted to SysRPL for the HP-42S.
Thomas Okken
Posts: 1100
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: Solver and Integrator: Program questions

Post by Thomas Okken »

With something like a solver, the algorithm is everything. Whether you code it in assembly language, SysRPL, or C, is just an implementation detail.

I bet the HP Solve algorithm has evolved since the 34C. It would be interesting to see the commented source code for the various implementations over the years, if they still exist, and if HP ever choose to open-source them...
User avatar
Walter
Posts: 3070
Joined: Tue May 02, 2017 11:13 am
Location: On a mission close to DRS, Germany

Re: Solver and Integrator: Program questions

Post by Walter »

Thomas Okken wrote:
Thu Jul 04, 2019 6:56 am
With something like a solver, the algorithm is everything. Whether you code it in assembly language, SysRPL, or C, is just an implementation detail.

I bet the HP Solve algorithm has evolved since the 34C. It would be interesting to see the commented source code for the various implementations over the years, if they still exist, and if HP ever choose to open-source them...
This would be something really worth of re-engineering. Since one can do a ROM dump of the HP-42S, wouldn't it be possible to decode it? Presumably too much work... (though by comparison to the HP-15C ROM, one may find similar structures. Matching patterns?). Probably I am showing up as having absolutely no idea of such a task...
WP43 SN00000, 34S, and 31S for obvious reasons; HP-35, 45, ..., 35S, 15CE, DM16L S/N# 00093, DM42β SN:00041
Thomas Okken
Posts: 1100
Joined: Tue May 02, 2017 5:48 pm
Location: Netherlands
Contact:

Re: Solver and Integrator: Program questions

Post by Thomas Okken »

Walter wrote:
Thu Jul 04, 2019 3:11 pm
Thomas Okken wrote:
Thu Jul 04, 2019 6:56 am
With something like a solver, the algorithm is everything. Whether you code it in assembly language, SysRPL, or C, is just an implementation detail.

I bet the HP Solve algorithm has evolved since the 34C. It would be interesting to see the commented source code for the various implementations over the years, if they still exist, and if HP ever choose to open-source them...
This would be something really worth of re-engineering. Since one can do a ROM dump of the HP-42S, wouldn't it be possible to decode it? Presumably too much work... (though by comparison to the HP-15C ROM, one may find similar structures. Matching patterns?). Probably I am showing up as having absolutely no idea of such a task...
It's possible, but a lot of work. Back in the early '80s, a friend and I spent some time analyzing the ROM of his Commodore PET, and we encountered quite a few spots where we just couldn't figure out what was going on. We gave up after a while. I'm sure I'd do better now, but then again, the HP-42S has a lot more ROM than the PET, and Saturn assembly language is harder to read than 6502. Still, it could be done, and HP Solve reverse-engineered that way, but it seems like a waste of time, since you wouldn't be able to use the results of that work anyway. Any re-implementation of HP Solve would be considered a translation, and still covered by the copyright on the original code.

For the Free42 solver, I observed the behavior of the HP-42S solver to get some ideas of how to deal with no or bad starting values, and then implemented a simple secant solver, and later added the Ridders algorithm upon the recommendation of an early user. The result isn't as good as HP Solve, but it seems to be generally reasonably close in terms of performance. I would still love to see the real HP Solve algorithm, but I'm pretty happy with the one in Free42 as well.
Post Reply