Consider the time-domain differential equation:
d t d x ( t ) = x 2 . 5 ( t )
Let us discretize the function and time itself. Function x 1 is the explicit Euler approximation, and x 2 is the implicit Euler approximation. Let the time step Δ t = 0 . 0 0 1
x 1 k = x 1 k − 1 + x ˙ 1 k − 1 Δ t = x 1 k − 1 + x 1 k − 1 2 . 5 Δ t x 2 k = x 2 k − 1 + x ˙ 2 k Δ t = x 2 k − 1 + x 2 k 2 . 5 Δ t t k = t k − 1 + Δ t
In the above equations, the k subscript denotes the present processing step, and the 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
When t = 0 . 6 , what is x 2 − x 1 , rounded to the nearest integer multiple of 0 . 1 ?
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.
Thanks for the solution. I also did NR iteration on each time step
Problem Loading...
Note Loading...
Set Loading...
The explicit scheme reads as follows:
x 1 ( k + 1 ) = x 1 ( k ) + δ t x 1 ( k ) 2 . 5
The implicit scheme reads as follows:
x 2 ( k + 1 ) = x 2 ( k ) + δ t x 2 ( k + 1 ) 2 . 5
So the solution at the next time step depends on the solution at the current as well as the next time step. The goal is to solve for x 1 ( k + 1 ) . This is a nonlinear equation in terms of the variable to solve.
Let: x 2 ( k ) = x o and x 2 ( k + 1 ) = x n and h = δ t
Then we can use the Newton-Raphson iteration scheme to solve for this unknown x n . The nonlinear equation to solve is:
f ( x n ) = h x n 2 . 5 + x o − x n f ′ ( x n ) = 2 . 5 h x 1 . 5 − 1
We can use the following iteration formula to calculate the updated value of x n as follows:
x n , n e w = x n , o l d − f ′ ( x n , o l d ) f ( x n , o l d )
This iteration can be performed to solve for the roots of f ( x n ) . This can be done to some specified numerical tolerance or for a fixed number of steps. I chose to perform 20 steps. This choice is random.
Finally, we can use the result of the final iteration of the above formula and plug it into the implicit scheme as such:
x 2 ( k + 1 ) = x 2 ( k ) + δ t x n , f i n a l 2 . 5
The calculation code is attached below. Of course, there may be better ways of solving the implicit problem and I looks forward to seeing them.