 Geometric mean and HP calculators - Printable Version +- HP Forums (https://archived.hpcalc.org/museumforum) +-- Forum: HP Museum Forums (https://archived.hpcalc.org/museumforum/forum-1.html) +--- Forum: Old HP Forum Archives (https://archived.hpcalc.org/museumforum/forum-2.html) +--- Thread: Geometric mean and HP calculators (/thread-103417.html) Geometric mean and HP calculators - mk - 11-30-2006 Can any HP calculators crunch a geometric mean for an easily editable list of numbers without requiring the entry of a separate program? Re: Geometric mean and HP calculators - Norris - 11-30-2006 I doubt that any HPs have a convenient "Geometric Mean" function. But you can get the desired result on the HP-48, and presumably on the more recent HP-49 and HP-50, through a series of steps: 1. Enter your raw data as a "list". Store the list for future editing if desired. 2. Hit LOG or LN to transform all of the values in the list. Now you have a second, log-transformed list. 3. Disassemble the log-transformed "list" and reassemble it as an "array". Save the array as "SigmaDAT", which is the reserved name for statistics data. 4. Hit MEAN to calculate the mean of the log-transformed data in the "SigmaDAT" array. 5. Hit the appropriate antilog (10^X or e^X) for the geometric mean. Probably you could write simple programs to automate this process. There may be other ways to do it. Edited: 30 Nov 2006, 2:12 p.m. after one or more responses were posted Re: Geometric mean and HP calculators - Norris - 11-30-2006 The following HP48 program seems to work for me: << LOG LIST-> 1 2 ->LIST ->ARRY STO-Sigma MEAN ALOG >> Enter and save your list of raw data (Step 1). Then put it on the stack, and run the program. It quickly executes Steps 2 to 5, and the result is the geometric mean. The only tricky part is converting the list to an array (Step 3). Edited: 30 Nov 2006, 1:57 p.m. Re: Geometric mean and HP calculators - Bern - 12-01-2006 Once you have the list of numbers, apply the pList function against the list and then get the n root to the function result. pList function - p is the greek pi character (alpha right shift P) 1. Put number in a list such as {13 22 17 19} 2. Apply pList function to your list. This will give you a multiplied sum - 92378 3. Get the root of the pList sum where the root value is the number of elements in the list - that is the 4th root of 92378 giving 17.43 as the geometric mean (put 4 on stack and use keys alpha right shift R) You can compare your calculator results here http://www.easycalculation.com/statistics/geometric-mean.php Edited: 1 Dec 2006, 7:47 a.m. Re: Geometric mean and HP calculators - Norris - 12-01-2006 That's more elegant than my approach. A few comments: - For Step 3, you could use the SIZE function to determine the number of elements in the list. - You are apparently not using an HP-48, because I have different keys for the "Pi" in the Pi-LIST command and for the XROOT function. - The product generated by Pi-LIST could conceivably generate an overflow error if the list was very large, and/or contained very large values Edited: 1 Dec 2006, 1:01 p.m. Re: Geometric mean and HP calculators - Katie Wasserman - 12-01-2006 How about using the statistics lists in the 27S/17B/17BII/17BII+/ etc. along with a small solver equation. This is a very easy list editor to use and the equation is fairly simple. Assuming the list is called GMEAN the equation would be something like: GMEAN: 0xL(X:1)+0xSIGMA(I:1:SIZES(GMEAN):1:L(X:G(X)xITEM(GMEAN:I)))+G(X)^INV(SIZES(GMEAN))=GMEAN To use this, just create a list in SUM and name it GMEAN. Edit it as needed and when you want to compute the geometric mean go into SOLVE, pick the 'GMEAN' equation and hit the GMEAN key. You could also use the cash flow lists and then you'd be able to use the number of occurrences as well with only a slightly more complicated solver equation. -Katie Re: Geometric mean and HP calculators - Bern - 12-01-2006 I'm using the 50g. Geometric mean is described in the 50g reference manual pg 8-15 but the result they show for the example is wrong (one of many errors in that book). The answer is 1.9307... not 1.0032..... Example reversed the root (took 720th root of 10 insteead of 10th root of 720). http://h20000.www2.hp.com/bizsupport/TechSupport/DocumentIndex.jsp?contentType=SupportManual&lang=en&cc=us&docIndexId=179111&taskId=101&prodTypeId=215348&prodSeriesId=3235173manual Re: Geometric mean and HP calculators - Palmer O. Hanson, Jr. - 12-01-2006 Quote: "That's more elegant than my approach." Not really. The approach which uses logarithms delays the onset of the overflow problems which are inherent in this kind of calculation. Re: Geometric mean and HP calculators - Bern - 12-02-2006 While using logs gives you much smaller numbers, getting an overflow with Pi-List is unlikely since overflow >= 10^500. Here's the program, assuming the list is on stack 1 << -> list << list Pi-LIST list SIZE XROOT >> >> where 'Pi-' is the mathematical pi character. Edited: 2 Dec 2006, 11:23 a.m.