0% found this document useful (0 votes)
83 views17 pages

Assignment 6 - Initial Value Problems - Attempt Review - Econcordia

assignment 6

Uploaded by

Rim
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)
83 views17 pages

Assignment 6 - Initial Value Problems - Attempt Review - Econcordia

assignment 6

Uploaded by

Rim
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/ 17

8/13/24, 10:08 AM Assignment 6 - Initial value problems: Attempt review | eConcordia

Started on Wednesday, 7 August 2024, 4:16 PM


State Finished
Completed on Friday, 9 August 2024, 10:04 PM
Time taken 2 days 5 hours
Grade 14.00 out of 15.00 (93.33%)
Feedback Well done. However make sure to understand well where you did mistakes and review the corresponding lecture
topics.

Question 1
Complete
Not graded

By checking the "yes" answer below I confirm


1. that I have neither given nor received unauthorized aid to answer the questions of this assignment.
2. I agree to follow the rules in regard of online assignments as posted in the course outline
3. I used only octave or Matlab to solve the questions (I am allowed to consult all course material and my own notes)
Select one:
a. Yes I agree
b. No I do not agree

Your answer is correct.


The correct answer is: Yes I agree

https://moodle.econcordia.com/mod/quiz/review.php?attempt=416412&cmid=81035 1/17
8/13/24, 10:08 AM Assignment 6 - Initial value problems: Attempt review | eConcordia

Question 2
Correct
Mark 1.00 out of 1.00

The fact that an initial value solver is stable or not stable depends on
Select one or more:
a. Nothing in particular
b. The choice of the step size 
c. The final value 𝑡𝑓 one wants to calculate the approximation for
d. The differential equation to be solved 
e. The initial conditions

Your answer is correct.


Reference: lecture on stability of IVP solvers in topic 8
The correct answers are: The choice of the step size, The differential equation to be solved

https://moodle.econcordia.com/mod/quiz/review.php?attempt=416412&cmid=81035 2/17
8/13/24, 10:08 AM Assignment 6 - Initial value problems: Attempt review | eConcordia

Question 3
Correct
Mark 1.00 out of 1.00

Apply the Trapezoid (RK2) method to the following initial value problem:
⎧ 𝑦′1 = 𝑦1 + 𝑦2
⎪ 𝑦′ = −𝑦 + 𝑦
⎨ 2 1 2
⎪ 𝑦1 (0) = 1
⎩ 𝑦2 (0) = 0

with a step size of ℎ = 0.1 in the interval [0, 1]


Give the approximations 𝑤1 and 𝑤2 of 𝑦1 and 𝑦2 in 𝑡 = 1.
Use 16 digits in your calculations and give the answers with at least 5 significant digits
𝑤 1 (1) = 1.480483425725212 

𝑤 2 (1) = -2.288998496915356 

The complete solution is


t=
0.00000
0.10000
0.20000
0.30000
0.40000
0.50000
0.60000
0.70000
0.80000
0.90000
1.00000
w=
1.00000 0.00000
1.10000 -0.11000
1.19790 -0.24200
1.29107 -0.39797
1.37640 -0.57978
1.45026 -0.78917
1.50848 -1.02761
1.54629 -1.29631
1.55833 -1.59603
1.53860 -1.92705
1.48048 -2.28900
Reference: Lecture on systems of differential equation in topic 8

https://moodle.econcordia.com/mod/quiz/review.php?attempt=416412&cmid=81035 3/17
8/13/24, 10:08 AM Assignment 6 - Initial value problems: Attempt review | eConcordia

Question 4
Correct
Mark 1.00 out of 1.00

Consider a numerical initial value problem solver in order 𝑂(ℎ7 ) in the local truncation error.
The order of the global truncation error will be
Answer: 6 

The global truncation error is always one less than the local one according the Lipschitz theorems.
Reference: Lecture on local and global truncation errors of topic 8
The correct answer is: 6

https://moodle.econcordia.com/mod/quiz/review.php?attempt=416412&cmid=81035 4/17
8/13/24, 10:08 AM Assignment 6 - Initial value problems: Attempt review | eConcordia

Question 5
Correct
Mark 2.00 out of 2.00

Apply the standard RK4 method to the following initial value problem:
⎧ 𝑑2𝑦 − 2 𝑑𝑦 + 2𝑦 = 𝑒2𝑡 sin 𝑡
⎪ 𝑑𝑡2
⎨ 𝑦(0) = −0.4
𝑑𝑡

⎪ ′
⎩ 𝑦 (0) = −0.6

with a step size of ℎ = 0.25 in the interval [0, 1]


Start by transforming this second order differential equation into a system of first order differential equations by using the variables

{ 𝑦2 = 𝑑𝑦
𝑦1 = 𝑦
𝑑𝑡

Give the approximations 𝑤1 and 𝑤2 of 𝑦1 and 𝑦2 in 𝑡 = 1.


Use 16 digits in your calculations and give the answers with at least 5 significant digits
𝑤 1 (1) = -0.3536345165765725 

𝑤 2 (1) = 2.579254393280338 

The equivalent system of first order differential equations is


⎧ 𝑑𝑦1 = 𝑦2
⎪ 𝑑𝑡
⎪ 𝑑𝑦2 = 𝑒2𝑡 sin 𝑡 − 2𝑦 + 2𝑦
⎨ 𝑑𝑡
⎪ 𝑦 (0) = −0.4
1 2

⎪ 1
⎩ 𝑦2 (0) = −0.6

The complete solution is


t=
0.00000
0.25000
0.50000
0.75000
1.00000
w=
-0.40000 -0.60000
-0.55745 -0.63218
-0.69367 -0.38874
-0.70088 0.47652
-0.35363 2.57925
Reference: Lecture on high order initial value problems of topic 8

https://moodle.econcordia.com/mod/quiz/review.php?attempt=416412&cmid=81035 5/17
8/13/24, 10:08 AM Assignment 6 - Initial value problems: Attempt review | eConcordia

Question 6
Correct
Mark 1.00 out of 1.00

Two different RK4 methods will produce approximations of a given initial value problem with similar accuracy
Select one:
True 
False

Any RK4 method will be in 𝑂(ℎ4 ) for the global truncation error. That means they all will produce approximations with very similar
accuracy.
Reference: Lecture on Runge Kutta methods of topic 8
The correct answer is 'True'.

Question 7
Correct
Mark 1.00 out of 1.00

A RK2 method will in general require how many function evaluations (in each step) when solving an initial value problem?
Answer: 2 

Reference: Lecture on Runge Kutta methods of topic 8


The correct answer is: 2

https://moodle.econcordia.com/mod/quiz/review.php?attempt=416412&cmid=81035 6/17
8/13/24, 10:08 AM Assignment 6 - Initial value problems: Attempt review | eConcordia

Question 8
Correct
Mark 1.00 out of 1.00

Consider the following initial value problem:


𝑑𝑦 𝑡3
𝑑𝑡
= 𝑦2

with 𝑦(0) = 1.
Apply Euler's method with a step size ℎ = 0.25.
How much is the approximation of 𝑦(1) ?
Use 16 significant figures in your calculations and give your answer with at least 5 significant figures
Answer: 1.133386191966365 

Applying Euler's method results in:


0.0000 1.0000
0.2500 1.0000
0.5000 1.0039
0.7500 1.0349
1.0000 1.1334
Reference: lecture on Euler's method of topic 8 "Initial value problems"
The correct answer is: 1.1334

https://moodle.econcordia.com/mod/quiz/review.php?attempt=416412&cmid=81035 7/17
8/13/24, 10:08 AM Assignment 6 - Initial value problems: Attempt review | eConcordia

Question 9
Correct
Mark 1.00 out of 1.00

Select the correct statement(s)


Select one or more:
a. The local truncation error of an initial value solver is the difference between the local solution and the approximation 
computed by the numerical solver
b. The local truncation error of an initial value solver can be estimated with the Richardson error formula
c. The global truncation error of an initial value solver can be estimated with the Richardson error formula 
d. The global truncation error of an initial value solver can be estimated based on the Taylor series expansion of the solution of the
initial value problem
e. The global truncation error of an initial value solver can be estimated by computing |𝑤𝑖+1 − 𝑤𝑖 |

Your answer is correct.


Reference: Lecture on local and global truncation errors of topic 8
The correct answers are: The global truncation error of an initial value solver can be estimated with the Richardson error formula, The
local truncation error of an initial value solver is the difference between the local solution and the approximation computed by the
numerical solver

Question 10
Correct
Mark 1.00 out of 1.00

Select all correct statements about adaptive methods to solve ODEs


a. Adaptive methods can not be used for systems of ODEs
b. Adaptive methods are very well suited for ill conditioned problems
c. Adaptive methods estimate the local truncation error 
d. Adaptive methods require in general less steps than fixed step methods to reach an approximation in some point 𝑡𝑓 with a 
same accuracy.
e. Adaptive methods guarantee that the global truncation error remains below a chosen value

Your answer is correct.


The correct answers are:
Adaptive methods estimate the local truncation error,
Adaptive methods require in general less steps than fixed step methods to reach an approximation in some point \(t_f\) with a same
accuracy.

https://moodle.econcordia.com/mod/quiz/review.php?attempt=416412&cmid=81035 8/17
8/13/24, 10:08 AM Assignment 6 - Initial value problems: Attempt review | eConcordia

Question 11
Correct
Mark 1.00 out of 1.00

Consider the following initial value problem


⎧ 𝑑2𝑦 = 𝑑𝑦 cos 𝑡 − 𝑦 sin 𝑡
⎪ 𝑑𝑡2
⎨ 𝑦(0) = 1
𝑑𝑡

⎪ ′
⎩ 𝑦 (0) = 1

Start by transforming this second order initial value problem into a system of first order initial value problems with the variables

{ 𝑦2 = 𝑑𝑦
𝑦1 = 𝑦
𝑑𝑡

We want to produce an approximation of the solutions 𝑦1 (𝑡 = 4) and 𝑦2 (𝑡 = 4) using the classical RK4 method
For which step sizes ℎ do we get approximations of 𝑦1 (𝑡 = 4) and 𝑦2 (𝑡 = 4) with an absolute error below 10−8 ?
Select one or more:
a. 10−3 
b. 10−2 
c. 10−1
d. 100

Your answer is correct.


The equivalent system of first order differential equations is
⎧ 𝑑𝑦1 = 𝑦2
⎪ 𝑑𝑡
⎪ 𝑑𝑦2 = 𝑦 cos 𝑡 − 𝑦 sin 𝑡
⎨ 𝑑𝑡
⎪ 𝑦 (0) = 1
2 1


⎩ 𝑦2 (0) = 1
1

We then solve this system of ODEs for different step sizes ℎ using the RK4 method in the interval [0, 4].
We estimate the errors of the approximations of 𝑦1 (𝑡 = 4) and 𝑦2 (𝑡 = 4) with the Richardson formula.
The plot below gives this error estimations in function of various step sizes

https://moodle.econcordia.com/mod/quiz/review.php?attempt=416412&cmid=81035 9/17
8/13/24, 10:08 AM Assignment 6 - Initial value problems: Attempt review | eConcordia

Using this plot the question can be answered.

The plot below gives an example of a solution produced by the RK4 method for a step size of ℎ = 0.01

https://moodle.econcordia.com/mod/quiz/review.php?attempt=416412&cmid=81035 10/17
8/13/24, 10:08 AM Assignment 6 - Initial value problems: Attempt review | eConcordia

The correct answers are: 10−3 , 10−2

https://moodle.econcordia.com/mod/quiz/review.php?attempt=416412&cmid=81035 11/17
8/13/24, 10:08 AM Assignment 6 - Initial value problems: Attempt review | eConcordia

Question 12
Correct
Mark 1.00 out of 1.00

Compute an approximation of 𝑦(4), the solution in 𝑡 = 4 of the following ordinary differential equation
𝑑𝑦 𝑡3
𝑑𝑡
= 𝑦2

with 𝑦(0) = 1 using the classical RK4 method with ℎ = 0.5


Use 16 significant figures in your calculations and give your answer with at least 6 significant figures

Answer: 5.77933463 

Applying the classical RK4 method leads to


0.00000 1.00000
0.50000 1.01545
1.00000 1.20595
1.50000 1.68858
2.00000 2.35283
2.50000 3.11842
3.00000 3.95322
3.50000 4.84284
4.00000 5.77933
The correct answer is: 5.77933

https://moodle.econcordia.com/mod/quiz/review.php?attempt=416412&cmid=81035 12/17
8/13/24, 10:08 AM Assignment 6 - Initial value problems: Attempt review | eConcordia

Question 13
Incorrect
Mark 0.00 out of 1.00

Consider the following initial value problem


𝑑𝑦
𝑑𝑡
= (1 − 𝑡)𝑦 + sin 𝑦

with 𝑦(−1) = 0.5


We want to find y(2) with an absolute error below 10−8 .
Use any method covered in the class you wish
Answer: 2.6609 

As an example we can use the classical RK4 method.


We solve the initial value problem on the interval [−1, 2] for different step sizes ℎ and we estimate the errors using the Richardson error
formula.
Below is the log-log plot of the error estimation in 𝑡 = 2 in function of the step size ℎ

https://moodle.econcordia.com/mod/quiz/review.php?attempt=416412&cmid=81035 13/17
8/13/24, 10:08 AM Assignment 6 - Initial value problems: Attempt review | eConcordia
From this plot we can conclude that, for example, a step size of ℎ = 10−3 will guarantee us to give an answer with an absolute error
below 10−8 .
Solving the IVP with this step size with the classical RK4 method yields to 𝑦(2) ≃ 2.660913870544215
The plot below shows the approximation of 𝑦(𝑡) over the interval [−1, 2]

The correct answer is: 2.66091387

https://moodle.econcordia.com/mod/quiz/review.php?attempt=416412&cmid=81035 14/17
8/13/24, 10:08 AM Assignment 6 - Initial value problems: Attempt review | eConcordia

Question 14
Correct
Mark 1.00 out of 1.00

Compute the approximation of 𝑦(7), the solution in 𝑡 = 7 of the following ordinary differential equation
𝑑𝑦
𝑑𝑡
= 1 + (𝑡 − 𝑦)2

with 𝑦(2) = 1 using the Trapezoid method with ℎ = 0.5


Use 16 significant figures in your calculations and give your answer with at least 6 significant figures
Answer: 6.829890 

Applying the trapezoid method leads to


2.0000 1.0000
2.5000 1.8125
3.0000 2.4816
3.5000 3.0856
4.0000 3.6555
4.5000 4.2055
5.0000 4.7430
5.5000 5.2720
6.0000 5.7952
6.5000 6.3142
7.0000 6.8299
The correct answer is: 6.8299

https://moodle.econcordia.com/mod/quiz/review.php?attempt=416412&cmid=81035 15/17
8/13/24, 10:08 AM Assignment 6 - Initial value problems: Attempt review | eConcordia

Question 15
Correct
Mark 1.00 out of 1.00

Consider the following initial value problem

{ 𝑦(0) = 1/3
= (cos 𝑡 + 2𝑡3 ) 𝑦3 − 𝑡𝑦
𝑑𝑦
𝑑𝑡

We want to study the produced approximations of the solution 𝑦(𝑡) using the midpoint (RK2) method over the interval [0, 3].
For this compute the approximations 𝑤𝑖 and 𝑤̃𝑖 for the step sizes ℎ1 = 0.1 and ℎ2 = 0.05 in the interval [0, 3].
Based on these calculations, for which tolerances 𝑇 𝑂𝐿 can we say |𝑤̃𝑖 − 𝑦(𝑡𝑖 )| ≤ 𝑇 𝑂𝐿 over the full interval [0, 3] ?
Select one or more:
a. 10−6
b. 10−5
c. 10−4 
d. 10−3 
e. 10−2 

Your answer is correct.


We first solve the IVP for the two step sizes ℎ1 and ℎ2 using the midpoint method in the interval [0, 3].
We estimate the errors of the approximations 𝑤̃𝑖 using the Richardson formula and our two approximations 𝑤𝑖 and 𝑤̃𝑖 .
Be careful to use the approximations computed in the same points 𝑡𝑖 when applying the Richardson formula:
𝑤(𝑡 )−𝑤 (̃𝑡 )
𝐸 𝑖 ≃ ∣∣∣ 𝑖 2 𝑖 ∣∣∣
2 −1

As 𝑤̃𝑖 contains twice more entries than 𝑤𝑖 you can do this with the command (if w1 and w2 are the vectors containing the appoxiamtions
computed by the IVP solver using ℎ1 and ℎ2 )
Err=abs(w1-w2(1:2:end))/(2^2-1)
The plot below gives this error estimations over the solution interval as well as the approximation 𝑤̃𝑖 .

https://moodle.econcordia.com/mod/quiz/review.php?attempt=416412&cmid=81035 16/17
8/13/24, 10:08 AM Assignment 6 - Initial value problems: Attempt review | eConcordia

Using this plot the question can be answered.


The correct answers are: 10−4 , 10−3 ,
10−2

https://moodle.econcordia.com/mod/quiz/review.php?attempt=416412&cmid=81035 17/17

You might also like