Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The geometric mean of n positive numbers x 1 , . . . , xn is given by n n i = 1 xi .

The geometric mean of n positive numbers x1,..., xn is given by
n
n
i=1
xi.
This quantity can be computed in a running fashion similar to a running sum, but
using multiplication instead, by computing the product of the values in the radical
using a running product. By doing this, you can easily produce geometric mean values
as new numbers are discovered.
geo_mean Function:
Input variables:
none
Keyboard inputs/screen outputs:
prompts the user 4 times for separate numbers and after each number
outputs the geometric mean of the numbers so far
Output variables:
a vector of the 4 numbers input
A possible sample case is:
>> nums = geo_mean()
Enter a number: 1
The geometric mean after 1 numbers is 1.000000.
Enter a number: 2
The geometric mean after 2 numbers is 1.414214.
Enter a number: 3
The geometric mean after 3 numbers is 1.817121.
Enter a number: 4
The geometric mean after 4 numbers is 2.213364.
nums =
1234
3

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Sql All In One For Dummies 7 Books In One

Authors: Allen G Taylor ,Richard Blum

4th Edition

1394242298, 978-1394242290

More Books

Students also viewed these Databases questions

Question

Calculate the wavelength of 35-GeV electrons.

Answered: 1 week ago

Question

Identify five strategies to prevent workplace bullying.

Answered: 1 week ago