[VA] SRC#005- April, 1st Mean Minichallenge
04-01-2019, 08:09 PM
Post: #1
 Valentin Albillo Senior Member Posts: 408 Joined: Feb 2015
[VA] SRC#005- April, 1st Mean Minichallenge

Hi all, welcome to my meaningless but well-meaning  SRC#005 - April, 1st  Mean Minichallenge.

Given a set of data consisting of positive real numbers  x1, x2, ..., xn,  consider these four well-known means Mk for k = 1, 2, 3, 4:

M1 = the Harmonic Mean = $$\frac{n}{\frac{1}{x_1} + \frac{1}{x_2} + ... + \frac{1}{x_n}}$$

M2 = the Geometric Mean = $$\sqrt[n]{ x_1 x_2 ... x_n}$$

M3 = the Arithmetic Mean = $$\frac{x_1 + x_2 + ... + x_n}{n}$$

M4 = the Quadratic Mean = $$\sqrt{\frac{{x_1}^2 + {x_2}^2 + ... + {x_n}^2}{n}}$$

The Minichallenge:

Write code that accepts as input a dataset and the parameter k and returns the value of the corresponding mean Mk. For instance, for the sample dataset  4, 1, 20.19  your code should return:

k = 1:   M1 = 2.3085
... (Harmonic mean)

k = 2:   M2 = 4.3224
... (Geometric mean)

k = 3:   M3 = 8.3966
... (Arithmetic mean)

k = 4:   M4 = 11.8972

Now, with the same sample dataset, use your code to return the values of the means  M5/2 , MPi , M-2.019  and  M0.61. Also, find the value of k which makes  Mk = Pi.

In a day or so I'll post my original solution which is a 3-line (138 bytes) subprogram for the HP-71B, but in the meantime see what you can do with any HP calc (not Excel, Python, etc.) of your choice and please post both code and results, not just math expressions or text explanations and such. Enjoy !

V.

Find All My HP-related Materials here:  Valentin Albillo's HP Collection

 « Next Oldest | Next Newest »

 Messages In This Thread [VA] SRC#005- April, 1st Mean Minichallenge - Valentin Albillo - 04-01-2019 08:09 PM RE: [VA] SRC#005- April, 1st Mean Minichallenge - Albert Chan - 04-01-2019, 10:30 PM RE: [VA] SRC#005- April, 1st Mean Minichallenge - Albert Chan - 04-02-2019, 02:18 PM RE: [VA] SRC#005- April, 1st Mean Minichallenge - Valentin Albillo - 04-03-2019, 11:56 PM RE: [VA] SRC#005- April, 1st Mean Minichallenge - Maximilian Hohmann - 04-06-2019, 11:41 AM RE: [VA] SRC#005- April, 1st Mean Minichallenge - Valentin Albillo - 04-06-2019, 10:34 PM RE: [VA] SRC#005- April, 1st Mean Minichallenge - Albert Chan - 04-07-2019, 12:01 AM RE: [VA] SRC#005- April, 1st Mean Minichallenge - Valentin Albillo - 04-10-2019, 12:10 AM RE: [VA] SRC#005- April, 1st Mean Minichallenge - Maximilian Hohmann - 04-07-2019, 12:45 PM RE: [VA] SRC#005- April, 1st Mean Minichallenge - rprosperi - 04-07-2019, 01:21 PM RE: [VA] SRC#005- April, 1st Mean Minichallenge - Maximilian Hohmann - 04-07-2019, 06:03 PM RE: [VA] SRC#005- April, 1st Mean Minichallenge - Valentin Albillo - 04-10-2019, 09:54 PM RE: [VA] SRC#005- April, 1st Mean Minichallenge - Maximilian Hohmann - 04-11-2019, 02:13 PM RE: [VA] SRC#005- April, 1st Mean Minichallenge - Valentin Albillo - 04-11-2019, 11:56 PM RE: [VA] SRC#005- April, 1st Mean Minichallenge - Maximilian Hohmann - 04-12-2019, 12:27 PM RE: [VA] SRC#005- April, 1st Mean Minichallenge - Thomas Okken - 04-12-2019, 02:14 PM RE: [VA] SRC#005- April, 1st Mean Minichallenge - John Keith - 04-10-2019, 04:23 PM RE: [VA] SRC#005- April, 1st Mean Minichallenge - Bernd Grubert - 04-12-2019, 09:54 PM RE: [VA] SRC#005- April, 1st Mean Minichallenge - Valentin Albillo - 04-13-2019, 12:08 AM RE: [VA] SRC#005- April, 1st Mean Minichallenge - Ángel Martin - 04-13-2019, 05:31 AM RE: [VA] SRC#005- April, 1st Mean Minichallenge - Bernd Grubert - 04-13-2019, 11:33 AM RE: [VA] SRC#005- April, 1st Mean Minichallenge - Mike (Austria) - 04-15-2019, 09:29 PM RE: [VA] SRC#005- April, 1st Mean Minichallenge - Mike (Austria) - 04-16-2019, 07:23 PM RE: [VA] SRC#005- April, 1st Mean Minichallenge - Valentin Albillo - 04-21-2019, 08:38 PM RE: [VA] SRC#005- April, 1st Mean Minichallenge - Mike (Austria) - 04-24-2019, 08:54 PM RE: [VA] SRC#005- April, 1st Mean Minichallenge - RMollov - 04-22-2019, 02:02 PM RE: [VA] SRC#005- April, 1st Mean Minichallenge - Mike (Austria) - 04-24-2019, 06:54 PM RE: [VA] SRC#005- April, 1st Mean Minichallenge - RMollov - 04-25-2019, 12:05 PM

User(s) browsing this thread: 1 Guest(s)