University of Florida/Egm6341/s10.team2.niki/HW3

From testwiki
Jump to navigation Jump to search

Problem Statement

Pg. 17-2

See also HW1-problem 8[[1]] Using the error estimates of

  • Taylor Series
  • Composite Trapezoidal rule
  • Composite Simpson's rule

estimate 𝒏 such that 𝑬𝒏=𝑰𝑰𝒏=𝑢(106)

Problem Solution

Solution: Taylor series

Error is defined as

En=IIn=ab[f(x)fn(x)]dx

For the Taylor series, from the discussion on p6-4, we know that the error is nothing but the remainder of the Taylor series integrated over the given interval i.e

abRn+1(x)=ab[(xx0)n+1(n+1)!f(n+1)(ξ)] where ξε[a,b]

(1 p2-3)

For the given function the error is

En=01xn(n+1)!w(x)eξ(x)g(x)dx

(2)

Using the Integral Mean Value Theorem, we have

En=eξ(x=α)01xn(n+1)!dx

(3)

integrating we get,

En=eξ(x=α)1(n+1)!(n+1)

(4)

This function has a minimum when α=0 and maximum when α=1 thus we have

1(n+1)!(n+1)Ene(n+1)!(n+1)

(5)

Setting the upper bound of the error to 106 we have

 Ene(n+1)!(n+1)=106

(6)

Solving this equation for n we get

(n+1)!(n+1)=e*106n7.92=7

(A)

Solution:Composite Trapezoidal rule

From the discussion on page 16-3 we have

|En1|(ba)12n2M2

(1)

where M2=max|f(2)(ζ)| for ζε[a,b]

For the given function f(x)=ex1x, we have

f(2)(x)=ex[x22x+2]2x3

(2)

Evaluating over the given interval it is seen that the function f(2)(x) has maximum value at x=1

M2=f(2)(x=1)=e[1+22]21=0.718282

(3)

Setting the error to the 106 and solving for n we get

(10)312n2(0.718282)=106n244.657=245

(B)

Solution :Composite Simpson's Rule

We have from p 17-2, the error estimate of the Composite Simpson's rule as

|En2|(ba)52880n4M4

(1)

where M4=max|f(4)(ζ)| for ζε[a,b]

For the given function f(x)=ex1x, we have

f(4)(x)=ex[x44x3+12x224x]24x5

(2)

Evaluating over the given interval it is seen that the function f(2)(x) has maximum value at x=1

M4=f(4)(x=1)=e[14+1224+24]241=9(e)24=0.464536

(3)

Setting the error to the 106 and solving for n we get

(10)52880n4(0.464536)=106n3.35735=3

(c)

Part 2:Numerical determination of power of h

In order to verify the power of 𝒉 in the error, data from Problem 8 of HW1 is used.

In the case of a Semilog plot (log(y) vs x), an equation of the form

π’π’π’ˆ(𝒀)=𝒂𝑿+𝒃

such that

𝒀=𝒆(𝒂𝑿+𝒃)=𝒆𝒃(𝒆𝒂𝑿)=π’Œπ’†π’‚π‘Ώ

From the above equation it is seen that if the plot on a semilog graph is a straight line then the relationship between the two variables is exponential.

A log-log plot(log(y) vs log(x)) is a similar plot, for which the equation is of the form

π’π’π’ˆ(𝒀)=𝒂[π’π’π’ˆ(𝑿)]+𝒃

such that, 𝒀=π’Œπ’™π’‚;π’Œ=𝒆𝒃

This discussion is used in the interpretation of the graphs given below.

It is readily seen that the slope of the line in the log-log graph is the power of the x variable.

Composite trapezoidal Rule

Given below is the data from the numerical evaluation of the given function using Composite Trapezoidal Rule.

Template:Center topComposite Trapezoidal RuleTemplate:Center bottom

No. of terms (𝒏)

Absolute Error (|En1|)

𝒉

2

1.3282917278

0.5

4

1.3205046195

0.25

8

1.3185530869

0.125

16

1.3180649052

0.0625

32

1.3179428411

0.03125

64

1.3179123240

0.015625

128

1.3179046946

0.0078125

256

1.3179027872

0.00390625

512

1.3179023104

0.001953125

1024

1.3179021912

0.000976563

First we plot a semilog graph for the data. The graph is shown below:

File:Niki-trap-semilog.png

The graph is not a straight line which implies that the relationship between 𝒉 and π’π’π’ˆ(𝒆𝒓𝒓𝒐𝒓) is not exponential. Hence we plot a log-log graph as below:

File:Niki-trap-log.png

This is seen to be linear. A straight line if fitted to the data the equation of which is given above. From the discussion above, we see that the slope of line is 2.1447 which is very close to the analytical value of 2.

Composite Simpson's Rule

Given below is the data obtained from HW1 for the COmposite Simpsons Rule.

Template:Center topComposite Simpson's RuleTemplate:Center bottom

No. of terms (𝒏)

Absolute Error (|En2|)

𝒉

2

1.318008666

0.5

4

1.317908917

0.25

8

1.317902576

0.125

16

1.317902178

0.0625

Plotting a semilog graph of π’π’π’ˆ(𝒆𝒓𝒓𝒐𝒓) against 𝒉 we see that it is non-linear as in the case of the Composite Trapezoidal Rule.

File:Niki-CSR-semilog.png

Thus, plotting the log-log graph as below,

File:Niki-CSR-log.png

we see that the slope of the line is 4.0881 which is very close to the analytically determined value of 4.

Taylor Series

Given below is the data for the Taylor series method. Eventhough 𝒉 is not used in the Taylor series method,defining 𝒉 based on the number of terms of the series, it is seen that the error and h are not related exponentially or by a power relation i.e. both semilog and log log plots are not linear.

Template:Center topTaylor SeriesTemplate:Center bottom

No. of terms (𝒏)

Absolute Error (|En2|)

𝒉

2

1.2500000

0.5

4

1.3159722222

0.25

8

1.3179018152

0.125

16

1.3179021515

0.0625

32

1.3179021515

0.03125

--Egm6341.s10.team2.niki 08:10, 17 February 2010 (UTC)