Ask Question, Ask an Expert

+61-413 786 465

info@mywordsolution.com

Ask Computer Engineering Expert

E19: Numerical Methods for Engineering Applications Spring 2016 - HOMEWORK 2

You will want to download and inspect the assignment.zip archive from the course website before answering these questions. Please submit a zipfile to the course Moodle page which contains a PDF writeup with answers to questions 1 and 2, and source code for question 3.

1. Associativity of addition

The hw2_sum.py program shows that adding two small lists of floating point numbers that differ only in their order may produce two different numerical results.

a. Why does this happen?

b. What does this imply about the associative property of floating point addition?

c. What other algebraic properties are similarly "funny" for floating point numbers? Give examples if you can.

2. Instability of numerical differentiation

Later in the course we will learn more about numerical approximations to the derivative. For now, it is sufficient to say that the derivative of some function f(x) can be well approximated by

f'(x) ≈ f(x+h) - f(x-h)/2h

for some small step size h.

The hw2_diff.py program illustrates this by repeatedly computing the first, second, third, etc. derivatives of sinpxq numerically, and comparing the computed value to the true function values of cos(x), -sin(x), -cos(x), etc.

A funny thing happens in the program - after just a few iterations, the answer seems to "blow up" with huge numerical errors.

a. What makes this happen? Is this a gradual process or a sudden one?

b. Explain why replacing np.float32 with np.float64 delays-but does not eliminate-the blowup.

c. Explain why the same is true for cutting down the step size h by a factor of 4.

3. Root finding

Modify the hw2_rootfinding.py code to perform the following tasks:

a. Complete the implementation of the Secant Method so the tests run correctly to find the roots of the example functions provided.

b. Ditto for Newton's method.

c. Add a test case in the functions list to define some function f(x) for which the Bisection method outperforms Regula Falsi (i.e. uses significantly fewer iterations). Add a comment in your program indicating why Bisection works better for this function.

d. Add a test case for which the Secant Method fails to converge, but Bisection search converges. Again, add a comment in your program indicating why this happens.

Attachment:- Assignment.zip

Computer Engineering, Engineering

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

Have any Question?


Related Questions in Computer Engineering

Why is a mixture of ethanol and water needed to perform a

Why is a mixture of ethanol and water needed to perform a reaction between oil and NaOH? This question is from a soap lab where we made soap from oils.

Display the manager of the employee with the oldest project

Display the manager of the employee with the oldest project start date (start_date). (This query requires 3 nested queries, start by finding the min start_date from project, then find the emp_id from project where start_ ...

Are us executives paid too much particularly compared to

Are U.S. Executives paid too much particularly compared to the average worker in their organization?

Develop a hypothesis that could explain why a soap created

Develop a hypothesis that could explain why a soap created from the acid CH 3 CH 2 CH 2 CH 2 COOH has poorer cleaning properties than soap made from palmitic acid. Develop a hypothesis that could explain why a soap creat ...

1 the reliability of a hard-disk drive is typically

1. The reliability of a hard-disk drive is typically described in terms of a quantity' called mean time between failures (MTBF). Although this quantity' is called a "time, " the MTBF actually is measured in drive-hours p ...

Question using a web browser search for any information

Question: Using a Web browser, search for any information security policies used at your academic institution. Compare them to the ones discussed in this chapter. Are there sections missing? If so, which ones? Whitman, M ...

Suppose there are three decks of cards on the table a

Suppose there are three decks of cards on the table, a number is written on each card. And each deck is sorted in decreasing order (The maximum value is on the deck in top). The goal is to find the minimum value between ...

Given a list of numbers l a value x is said to be a

Given a list of numbers L, a value x is said to be a majority value if the value of over half the elements in L is x; in other words, if L has n elements and nx is the number of elements in L with value x, then x is a ma ...

Would be being proposed transfer scheme answer the problems

Would be being proposed transfer scheme answer the problem/s seen in the implementation of the TRAIN law? Explain why or why not in light of the ongoing 4Ps etc. What are some other tax reform in Collas-Monsod's wish lis ...

Qestion what steps are involved for implementing sw s0 0

Question : What steps are involved for implementing sw $s0 , 0 ( $s1) instruction . Draw data path and control path for this instruction. The response must be typed, single spaced, must be in times new roman font (size 1 ...

  • 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