Course Work 100

6
Vittor Ferreira Student ID - 802187 EGM07 - Optimisation and Reliability Coursework 1 Problem 1 Approximate the real root of x3 +5x–3=0 to four decimal places using the Newton-Raphson technique. Marks will be awarded for explanation as well as computational accuracy. Resolution: The Newton-Raphson method is an iterative process to approach with accuracy one root of a function. The root that is found depends on a arbitrary initial value of a x- value. So, the basic algorithm is to calculate the iteration below after choosing arbitrarily a x0 initial value. By choosing x0=0.5 We compute, And continuing the iterations we find the values below at the table 1 x n+1 = x n f ( x n ) f '( x n ) f (0.5) = 0.5 3 + 5(0.5) 3 = 0.3750 f '(0.5) = 3x 0.5 2 + 5 = 5.7500 x 1 = x 0 f ( x 0 ) f '( x 1 ) = 0.5 0.3750 5.7500 = 0.5652

description

coursework1

Transcript of Course Work 100

Page 1: Course Work 100

Vittor Ferreira!

Student ID - 802187!

EGM07 - Optimisation and Reliability!

Coursework 1!Problem 1!

Approximate the real root of!

x3 +5x–3=0!

to four decimal places using the Newton-Raphson technique. Marks will be

awarded for explanation as well as computational accuracy.!

Resolution:!

The Newton-Raphson method is an iterative process to approach with accuracy

one root of a function. The root that is found depends on a arbitrary initial value of a x-

value. So, the basic algorithm is to calculate the iteration below after choosing arbitrarily

a x0 initial value.!

!!By choosing x0=0.5!

We compute,!

!!!!

!And continuing the iterations we find the values below at the table!

!

1

xn+1 = xn −f (xn )f '(xn )

f (0.5) = 0.53 + 5(0.5)− 3= −0.3750

f '(0.5) = 3x0.52 + 5 = 5.7500

x1 = x0 −f (x0 )f '(x1)

= 0.5 − −0.37505.7500

= 0.5652

Page 2: Course Work 100

! ! ! ! Table 1: Newton-Raphson Values!

The iteration stops when the fourth decimal place of the last 2 results are equal.!

!Problem 2!

Consider the figure below. The cross-sectional area, A, of a gutter with equal

base and edge length of 2 units is given by:!

A = 4sinθ(1+cosθ)!

!Use the Dichotomous method to estimate the value of θ that maximises the

cross- sectional area, taking the initial interval for θ as [0, π/2], and the final accuracy ε =

0.2.!

Verify your answer using an independent method.!

Resolution:!

The Dichotomous method is used to find the minimum or maximum of a function.

It consists of establishing an initial interval and a mid point of this interval, evaluatig the

1

n y(x) y`(x) x x

0 -0.3750 5.7500 0.5000 0.5652

1 0.0067 5.9584 0.5652 0.5641

2 0.0000 5.9546 0.5641 0.5641

Page 3: Course Work 100

function in points of this interval and keep reducing this interval progressively until a suf-

ficiently small range is obtained.!

The algorithm is:!

1- Define the interval [a,b]!

2- Define the accuracy ɛ!

3- Calculate !

!!!4- Compute f(x1) and f(x2)!

5- If f(x1)>f(x2), then the new interval is [a,x2]!

6- If f(x1)<f(x2), then the new interval is [x1,b]!

7- Repeat steps 3 to 6 until your interval is smaller than ɛ!

So, we define!

!!!and calculate!

!!!!following we compute!

!!

1

x1 =a + b2

− ε2

x2 =a + b2

+ ε2

x1 =0 +1.5708

2− 0.22

= 0.6854

x2 =0 +1.5708

2+ 0.22

= 0.8854

f (x1) = 4sin(0)(1+ cos(0)) = 4.4921f (x2 ) = 4sin(1.5708)(1+ cos(1.5708)) = 5.0568

a = 0

b = π2= 1.5708

ε = 0.2

Page 4: Course Work 100

f(x1)<f(x2), so the new interval is [0.6854,1.5708]!

To compute the range of the interval there is a formula:!

!!!Where Io is the range of the initial interval (a — b) and k is the number of the iter-

ation, so for the first iteration, k=0.!

Then continuing the iterations we find the values showed in the table below!

Table 2: Results for Dichotomous method!

!Using the Golden Search Method:!

The Golden Search Method is used to fin the maximum and minimum of functions

as well as the Dichotomous method.!

This method uses the golden ratio K=1.618034 to calculate the intervals of itera-

tions along the algorithm.!

The algorithm is:!

1- Determine a1, b1 and ɛ!

2- Assign I1= b1 — a1, K=1.618034!

3-Compute!

!!

1

Ik =12

⎛⎝⎜

⎞⎠⎟k

I0

k a b x x A(x A(x Ik

0 0 1.5708 0.6854 0.8854 4.4921 5.0568 1.5708

1 0.6854 1.5708 1.0281 1.2281 5.1942 5.0334 0.4427

2 0.6854 1.2281 0.8567 1.0567 5.0025 5.1957 0.1357

I2 =I1K

⎛⎝⎜

⎞⎠⎟

xa,1 = b1 − I2xb,1 = a1 + I2

Page 5: Course Work 100

4- Compute !

!5- If f(xa)≥f(xb) then,!

!!!!!6- If f(xa)≤f(xb) then,!

!!!!!7- Repeat steps 4 to 6 until Ik+2 is less than the accuracy ɛ!

So we determine !

!!!!And compute!

!!!!

1

Ik+2 =Ik+1K

⎛⎝⎜

⎞⎠⎟

ak+1 = akbk+1 = xb,kxa,k+1 = bk+1 − Ik+2xb,k+1 = xa,k

a1 = 0

b1 =π2= 1.5708

ε = 0.2I1 = 1.5708 − 0 = 1.5708K = 1.618034

I2 =I1K

⎛⎝⎜

⎞⎠⎟ =

1.57081.618304

⎛⎝⎜

⎞⎠⎟ = 0.9708

xa,1 = b1 − I2 = 1.5708 − 0.9708 = 0.6xb,1 = a1 + I2 = 0.9708

Ik+2 = I3 =I2K

⎛⎝⎜

⎞⎠⎟ =

0.97081.618304

= 0.6

ak+1 = xa,kbk+1 = bkxa,k+1 = xb,kxb,k+1 = ak+1 + Ik+2

Page 6: Course Work 100

Evaluating the function at xa,1 and xb,1!

!!!note that now f(x) is multiplied by -1 because the algorithm is based on finding the

minimum, so to find the maximum just multiplies the original function by -1 and apply the

rules normally.!

So, f(xa,1)>f(xb,1) then,!

!!!!!Continuing the iterations until Ik+2 reach some value less than 0.2 we found the

results in the table below!

Table 3: Results of Golden Search Method

1

f (xa,1) = (−1)4sin(0.6)(1+ cos(0.6)) = −4.1226f (xb,1) = (−1)4sin(0.9708)(1+ cos(0.9708)) = −5.1654

a2 = xa,1 = 0.6b2 = b1 = 1.5708xa,2 = xb,1 = 0.9708xb,2 = a2 + I3 = 0.6 + 0.6 = 1.2

n k a b Ik x x A(x A(x

0 1 0 1.5708 1.5708 0.6000 0.9708 -4.1226 -5.1654

1 2 0.6000 1.5708 0.9708 0.9708 1.2000 -5.1654 -5.0791

2 3 0.6000 1.2000 0.6000 0.8292 0.9708 -4.9418 -5.1654

3 4 0.8292 1.2000 0.3708 0.9708 1.0583 -5.1654 -5.1955

4 5 0.9708 1.2000 0.2292 1.0583 1.1124 -5.1955 -5.1743

5 6 0.9708 1.1124 0.1416 - - - -