MTL712 Quiz 4: Navneet Raj 2021MT10240 October 27, 2024
MTL712 Quiz 4: Navneet Raj 2021MT10240 October 27, 2024
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
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
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 ).
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.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 .
4
4 Output, plots
4.1 Problem 1
5
4.2 Problem 3
4.3 Problem 5
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
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
7
4.5 Problem 11
4.6 Problem 13
a)
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
c)
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
4.7 Problem 15
a)
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
b)
c)
d)
10
Figure 11: 15d with all four methods
11