Docsity

Solved Assignment 10 for Numerical Methods | CS 3414, Assignments of Computer Science

Toggle sidebar
bg1
CS/Math 3414 Assignment 10
Solution Sketches
1. The solution to the initial value problem:
x0=x x(0) = c
is given by x=cet. If the initial value is perturbed by so that x(0) = c+, then the solution
will be given by x= (c+)et. The error at t= 10 would be e10 and the error at t= 20
would be e20. In other words, the solution would be grossly wrong.
If, on the other hand, the initial vlaue problem was:
x0=−x x(0) = c
then the solution is given by x=ce−t. In this case, the effect of the perturbation would be
negligible.
2. Using Taylor series we write:
x(t+h) = x(t) + hx0(t) + h2
2x00(t) + h3
6x000(t)
x(0.1) can be calculated as:
x(0 + 0.1) = x(0) + 0.1x0(0) + 0.12
2x00(0) + 0.13
6x000(0)
x(0) is given in the problem to be 1. So is x0(0) (its value is 2). x00 (0) can be calculated from
the differential equation: x00 =x2et+x0. Thus, x00(0) = 12e0+ 2 = 3. Similarly, x000(0) can
be calculated by first finding x000 (t) and then substituting t= 0. x000 (t) is just the derivative
of the given differential equation: x000 = 2xx0et+x2et+x00 . So, x000 (0) = 2(2)e0+e0+ 3 = 8.
Putting it all together, we get:
x(0 + 0.1) = x(0) + 0.1x0(0) + 0.12
2x00(0) + 0.13
6x000(0)
= 1 + 0.1(2) + [(0.1)2/2](3) + [(0.1)3/6](8)
= 1 + 0.2 + 0.015 + 0.00133
= 1.21633
3. This question simply involves writing out the Taylor series expansion of x(t+h) and using
the initial value at t= 0 to determine the value of xin the interval [0,1]. As discussed in
class, you can either take ‘big steps’ (e.g., use h= 1 and find x(1) in one shot) or take a lot
of ‘small steps’ (e.g., use h= 0.01, first find x(0.01), then use this as the initial value and
find x(0.02), and so on). In general, higher order Taylor methods should perform better.
4. In the formulation x0=f(x, t), our fhere is f= (1 + t2)−1x.fx= (1 + t2)−1>0, so the
solution curves diverge from one another as t→ ∞.
pf3
pf4

Partial preview of the text

Download Solved Assignment 10 for Numerical Methods | CS 3414 and more Assignments Computer Science in PDF only on Docsity!

CS/Math 3414 Assignment 10

Solution Sketches

  1. The solution to the initial value problem:

x′^ = x x(0) = c

is given by x = cet. If the initial value is perturbed by  so that x(0) = c + , then the solution will be given by x = (c + )et. The error at t = 10 would be e^10 and the error at t = 20 would be e^20. In other words, the solution would be grossly wrong. If, on the other hand, the initial vlaue problem was:

x′^ = −x x(0) = c

then the solution is given by x = ce−t. In this case, the effect of the perturbation would be negligible.

  1. Using Taylor series we write:

x(t + h) = x(t) + hx′(t) +

h^2 2

x′′(t) +

h^3 6

x′′′(t)

x(0.1) can be calculated as:

x(0 + 0.1) = x(0) + 0. 1 x′(0) +

x′′(0) +

x′′′(0)

x(0) is given in the problem to be 1. So is x′(0) (its value is 2). x′′(0) can be calculated from the differential equation: x′′^ = x^2 et^ + x′. Thus, x′′(0) = 1^2 e^0 + 2 = 3. Similarly, x′′′(0) can be calculated by first finding x′′′(t) and then substituting t = 0. x′′′(t) is just the derivative of the given differential equation: x′′′^ = 2xx′et^ + x^2 et^ + x′′. So, x′′′(0) = 2(2)e^0 + e^0 + 3 = 8. Putting it all together, we get:

x(0 + 0.1) = x(0) + 0. 1 x′(0) +

x′′(0) +

x′′′(0)

= 1 + 0.1(2) + (0.1)^2 /2 + (0.1)^3 /6 = 1 + 0.2 + 0.015 + 0. 00133 = 1. 21633

  1. This question simply involves writing out the Taylor series expansion of x(t + h) and using the initial value at t = 0 to determine the value of x in the interval [0, 1]. As discussed in class, you can either take ‘big steps’ (e.g., use h = 1 and find x(1) in one shot) or take a lot of ‘small steps’ (e.g., use h = 0.01, first find x(0.01), then use this as the initial value and find x(0.02), and so on). In general, higher order Taylor methods should perform better.
  2. In the formulation x′^ = f (x, t), our f here is f = (1 + t^2 )−^1 x. fx = (1 + t^2 )−^1 > 0, so the solution curves diverge from one another as t → ∞.
  1. Since the derivative of x is y and vice versa, the Taylor series expansions will involve alter- nating sequences of x and y. Thus,

x′^ = y y′^ = x

x′′^ = y′^ = x y′′^ = x′^ = y x′′′^ = x′^ = y y′′′^ = y′^ = x x′′′′^ = y′^ = x y′′′′^ = x′^ = y x′′′′′′^ = x′^ = y y′′′′′^ = y′^ = x This gives us the following equation for x:

x(t + h) = x + hx′^ +

h^2 x′′^ +

h^3 x′′′^ +

h^4 x′′′′^ +

h^5 x′′′′′

= x(1 +

h^2 +

h^4 ) + y(h +

h^3 +

h^5 )

Similarly,

y(t + h) = y + hy′^ +

h^2 y′′^ +

h^3 y′′′^ +

h^4 y′′′′^ +

h^5 y′′′′′

= y(1 +

h^2 +

h^4 ) + x(h +

h^3 +

h^5 )

  1. Let x 1 refer to x in the original system of equations and x 2 refer to y in the original system of equations. Let x 3 refer to x′, x 4 refer to y′^ and x 5 refer to y′′, again in the original system (why is there no x 6 ?). This means we can rewrite the given system of equations as:

x′ 1 = x 3 (by definition) x′ 2 = x 4 (by definition) x′ 3 = 3 x^2 − 7 y^2 + sin(t) + cos(x′y′) (from the problem) = 3 x^21 − 7 x^22 + sin(t) + cos(x 3 x 4 ) x′ 4 = y′′ = x′′ 2 = x 5 x′ 5 = y + x^2 − cos(t) − sin(xy′′) (from the problem) = x 2 + x^21 − cos(t) − sin(x 1 x 5 )

The net effect of this juggling is that we have managed to convert a system of higher-order differential equations into a system of first-order equations (with more variables). Notice that the left side contains the derivatives and the right side is now free of derivatives. So, the final answer is: (^) 

  

x′ 1 x′ 2 x′ 3 x′ 4 x′ 5

   

   

x 3 x 4 3 x^21 − 7 x^22 + sin(t) + cos(x 3 x 4 ) x 5 x 2 + x^21 − cos(t) − sin(x 1 x 5 )

   

This system can be solved by our usual Taylor series method for a system of first-order equations (see previous answer). But the question only asks us to express the given problem as a system of first-order equations, not solve it.

computedx(1) = trueinitialvalue + p; count = 1; for j = 0+h:h: count = count + 1; xoft = computedx(count-1); xdashoft = 4xoft - 5exp(-(j-h)); xdashdashoft = 4xdashoft + 5exp(-(j-h)); xdashdashdashoft = 4xdashdashoft - 5exp(-(j-h)); computedx(count) = xoft + ... h * xdashoft + ... (hh/2) * xdashdashoft + ... (hh*h/6) * xdashdashdashoft; end plot(t,computedx,’r+’); end xlabel(’t’); ylabel(’x’); title(’trajectories of solutions of an unstable differential equation’);

Here’s the plot produced. The blue line is the true solution and the red lines are the computed solutions. As can be seen, they diverge as t increases.

0 0.2 0.4 0.6 0.8 1 1.2 1.4 1.6 1.8 2

0

1

2

t

x

trajectories of solutions of an unstable differential equation