0% found this document useful (0 votes)
29 views11 pages

MTL712 Quiz 4: Navneet Raj 2021MT10240 October 27, 2024

Uploaded by

ritamdasgupta62
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)
29 views11 pages

MTL712 Quiz 4: Navneet Raj 2021MT10240 October 27, 2024

Uploaded by

ritamdasgupta62
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/ 11

MTL712 Quiz 4

Navneet Raj
2021MT10240
October 27, 2024

Contents
1 Descriptions of the problems 1
1.1 Problem 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 1
1.2 Problem 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.3 Problem 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.4 Problem 9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.5 Problem 11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.6 Problem 13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 2
1.7 Problem 15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3

2 Strategy of solving 3

3 Methods 3
3.1 Euler’s Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3.2 Taylor’s Method of order N . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3.3 Modified Euler’s Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3
3.4 Midpoint Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.5 Heun’s Method . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4
3.6 Runge-Kutta Method of order four . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 4

4 Output, plots 5
4.1 Problem 1 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
4.2 Problem 3 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4.3 Problem 5 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 6
4.4 Problem 9 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 7
4.5 Problem 11 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.6 Problem 13 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 8
4.7 Problem 15 . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 9

5 Interpretaion of the results 11

1 Descriptions of the problems


1.1 Problem 1
1. Solve the following initial-value problems using Euler’s method:
a. y ′ = te3t − 2y, 0 ≤ t ≤ 1, y(0) = 0, with step size h = 0.5.
b. y ′ = 1 + (t − y)2 , 2 ≤ t ≤ 3, y(2) = 1, with step size h = 0.5.
c. y ′ = 1 + y/t, 1 ≤ t ≤ 2, y(1) = 2, with step size h = 0.25.
d. y ′ = cos 2t + sin 3t, 0 ≤ t ≤ 1, y(0) = 1, with step size h = 0.25.

1
1.2 Problem 3
3. Solve the following initial-value problems using Euler’s method:
a. y ′ = y/t − (y/t)2 , 1 ≤ t ≤ 2, y(1) = 1, with step size h = 0.1.
b. y ′ = 1 + y/t + (y/t)2 , 1 ≤ t ≤ 3, y(1) = 0, with step size h = 0.2.
c. y ′ = −(y + 1)(y + 3), 0 ≤ t ≤ 2, y(0) = −2, with step size h = 0.2.
d. y ′ = −5y + 5t2 + 2t, 0 ≤ t ≤ 1, y(0) = 13 , with step size h = 0.1.

1.3 Problem 5
5. The exact solution for the IVP
2
y′ = y + t2 et , 1 ≤ t ≤ 2, y(1) = 0
t
is y(t) = t2 (et − e).
a. Use Euler’s method with h = 0.1 to approximate the solution, and compare it with the actual values of y.
b. Use the answers generated in part(a) and linear interpolation to approximate the following values of y, and
compare them to the actual values:
i. y(1.04) ii. y(1.55) iii. y(1.97)
c. Compute the value of h necessary for |y (ti ) − wi | ≤ 0.1, using

hM h L(ti −1) i
|y (ti ) − wi | ≤ e −1
2L
where L is the Lipschitz constant and M is a constant satisfying |y ′′ (t)| ≤ M , for all t ∈ [1, 2].

1.4 Problem 9
9. Solve the following initial-value problems using Taylor’s method of order two:
a. y ′ = te3t − 2y, 0 ≤ t ≤ 1, y(0) = 0, with step size h = 0.5.
b. y ′ = 1 + (t − y)2 , 2 ≤ t ≤ 3, y(2) = 1, with step size h = 0.5.
c. y ′ = 1 + y/t, 1 ≤ t ≤ 2, y(1) = 2, with step size h = 0.25.
d. y ′ = cos 2t + sin 3t, 0 ≤ t ≤ 1, y(0) = 1, with step size h = 0.25.

1.5 Problem 11
11. Solve the following initial-value problems using Taylor’s method of order two:
a. y ′ = y/t − (y/t)2 , 1 ≤ t ≤ 1.2, y(1) = 1, with step size h = 0.1.
b. y ′ = sin t + e−t , 0 ≤ t ≤ 1, y(0) = 0, with step size h = 0.5.
c. y ′ = y 2 + y /t, 1 ≤ t ≤ 3, y(1) = −2, with step size h = 0.5.
d. y ′ = −ty + 4ty −1 , 0 ≤ t ≤ 1, y(0) = 1, with step size h = 0.25.

1.6 Problem 13
13. The exact solution for the IVP
2
y′ = y + t2 et , 1 ≤ t ≤ 2, y(1) = 0
t
is y(t) = t2 (et − e).
a. Use Taylor’s method of order two with h = 0.1 to approximate the solution, and compare it with the actual values
of y.
b. Use the answers generated in part(a) and linear interpolation to approximate the following values of y, and
compare them to the actual values of y.:
i. y(1.04) ii. y(1.55) iii. y(1.97)
c. Use Taylor’s method of order four with h = 0.1 to approximate the solution, and compare it with the actual values
of y.
d. Use the answers generated in part(c) and linear interpolation to approximate the following values of y, and
compare them to the actual values of y.:
i. y(1.04) ii. y(1.55) iii. y(1.97)

2
1.7 Problem 15
15. Solve the following initial-value problems using the Modified Euler’s method, the Midpoint method, Heun’s
method and Runge-Kutta method of order four:
a. y ′ = y/t − (y/t)2 , 1 ≤ t ≤ 2, y(1) = 1, with step size h = 0.1, actual solution y(t) = 1+ln
t
t.
′ 2
b. y = 1 + y/t + (y/t) , 1 ≤ t ≤ 3, y(1) = 0, with step size h = 0.2, actual solution y(t) = t tan(ln t).
c. y ′ = −(y + 1)(y + 3), 0 ≤ t ≤ 2, y(0) = −2, with step size h = 0.2, actual solution y(t) = −3 + 1+e2−2t .
d. y ′ = −5y + 5t2 + 2t, 0 ≤ t ≤ 1, y(0) = 13 , with step size h = 0.1, actual solution y(t) = t2 + 31 e−5t .

2 Strategy of solving
We use Euler’s method to solve Problem 1, 3 and 5. We use Taylor’s method to solve Problem 9, 11 and 13. We
use Runge-Kutta method to solve Problem 15. Also, we try to check different solutions for different step sizes, and
Modified Euler. We also try to check the accuracy of the solutions by comparing them with the actual solutions.
Many of the numerical methods have an underlying derivation from Taylor’s Theorem. The approximation of the
solution to initial-value problems is no exception. In this case, the function we need to expand in a Taylor polynomial
is the (unknown) solution to the problem, y(t). In its most elementary form this leads to Euler’s Method.
The object of Euler’s method is to find, for a given positive integer N , an approximation to the solution of a problem
of the form
dy
= f (t, y), for a ≤ t ≤ b, with y(a) = α
dt
at the N + 1 equally spaced mesh points {t0 , t1 , t2 , . . . , tN } (see Figure 5.1), where

ti = a + ih, for each i = 0, 1, . . . N.

The common distance between the points, h = (b − a)/N , is called the step size. Approximations at other values
of t in [a, b] can then be found using interpolation.
The Runge-Kutta techniques make use of the Taylor expansion of f , the function on the right side of the differential
equation. Since f is a function of two variables, t and y, we must first consider the generalization of Taylor’s Theorem
to functions of this type. This generalization appears more complicated than the single-variable form, but this is
only because of all the partial derivatives of the function f .

3 Methods
3.1 Euler’s Method
w0 = α
wi+1 = wi + hf (ti , wi )
where i = 0, 1, . . . , N − 1, with local error 21 y ′′ (ξi ) h2 for some ξi in (ti , ti+1 ).

3.2 Taylor’s Method of order N


w0 = α
wi+1 = wi + hT (n) (ti , wi )
for each i = 0, 1, . . . , N − 1, where

h ′ hn−1 (n−1)
T (n) (ti , wi ) = f (ti , wi ) + f (ti , wi ) + · · · + f (ti , wi )
2 n!
1 (n+1)
The local error is (n+1)! y (ξi ) hn+1 for some ξi in (ti , ti+1 ).

3.3 Modified Euler’s Method


w0 = α
h
wi+1 = wi + [f (ti , wi ) + f (ti+1 , wi + hf (ti , wi ))]
2
 
where i = 0, 1, . . . , N − 1, with local error O h3 and global error O h2 .

3
3.4 Midpoint Method
w0 = α
  
h h
wi+1 = wi + h f ti + , wi + f (ti , wi )
2 2
 
where i = 0, 1, . . . , N − 1, with local error O h3 and global error O h2 .

3.5 Heun’s Method


w0 = α
  
h 2 2
wi+1 = wi + f (ti , wi ) + 3f ti + h, wi + hf (ti , wi )
4 3 3
3
 2

where i = 0, 1, . . . , N − 1, with local error O h and global error O h .

3.6 Runge-Kutta Method of order four


w0 = α
k1 = hf (ti , wi )
 
h 1
k2 = hf ti + , wi + k1
2 2
 
h 1
k3 = hf ti + , wi + k2
2 2
k4 = hf (ti+1 , wi + k3 )
1
wi+1 = wi + (k1 + 2k2 + 2k3 + k4 ) ,
6
 
where i = 0, 1, . . . , N − 1, with local error O h5 and global error O h4 .
The exact solutions for the problems are given in the problems themselves, or in the next problem. We can
compare the solutions obtained from the numerical methods with the exact solutions to check the accuracy of the
methods.

4
4 Output, plots
4.1 Problem 1

(a) Problem 1a (b) Problem 1b

(c) Problem 1c (d) Problem 1d

Figure 1: Euler’s Method, with some extra step sizes

5
4.2 Problem 3

(a) Problem 3a (b) Problem 3b

(c) Problem 3c (d) Problem 3d

Figure 2: Euler’s and Modified Euler’s Methods

4.3 Problem 5

Figure 3: Euler’s Method, with step size 0.1

6
y(t)
t Linear Interpolation Actual Value
1.04 0.10873 0.1200
1.55 3.9041 4.7886
1.97 14.303 17.2793

Table 1: Values calculated by Linear Interpolation

By the given formula, we can calculate the value of h necessary for |y (ti ) − wi | ≤ 0.1, h = 0.0067089

4.4 Problem 9

(a) Problem 9a (b) Problem 9b

(c) Problem 9c (d) Problem 9d

Figure 4: Taylor’s Method, order 2

7
4.5 Problem 11

(a) Problem 11a (b) Problem 11b

(c) Problem 11c (d) Problem 11d

Figure 5: Taylor’s Method, order 2

4.6 Problem 13
a)

Figure 6: Taylor’s Method, order 2, with step size 0.1

b)

8
y(t)
t Linear Interpolation Actual Value
1.04 0.135914 0.119987
1.55 4.777033 4.788635
1.97 17.174801 17.279298

Table 2: Values calculated by Linear Interpolation

c)

Figure 7: Taylor’s Method, order 4, with step size 0.1

d)

y(t)
t Linear Interpolation Actual Value
1.04 0.138365 0.119987
1.55 4.844239 4.788635
1.97 17.374877 17.279298

Table 3: Values calculated by Linear Interpolation

4.7 Problem 15
a)

Figure 8: 15a with all four methods

9
t Modified Euler Midpoint Heun Runge-Kutta Actual
1.00 1.000000 1.000000 1.000000 1.000000 1.000000
1.10 1.004132 1.004535 1.004395 1.004282 1.004282
1.20 1.014714 1.015326 1.015112 1.014952 1.014952
1.30 1.029520 1.030247 1.029994 1.029813 1.029814
1.40 1.047204 1.047998 1.047722 1.047534 1.047534
1.50 1.066909 1.067743 1.067452 1.067262 1.067262
1.60 1.088064 1.088921 1.088623 1.088432 1.088433
1.70 1.110275 1.111148 1.110844 1.110655 1.110655
1.80 1.133266 1.134148 1.133841 1.133653 1.133654
1.90 1.156835 1.157724 1.157415 1.157228 1.157228
2.00 1.180834 1.181727 1.181417 1.181232 1.181232

Table 4: Comparison of Numerical Methods with Actual Solution

b)

Figure 9: 15b with all four methods

c)

Figure 10: 15c with all four methods

d)

10
Figure 11: 15d with all four methods

5 Interpretaion of the results


As seen in Problem 1, 3 and 5, Euler’s method becomes less accurate as the step size increases. The accuracy of the
method can be improved by decreasing the step size. Modified Euler almost halves the error compared to Euler’s
method, for the same step size.
In Problem 5, the values calculated by linear interpolation are close to the actual values. The value of h necessary
for |y (ti ) − wi | ≤ 0.1 is calculated to be h = 0.0067089.
In Problem 9, 11 and 13, Taylor’s method of order 2 is used to solve the problems. The accuracy of the method
can be improved by decreasing the step size. In Problem 13, Taylor’s method of order 2 and 4 is used to solve the
problems. The accuracy of the method can be improved by decreasing the step size. The values calculated by linear
interpolation are close to the actual values. The accuracy does not necessarily improve by increasing the order of the
method. However, a higher order may be beneficial in some cases, as seen with Runge-Kutta methods in Problem
15.
The Runge Kutta method is used to solve Problem 15. Runge Kutta method of order four is the most accurate
method, almost equal to the actual solution. All the methods are very close to each other and the actual solution
and seem to perform better than Taylor methods, without a dramatic increase in computational complexity.

11

You might also like

pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy