Try to learn something about everything, and everything about somethingThomas Huxley “Darwin's bulldog” (1824-1895)

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
public:calculator:progs:dm41x_progs [24/01/26 08:08 GMT] – [Page Info] johnpublic:calculator:progs:dm41x_progs [14/02/26 11:19 GMT] (current) – [Using Solve and Integrate together] john
Line 14: Line 14:
 |TR - from HP41cx User guide vol. 2| {{ :public:calculator:progs:tr.raw |}} | |TR - from HP41cx User guide vol. 2| {{ :public:calculator:progs:tr.raw |}} |
 |Sigma - from HP41cx User guide vol.2| {{ :public:calculator:progs:sigma.raw |}}| |Sigma - from HP41cx User guide vol.2| {{ :public:calculator:progs:sigma.raw |}}|
 +
 +
 +===== Using Solve and Integrate together =====
 +
 +  * from HP343C handbook
 +  * DM41X version uses ''SOLVE'' and ''INTEG'' from [[..:guides:advantage_pac| Advantage Pac]]
 +
 +  - Create a ''MYSOLVE'' wrapper that handles putting the correct ''SOLVE'' program name in ''ALPHA'' etc
 +  - Create the program that is to be solved and which has as it's function an integral
 +  - Create the program that defines the integral
 +
 +=== MYSOLVE ===
 +
 +<code>
 +LBL ¬MYSOLVE
 +¬MOD                    // the label of the program to be solved is put in ALPHA
 +SOLVE                   // we XEQ SOLVE (the Advantage Pac solver)
 +RTN
 +</code>
 +
 +=== Solve : MOD ===
 +
 +The program to be solved
 +
 +<code>
 +LBL ¬MOD
 +¬BESSEL           // We put the name of the program with the integral in ALPHA
 +STO 00            // We store our current guess for X in R 00 to be accessible by the integral finction
 +0                 // put upper and lower limits for the integration in Y and X
 +PI
 +INTEG             // xeq INTEG from Advantage Pac
 +ABS               // our current guess, make it positive
 +X<=Y?             // Y has the Integration's estimate of accuracy - we use this to limit our search
 +ClX               // if our guess has returned a value from the integral that's less than the inherent accuracy then that's GOOD ENOUGH, we set X to zero and SOLVE completes     
 +X≠0?              // if we still don't have zero we put back the last guess and SOLVE continues
 +LastX
 +RTN
 +
 +</code>
 +
 +=== Integral : BESSEL ===
 +
 +<code>
 +LBL ¬BESSEL
 +SIN
 +RCL 00
 +*
 +COS
 +PI
 +/
 +RTN
 +
 +</code>
 +
 +
 +=== Running it ===
 +
 +  * ''MYSOLVE'' sets up the ''ALPHA'' register with the name of the prog to be solved, so nothing needed in ''ALPHA'' at this time
 +  * put initial guesses in ''X'' and ''Y''
 +    * <key>'1'</key> <key>ENTER</key> <key>'2'</key>
 +  * try ''FIX 4''
 +  * Run ''MYSOLVE'' - via XEQ or set up a ''CST'' menu item for it 
 +
 +After a few minutes of Goose-flying we get the answer ''2.4048''
 +
 +
 +
  
  

Navigation