HP Forums
More Accurate Parallel Resistance - Printable Version

+- HP Forums (https://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: HP Prime Software Library (/forum-15.html)
+--- Thread: More Accurate Parallel Resistance (/thread-522.html)



More Accurate Parallel Resistance - Joe Horn - 01-26-2014 10:33 AM

A program was recently posted which calculates the total resistance of multiple resistors connected in parallel. Unfortunately it uses the standard definition of the reciprocal of the sum of the reciprocals. That definition often leads to roundoff errors accumulating. For example, the total resistance of a 10 ohm resistor and a 15 ohm resistor conntected in parallel is exactly 6 ohms, but all 12-digit HP calculators (in standard display mode) get 5.99999999999 for 1/(1/10+1/15) because of accumulated roundoff errors.

Here's a more accurate parallel resistance program, called "Pres". It avoids catastrophic accumulation of roundoff errors in all but pathological cases (e.g. many large numbers). It's so simple that it can be entered as a user function.

Press the Shift Define key. Type Pres in the Name field, and the following in the Function field:

Code:
ΠLIST(L)/ΣLIST(ΠLIST(L)/L)

To use it, type Pres({list of two or more resistances}). Example: Pres({10,15}) --> 6.

Note #1: Search comp.sys.hp48 for a thorough discussion of various methods of finding parallel resistance accurately, such as this one. Roger Rosenbaum and John Meyers shared many insights and discoveries about it over the years. Many pathological examples are also given, showcasing the strengths and weaknesses of each method. The standard definition is the worst.

Note #2: Since Prime's CAS performs exact math on integers and ratios of integers, a CAS program would always get the exact answer, even for many huge inputs, if they were all integers or ratios of integers. The above user function is only accurate to 12 digits.


RE: "Pres": More Accurate Parallel Resistance - Steve Simpkin - 01-26-2014 11:46 AM

Thank you, Joe. That "catastrophic accumulation of roundoff errors" issue while calculating parallel resistance values has been keeping me up at night lately Smile


RE: "Pres": More Accurate Parallel Resistance - Joe Horn - 01-27-2014 07:31 AM

(01-26-2014 11:46 AM)Steve Simpkin Wrote:  Thank you, Joe. That "catastrophic accumulation of roundoff errors" issue while calculating parallel resistance values has been keeping me up at night lately Smile

Exactly! Being off by 0.00000000001 ohms makes space shuttles explode! >:-O

More seriously, I was hugely impressed as a youngster at the lengths HP went to in search of excellence and accuracy in their calculators, even worrying about errors in the last digit. And in this case it's very easy to be more accurate, so why not. Even when excellence is not necessary, it's still a fun challenge.


RE: "Pres": More Accurate Parallel Resistance - René Franquinet - 09-01-2014 10:20 AM

Gentlemen, call me stupid, but how can I type in a line like
ΠLIST(L)/ΣLIST(ΠLIST(L)/L) ?
Look up the Pi and Sigma symbols via the Chars key or is there a more direct way?


RE: "Pres": More Accurate Parallel Resistance - Didier Lachieze - 09-01-2014 10:50 AM

(09-01-2014 10:20 AM)René Franquinet Wrote:  Gentlemen, call me stupid, but how can I type in a line like
ΠLIST(L)/ΣLIST(ΠLIST(L)/L) ?
Look up the Pi and Sigma symbols via the Chars key or is there a more direct way?

Toolbox Key, Math, List, items 8 & 9:
[Image: Math_List.png?psid=1]


RE: "Pres": More Accurate Parallel Resistance - René Franquinet - 09-01-2014 02:56 PM

Indeed, this is the more direct way. Couldn't find it in the manual.
Thank you very much, Didier.


RE: "Pres": More Accurate Parallel Resistance - BERNARD MICHAUD - 01-12-2017 11:56 PM

A simple small programs for for those interested, using Joe's formula above which can calculate Series or Parallel Impedances. The program prompts you to enter several resistance and/or impedance values except '0' of course in the List L1 which you usually get by <Shift 7>, and press Enter.

Code:
//Program Name SerParImp or your choice.
EXPORT Series()
BEGIN
L1:=0;//Clears values in L1
MSGBOX("  Enter your impedances
        in the List L1
         Press Enter");
EDITLIST(L1);//Prompts to enter values in the list
PRINT();
PRINT("





       Total Series Impedance = "+ΣLIST(L1));//Calculate and display result.
END;

EXPORT Parallel()
BEGIN
L1:=0;
MSGBOX("  Enter your impedances
        in the List L1
         Press Enter");
EDITLIST(L1);
PRINT();
PRINT("





    Total Paralllel Impedance = "+ΠLIST(L1)/ΣLIST(ΠLIST(L1)/L1));
END;

BM