0% found this document useful (0 votes)
53 views

Answers 9

The document discusses using numerical integration methods like the trapezoidal rule and Simpson's rule to approximate definite integrals over various functions. It provides the results of applying these methods to specific examples and compares the approximate results to exact values.

Uploaded by

Roy Vesey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
53 views

Answers 9

The document discusses using numerical integration methods like the trapezoidal rule and Simpson's rule to approximate definite integrals over various functions. It provides the results of applying these methods to specific examples and compares the approximate results to exact values.

Uploaded by

Roy Vesey
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 6

Mathematical Methods Spring Term 2015

Answer to Problem Sheet 9

1. See appended printouts generated using Wolfram alpha.

2. i) !
⇡ sin 1 ⇡ sin 1 ⇡ sin 3 ⇡
I⇡ 1+4 1 4 +2 1 2 +4 3 4 +0
12 4
⇡ 2
⇡ 4

p p ! p
⇡ 8 2 4 8 2 ⇡ 1 8 2
= 1+ + + = + + ⇡ 1.852.
12 ⇡ ⇡ 3⇡ 12 3 9
ii) See appended printouts generated using Wolfram alpha.

3. Show graphically that the equation e x = ln x has a solution with


1 < x < 2. Hence solve the equation to 4 decimal places by the
Newton-Raphson method.
x
Let f (x) = e ln x. Graph of function:

From the graph this has a root close to 1.3.

f (xn ) e xn ln xn
xn+1 = xn = xn =
f 0 (xn ) e xn + 1/xn

Set x0 = 1.3. x1 = 1.3098. It is not necessary to proceed to x2 unless


higher accuracy is required.

4. Show graphically that the equation e x = 2x2 + 12 has three solutions


which lie between 3 and 1. Solve the equation to 2 decimal places by
the
x 1
Let f (x) = e 2x2 2
: Graph of function:
Graph has roots near x = 2.8, 1.1, 0.3

1
Newton-Raphson method

f (xn ) e xn
2x2n 12
xn+1 = xn = xn .
f 0 (xn ) e xn 4xn

Applying one iteration to each of the three ‘guesses’ in turn gives -2.746,
-1.160, 0.331.

5. Use the simple Runge-Kutta process


h
yn+1 = yn + (k1 + k2 ), k1 = f (xn , yn ), k2 = f (xn+1 , yn + hk1 )
2
to find y(1) for the equation

dy
= f (x, y) = y
dx
subject to y(0) = 1, choosing h = 0.5. Compare your answer with the
exact solution. Repeat the calculation with h = 0.25. Work to three
decimal places.
k1 = yn , k2 = yn + hk1 = (1 + h)yn .

h 1
yn+1 = yn + (k1 + k2 ) = yn (1 + h + h2 ).
2 2
13
h = 0.5. yn+1 = 8 n
y . y2 = 169 y =
64 0
2.640.
41 41 4
h = 0.25, yn+1 = 32 yn , y4 = ( 32 ) y0 = 2.695
x
Exact result y(x) = e . y(0) = e = 2.718...

6. Use Runga-Kutta to find y(0.2) for the equation

dy
= f (x, y) = 10x2 + y
dx
2
subject to y(0) = 2, choosing the interval h = 0.1. Work to 4 decimal
places. Compare your answer with the exact solution.
k1 = 10x2n + yn = 10h2 n2 + yn , k2 = 10h2 x2n+1 + yn + hk1 = 10h2 (n +
1)2 + yn + hk1
h
yn+1 = yn + (k1 + k2 )
2
y0 = 2
1 1 1
y1 = 2 + 20 (k1 + k2 ) with k1 = 2, k2 = 10
+2+ 10
· 2 = 2.3 so that
1
y1 = 2 + 20 (2 + 2.3) = 2.215
1 1 1
y2 = 2.215+ 20 (k1 +k2 ) with k1 = 10 +y1 = 2.315, k2 = 0.4+y1 + 10 k1 =
1
0.4 + 2.215 + 0.2315 = 2.8465 so that y2 = 2.215 + 20 (2.315 + 2.8465) =
2.473.
Exact solution y(x) = 22ex 10(x2 + 2x + 2) so that y(0.2) = 2.471.

7. i) Solve the following set of equations by Gaussian elimination

x + 2y z = 4
2x + y + z = 5
2x y + 2z = 2.

Answer x = 1, y = 2, z = 1.
ii) Use the Gauss-Jordan technique to find the inverse of the matrix
0 1
1 2 1
B
A=@ 2 1 1 C
A.
2 1 2

Answer
0 1
3 3 3
1B
A 1
= @ 2 4 3 C
A.
3
4 5 3

3
8 step trapezoidal rule exp(-x^2) on [0,1] - Wolfram|Alpha 18/05/2015 23:31

PRO MOBILE APPS PRODUCTS EXAMPLES BLOG ABOUT WOLFRAM SITES Sign in »

8 step trapezoidal rule exp(-x^2) on [0,1]

Examples Random

Input interpretation:

Result:

Symbolic form of trapezoidal rule: Show details

Plot:

Enable interactivity

Exact result: More digits

Error vs. intervals: Relative error

Method comparisons:

Mathematica input:

https://www.wolframalpha.com/input/?i=8+step+trapezoidal+rule+exp%28-x%5E2%29+on+%5B0%2C1%5D Page 1 of 2
8 step trapezoidal rule 1/(1+x^4) on [0,1] - Wolfram|Alpha 18/05/2015 23:34

PRO MOBILE APPS PRODUCTS EXAMPLES BLOG ABOUT WOLFRAM SITES Sign in »

8 step trapezoidal rule 1/(1+x^4) on [0,1]

Examples Random

Input interpretation:

Result:

Symbolic form of trapezoidal rule: Show details

Plot:

Enable interactivity

Exact result: More digits

Error vs. intervals: Relative error

Method comparisons:

Mathematica input:

https://www.wolframalpha.com/input/?i=8+step+trapezoidal+rule+1%2F%281%2Bx%5E4%29+on+%5B0%2C1%5D Page 1 of 2
2 step simpson x^2/(1+x^2) on [0,1] - Wolfram|Alpha 19/05/2015 00:33

PRO MOBILE APPS PRODUCTS EXAMPLES BLOG ABOUT WOLFRAM SITES Sign in »

2 step simpson x^2/(1+x^2) on [0,1]

Examples Random

Input interpretation:

Result:

Symbolic form of Simpson's rule: Show details

Plot:

Enable interactivity

Exact result: More digits

Error vs. intervals: Relative error

Method comparisons:

Mathematica input:

https://www.wolframalpha.com/input/?i=2+step+simpson+x%5E2%2F%281%2Bx%5E2%29+on+%5B0%2C1%5D Page 1 of 2

You might also like