Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Business Economics Expert

C Program Assignment:

Write an algorithm and program to compute and compute the square root (√). The calculation of the important mathematical constant e and the square root (√) will be done as the sum of an infinite series:

∞                ∞       

e = ∑ 1/n!      &   √S = ∑ xn+1 = 1/2(xn + S/xn)

n=0               n=0

where x0 is the initial "guess"

See https://en.wikipedia.org/wiki/E_(mathematical_constant) and 

https://en.wikipedia.org/wiki/Methods_of_computing_square_roots for details. Use only the Babylonian method for the square root (√).

Output: Output will include your computed value for e, the library expected value for e, the number of terms (iterations) it took to reach fifteen decimal-place accuracy, and the time (in nanoseconds) that it takes to compute the constant. Output will also include your computed value for the square root of a value input by the user, the expected value using sqrt(), the number of terms (iterations) it took to reach fifteen decimal-place accuracy, and the time (in nanoseconds) that it takes to compute the square root.

Each set of results above should be displayed so as to allow easy comparison of the computed and expected values. Labels should be included, where appropriate.

Input: Accept user input for the value for which the square root is sought. This number will be a real value, and for this assignment will be limited to a real value >= zero. Prompting and validation of the input is, of course, required.

Requirements:

Efficiency should always be considered. Alway choose the most appropriate loop/decision structures and variable/constant types. Functions should focus on a single task. Main() should be high-level tasks only.

The library should be used - see either text index or [K/R] pages 255-256 (Appendix B10) for more details. You may NOT use the math library functions sqrt() or exp() in your computations - directly or indirectly. Instead, use only the delta (difference) of your running computation to determine when to stop. No rounding is permitted.

Program must include (minimum) one function for each computation, in addition to the main program. Other functions developed (likely), as required. Test your program completely.

Business Economics, Economics

  • Category:- Business Economics
  • Reference No.:- M92477676
  • Price:- $30

Priced at Now at $30, Verified Solution

Have any Question?


Related Questions in Business Economics

A sample of 100 people is classified by gender malefemale

A sample of 100 people is classified by gender (male/female) and by whether they are registered voters. The sample consists of 80 females and 20 males, and has a total of 60 registered voters. If these data are used for ...

Draw supply and demand curve to illustrate the following

Draw supply and demand curve to illustrate the following sequences of events. Show changes in one graph. Assume upward sloping for supply curves and downward sloping for demand curves 1. In year 1, the rental apartment m ...

A is the event that your friend is sick today and b is the

A is the event that your friend is sick today and B is the event that you pass this test. These events are independent and Not mutually exclusive. Calculate the probability that your friend is sick todayy OR you pass thi ...

Determine whether the given value is a discrete or

Determine whether the given value is a discrete or continuous variable. People are asked to state how many times in the last month they visited their family doctor.

Define economies of scope is this concept related to

Define economies of scope. Is this concept related to economies of scale? Explain. Define economies of scale. How does this relate to returns to scale?

I need some help trying to understand this statistics

I need some help trying to understand this Statistics question For a normal distribution, identify the  z -score location that would separate the distribution into two sections, as determined by the following percentages ...

A company is considering producing a new product based on

A company is considering producing a new product. Based on past records, management believes that there is a 70 percent chance that the new product will be successful, and a 30 percent chance it will not be successful. M ...

In the summer of 2013 walt disney released the lone ranger

In the summer of 2013, Walt Disney released The Lone Ranger, starring Johnny Depp and produced by Jerry Bruckheimer. The film bombed at the box office: Worldwide, it earned about $245 million in revenue, well below the $ ...

An instrument is made up of 3 parts an upper part a middle

An instrument is made up of 3 parts: an upper part, a middle part and a lower part. the instrument is then assembled. 6% of the upper parts are defective, 3% of the middle parts are defective, and 2% of the lower parts a ...

In families with four children youre interested in the

In families with four children, you're interested in the probabilities for the different possible numbers of girls in a family. Using theoretical probability (assume girls and boys are equally likely), compile a five-col ...

  • 4,153,160 Questions Asked
  • 13,132 Experts
  • 2,558,936 Questions Answered

Ask Experts for help!!

Looking for Assignment Help?

Start excelling in your Courses, Get help with Assignment

Write us your full requirement for evaluation and you will receive response within 20 minutes turnaround time.

Ask Now Help with Problems, Get a Best Answer

Why might a bank avoid the use of interest rate swaps even

Why might a bank avoid the use of interest rate swaps, even when the institution is exposed to significant interest rate

Describe the difference between zero coupon bonds and

Describe the difference between zero coupon bonds and coupon bonds. Under what conditions will a coupon bond sell at a p

Compute the present value of an annuity of 880 per year

Compute the present value of an annuity of $ 880 per year for 16 years, given a discount rate of 6 percent per annum. As

Compute the present value of an 1150 payment made in ten

Compute the present value of an $1,150 payment made in ten years when the discount rate is 12 percent. (Do not round int

Compute the present value of an annuity of 699 per year

Compute the present value of an annuity of $ 699 per year for 19 years, given a discount rate of 6 percent per annum. As