Post Reply 
[VA] SRC#005- April, 1st Mean Minichallenge
04-01-2019, 10:30 PM
Post: #2
RE: [VA] SRC#005- April, 1st Mean Minichallenge
(04-01-2019 08:09 PM)Valentin Albillo Wrote:  sample dataset  4, 1, 20.19  your code should return:

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

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

find the value of k which makes  Mk = Pi.

Let x=k-2, we have (4x + 1x + 20.19x) / 3 = Pix

Let f(x) = 4x + 1 + 20.19x - 3 Pix

⇒ f'(x) = 4x ln(4) + 20.19x ln(20.19) - 3 Pix ln(Pi)

Use Newton's method to solve for x, x = x - f(x) / f'(x)

guess(x) = guess(k) - 2 = 1.5 - 2 = -0.5
-0.4479070869
-0.4457521188
-0.4457475673

⇒ k = x + 2 = 1.5542524327
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: [VA] SRC#005- April, 1st Mean Minichallenge - Albert Chan - 04-01-2019 10:30 PM



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