Euler Integration Comparison (Part 2)

Calculus Level pending

Consider the time-domain differential equation:

d d t x ( t ) = x 2 ( t ) \frac{d}{dt} x(t) = x^2(t)

Let us discretize the function and time itself. Function x 1 x_1 is the explicit Euler approximation, and x 2 x_2 is the implicit Euler approximation. Let the time step Δ t = 0.001 \Delta t = 0.001

x 1 k = x 1 k 1 + x ˙ 1 k 1 Δ t = x 1 k 1 + x 1 k 1 2 Δ t x 2 k = x 2 k 1 + x ˙ 2 k Δ t = x 2 k 1 + x 2 k 2 Δ t t k = t k 1 + Δ t x_{1 k} = x_{1 \, k-1} + \dot{x}_{1 \, k-1} \Delta t \\ = x_{1 \, k-1} + x^2_{1 \, k-1} \Delta t \\ \,\\ x_{2 k} = x_{2 \, k-1} + \dot{x}_{2 \, k} \Delta t \\ = x_{2 \, k-1} + x^2_{2 \, k} \Delta t \\ \, \\ t_k = t_{k - 1} + \Delta t

In the above equations, the k k subscript denotes the present processing step, and the k 1 k-1 subscript denotes the previous processing step. The simulation is initialized as follows:

t 0 = 0 x 1 0 = 1 x 2 0 = 1 t_0 = 0 \\ x_{1 \, 0} = 1 \\ x_{2 \, 0} = 1 \\

When t = 0.9 t = 0.9 , what is x 2 x 1 x_2 - x_1 , rounded to the nearest integer multiple of 0.05 0.05 ?

Note: For the implicit case, there are two conceivable ways to solve. One of them gives nonsensical results, so use the other.


The answer is 0.45.

This section requires Javascript.
You are seeing this because something didn't load right. We suggest you, (a) try refreshing the page, (b) enabling javascript if it is disabled on your browser and, finally, (c) loading the non-javascript version of this page . We're sorry about the hassle.

1 solution

Karan Chatrath
Mar 16, 2021

For the implicit case, we obtain x k + 1 x_{k+1} by solving the following quadratic equation:

x k + 1 = x k + Δ t x k + 1 2 x_{k+1} = x_{k} + \Delta t x_{k+1}^2

In this case, The roots of the quadratic equation lead to the iteration scheme:

x k + 1 = 1 ± 1 4 Δ t x k 2 Δ t x_{k+1} = \frac{1 \pm \sqrt{1 - 4 \Delta t x_k}}{2\Delta t}

If: x k + 1 = 1 + 1 4 Δ t x k 2 Δ t x_{k+1} = \frac{1 + \sqrt{1 - 4 \Delta t x_k}}{2\Delta t}

Then the limit as Δ t 0 \Delta t \to 0 does not lead to x k + 1 = x k x_{k+1}=x_{k} . However, using the second root and evaluating the same limit results in x k + 1 = x k x_{k+1}=x_{k} which is expected. Essentially, as the time step goes to zero, solutions in two successive time steps become the same.

x k + 1 = 1 1 4 Δ t x k 2 Δ t x_{k+1} = \frac{1 - \sqrt{1 - 4 \Delta t x_k}}{2\Delta t}

Hence, the above root is the appropriate choice. The following script allows us to evaluate the required result.

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
clear all
clc

dt      = 1e-3;                                      % Time step
t       = 0:dt:0.9;                                  % Time array

x1(1)   = 1;                                         % Initial cond: Explicit soln.             
x2(1)   = 1;                                         % Initial cond: Implicit soln.

for k = 1:length(t)-1

  x1(k+1)   = x1(k) + dt*x1(k)^2;                    % Explicit Euler
  x2(k+1)   = (1 - sqrt(1 - 4*dt*x2(k)))/(2*dt);     % Implicit Euler
end

ANSWER  =  x2(end) - x1(end)                         
% ANSWER = 0.4612

0 pending reports

×

Problem Loading...

Note Loading...

Set Loading...