Tutorial 2

Post on 01-Nov-2014

72 views 7 download

Tags:

Transcript of Tutorial 2

Shan Fengfengs2@mcmaster.ca

Determine the real roots of f(x)=-0.5x2+2.5x+4.5

1) Graphically2) Using the quadratic formula3) Using three iterations of the bisection

method to determine the highest root. Employ initial guesses of xl=5 and xu=1. Compute the estimated error and the true error after each iteration.

1) A plot indicates that roots occur at about x = –1.4 and 6.4.

Quadratic formula

First iteration:

Third iteration

Determine the real root of f(x)=-26+85x-91x2+44x3-8x4+x5

1) Graphically2) Using bisection to determine the root to εs=10%. Employ initial guesses of xl=0.5 and xu=1.0

3) Perform the same computation as in (2) but use the false-position method and εs=0.2%

A plot indicates that a single real root occurs at about x = 0.58.

Bisection:First iteration

The process can be repeated until the approximate error falls below 10%. As summarized below, this occurs after 4 iterations yielding a root estimate of 0.59375.

False position:First iteration:

Second iteration:

The process can be repeated until the approximate error falls below 0.2%. As summarized below, this occurs after 4 iterations yielding a root estimate of 0.57956.

Determine the highest real root off(x)=2x3-11.7x2+17.7x-5

1) Graphically2) Newton-Raphson method (three iterations,

x0 =3)3) Secant method (three iterations, x-

1=3,x0=4)

Graphical

Newton-Raphson

Secant

Employ the Newton-Raphson method to determine a real root for f(x)=-2+6x-4x2+0.5x3

using initial guesses of 1) 4.522) 4.54

Discuss and use graphical and analytical methods to explain any peculiarities in your results

The Newton-Raphson method can be set up as

Using an initial guess of 4.52, this formula jumps around and eventually converges on the root at 0.214333 after 21 iterations:

The reason for the behavior is depicted in the following plot. As can be seen, the guess of x = 4.52 corresponds to a near-zero negative slope of the function. Hence, the first iteration shoots to a large negative value that is far from a root.

Using an initial guess of 4.54, this formula jumps around and eventually converges on the root at 6.305898 after 14 iterations:

The reason for the behavior is depicted in the following plot. As can be seen, the guess of x = 4.54 corresponds to a near-zero positive slope. Hence, the first iteration shoots to a large positive value that is far from a root.

Thanks~