Table of Contents • 1. Introduction • 2. User RPL □ 2.1. Overview of User RPL □ 2.2. Differential equation □ 2.3. iLaplace • 3. Saturn assembly language □ 3.1. Overview of Saturn assembly □ 3.2. Control the buzzer • 4. System RPL □ 4.1. Overview of SysRPL □ 4.2. More buzzer □ 4.3. HPTools ☆ 4.3.1. Calling CAS functions • 5. Miscellaneous □ 5.1. Step function in Laplace 1. Introduction I got another HP 50g calculator. I heard it has an assembler install on the calculator, and it is much fun to program with Reverse Polish Lisp. Indeed it is fun to play with RPL, but it is a burden to plan ahead the program, with the familiarity of HP 50g's library and the aid of pen and paper it might be easier. To help some new comers who already have plenty of programming experience in Forth and Assembly this article try to provide some quick-start example. 2. User RPL 2.1. Overview of User RPL Traditionally Forth uses a separated data stack to handle local variables, while RPL only has one stack. Thus RPL has added the arrow (→) notation to declare local variables. In fact the notion is similar to the lambda notation in functional programming languages. The language itself is a bit slow compared to the System RPL that will be introduced later, however it is still a powerful language mixing concepts from Forth Lisp, BASIC. 2.2. Higher order non-homogeneous differential equation The original program was from TI BASIC. To be honest (or biased), the CAS of 50g is a bit inferior than Voyage 200. The idea of algorithm is well known from any differential equation textbook. This function produces the Wronskian from an input vector of independent terms from a homogeneous solution. |« DUP SIZE 1 GET → a s |« a 1 s 1 - | START a DERVX DUP 'a' STO AUGMENT | NEXT 5 |» |» You can check the matrix determinant of the Wronskian for a test of existence of solutions. Then, with the Wronskian as coefficient of the system and the right hand side of the homogeneous equation as inputs, this function produces the coefficient for the particular solution. |« 0 → f S |« DUP SIZE 1 GET 'S' STO S 1 - 1 SWAP | START 0 NEXT | NEXT f S →ARRY 5 | SWAP / SIMPLIFY INTVX SIMPLIFY |» |» The builtin LDEC can be used for solve non-homogeneous LDEs but the result is complicated because of the method it uses. 2.3. Use inverse Laplace to solve initial value problem The program below generates equation for the left hand side a linear differential equation of numeric coefficients, taking the list of coefficients from higher power to lower and initial values of the form ' '' { f ( 0 ) , f ( 0 ) , ... }