Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

E19: Numerical Methods for Engineering Applications Spring 2016 - PROJECT 1

Project: Estimating π-

OVERVIEW

In this project, you will strengthen your programming skills and investigate issues of accuracy and iterative refinement by implementing several simple numerical methods to estimate the constant π.

TASKS

Integration via Riemann Sums. Implement a function intpi(n) that estimates π by computing the integral

π = 401√(1-x2) dx

The integral should be approximated using the following formula:

01f(x) dx ≈ Δx i=0n-1f(xi)

where ?x = 1/n and xi = ?x · i.

Report the output of your function for n = 128, 256, 512, 1024, 2048, and 4096. Also report the true relative error (relative to the constant numpy.pi), as well as approximate relative error given the current estimate and previous estimate (for each value of n after the first one).

Taylor Series. The Maclaurin series (that is, the Taylor series expansion about zero) of the inverse tangent function is given by

Arctan(x) = x - x3/3 + x5/5 - x7/7 + x9/9 · · ·

Using the fact that

π = 4 arctan(1)

implement a function tspi1(n) that estimates π using the first n terms of the Maclaurin series above. Output the estimates for n = 1 through 20. For each estimate, have your program output the approximate relative error given the current and previous estimates, and the true relative error given the actual value of π.

It turns out that a superior method (discovered in 1706 by John Machin1) instead computes

π = 16 arctan (1/5) - 4 arctan (1/239)

Implement another function tspi2(n) that estimates π using the first n terms of the Maclaurin series given the Machin formula. Again, record your program's output for n = 1 through 20 with approximate and true relative errors.

WHAT TO TURN IN

You should submit a zip file containing all of your programs' source code, and a short PDF writeup containing the output of your program and which addresses these points:

  • Describe your approach to implementing each algorithm (about 1-2 paragraphs each).
  • Plot the true error versus the step size ?x for the Riemann sum implementation. Please use a log-log plot.
  • Comment on why the Machin formula is more accurate than the initial formula which computes arctan(1), in terms of Taylor series and truncation error.

Computer Engineering, Engineering

  • Category:- Computer Engineering
  • Reference No.:- M91844301

Have any Question?


Related Questions in Computer Engineering

Students will create an application that allows the user to

Students will create an application that allows the user to create entities with a dialog window that will be displayed by a ListView in a separate dialog. The main dialog will keep track of how many windows and entities ...

Companies persue closer coordination and collaboration with

Companies persue closer coordination and collaboration with channel suppliers to better address customer needs inorder to 1) Develop human resource management activities that improve the skills , expertise and knowledge ...

Question as a junior congress person you have been asked to

Question: As a junior congress person you have been asked to help promote a bill to allow casino gambling in your state. There is much opposition to this bill. Using distributive bargaining, discuss the pros and cons whi ...

Question unless otherwise stated answer in complete

Question: Unless otherwise stated, answer in complete sentences, and be sure to use correct English spelling and grammar. Sources must be cited in APA format. Your response should be four (4) pages in length; refer to th ...

How do you calculate the annual interest rate of 12

How do you calculate the annual interest rate of 12% compounded monthly. I know how to do for annually but not monthly. You are offered the opportunity to put some money away for retirement. You will receive 10 annual pa ...

A marketing research firm was hired to estimate the mean

A Marketing Research firm was hired to estimate the mean prime-lending rate for banks located in the western region of the United States. A random sample of n = 50 banks was selected from within the region, and the prime ...

What are information silos what are the problems caused by

What are information silos? What are the problems caused by information silos? How organizations can solve the problems caused by information silos?

A 1000 utility bond with 14 years remaining before maturity

A $1000 utility bond with 14 years remaining before maturity can now be purchased for $760. It pays interest of $20 each 6-month period. What rate of return is earned by purchasing the bond at the current market price pl ...

Mccann co has identified an investment project with the

McCann Co. has identified an investment project with the following cash flows. Year Cash Flow  1   $800  2    1,090 3    1,350 4    1,475 a. If the discount rate is 7 percent, what is the present value of these cash flow ...

You are required to design a circuit that takes as input a

You are required to design a circuit that takes as input a serial bit and outputs a '1' whenever there are three successive '1's, i.e., whenever the sequences 111 or 000 occur. Overlaps must be considered Also, assume th ...

  • 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