Blog 21st Oct 2024 - Solving Ohms Law on the DM42n Further down, I've written a SOLVER function example for a DM41x calculator. We used this function to find the root of a single variable equation Ln(x)+10x-14.844=0. A SOLVER function wasn't included on the original HP41 machine (you needed to add a math pack expansion ROM to get the function onboard). Same was true with the DM41x but that calculator is already equipped with the math pack ROM image in memory and so installation is trivial. A Solver function was however built into the original HP42 and also the Free42 version running on the DM42n - a simple example of its use is to solve for any value in a DC electrical circuit for Voltage (V), Current (I) and Resistance (R).
In any simple DC circuit - we have three varying values of voltage, current and resistance. Using ohms law, we can find any one value so long as we know the other two. Normally a young engineer will rote learn that V=IR, I=V/R and R=V/I so there's no huge mystery in how to do this. But the solver can do the same thing albeit iteratively and the process to build this nicely illustrates how it works and how it can be used for more difficult problems. We'll build a solution to this next on the DM42n.
Simple DC electrical Circuit
Remember the process here. The calculators SOLVER function uses a Newton–Raphson iterative algorithm to hone in on a solution - but the actual problem itself is coded in a program written by the user. SOLVER calls the users program and using its iterative algorithm attempts to converge on a solution that balances the equation. So the user starts by building a program and then telling SOLVER to use that named program. Our first task in this case will be to build a basic ohms law program but phrased in an f(x)=0 way. Take for example V=IR which can be rearranged to suit the SOLVER function as V-IR=0.
DM42n Ohms Law Program
On the DM42n, create space for a new program (SHIFT GTO..), flip into programming mode (SHIFT PRGM) and enter the following function. Note what it is doing. We use the MVAR functions to define the three variables V,I and R. After that the algorithm recalls each value and computes ohms law (ie: V-IR) but expressed in an f(x)=0 form. When ready, flip the calculator back into normal mode (SHIFT PRGM).
Before we use the SOLVER let's prepare some test values. Assume our simple DC circuit consists of a 12v battery and a 4K7 resistor. What is the current? As I=V/R, we can calculate the current as 2.5532mA. Now let's use the SOLVER to figure out if this works. It'll help to set the display mode (SHIFT DISP) to ENG(ineering) and set to 4 places. Invoke the SOLVER (using shift SOLVER). Note that the screen demands "Select Solve Program" and on the soft key display, shows the available options - which includes our "OHMS" program. Click the "OHMS" option. The display will now change to show the variables in our program, namely V, I and R. Based on our example above lets assume we know the voltage (12v) and the current (2.5532mA) so what is the resistance? Enter the number 12 and hit the softkey for "V" (left hand screen image below). Then enter 2.5532E-3 and hit the softkey for "I" (middle image below). Then have the SOLVER find the resistance R by pressing the softkey for "R". The SOLVER algorithm will determine it is 4.7E3 and return that in the X register - so SOLVER has now computed the one unknown resistance value, given the two knowns of current and voltage. Screenshots of the DM42n SOLVER being used Equally well, you could enter 4K7 as the resistance and press the "R" softkey. Then 12 as the voltage and press the "V" softkey - and finally have SOLVER find the current by pressing the I softkey. Screenshots of the DM42n SOLVER being used The arrangement is flexible and intuitive, taking advantage of the original HP42s MVAR input gathering system. Comment | Back to Quick Links...