Docsity

Problems for Assignment 5 - Beginning Scientific Computing | AMATH 301, Assignments of Mathematics

Toggle sidebar
bg1
AMATH 301 Due Thursday, 08/04/05 Homework #5
MATLAB commands to learn: ode45,odeset
1. Initial Value Problems.
Consider the nonlinear differential equation
ยจz+z+๎˜๎˜€z2โˆ’1๎˜ห™z= 0.(1)
This equation is often used to model electrical and physiological oscillations.
Balthasar van der Pol first wrote about (1) in this context in 1926. Since then
the van der Pol equation (1) has borne his name. For the purpose of this
problem, assume that ๎˜is a parameter whose (positive) value can be chosen
arbitrarily.
(a) Given z=y1and ห™z=y2, show that the van der Pol equation can be
written as the first order system
ห™y1=y2,ห™y2=โˆ’y1+๎˜๎˜€1โˆ’y2
1๎˜y2(2)
(b) For each of the values ๎˜= 0.01, ๎˜= 0.1, ๎˜= 1, ๎˜= 5 and ๎˜= 10, use
ode45 and the initial conditions z(0) = 1 and ห™z(0) = 0 to solve the van
der Pol IVP on the interval 0 โ‰คtโ‰ค100. Plot each of the five solutions
on a separate set of axes and use num2str to put the relevant value of ๎˜
somewhere on the plot.
(c) For each of the initial values z(0) = 10, z(0) = 5, z(0) = 2, z(0) = 0.5
and z(0) = 0, use the second initial value ห™z(0) = 0, the parameter value
๎˜= 1 and ode45 to solve van der Pol IVP on the interval 0 โ‰คtโ‰ค100.
Plot each of the five solutions on a separate set of axes and use num2str
to put the relevant values of ๎˜and z(0) somewhere on the plot.
(d) Based on your calculations above, describe the way the shape of the
solution changes when you keep the initial values fixed, but vary the
parameter ๎˜.
(e) Based on your calculations above, describe the way the shape of the
solution changes when you fix ๎˜and ห™z(0), but vary z(0).
D. Williams, Summer 2005 Page 1 of 2
pf2

Partial preview of the text

Download Problems for Assignment 5 - Beginning Scientific Computing | AMATH 301 and more Assignments Mathematics in PDF only on Docsity!

AMATH 301 Due Thursday, 08/04/05 Homework #

MATLAB commands to learn: ode45, odeset

  1. Initial Value Problems. Consider the nonlinear differential equation

zยจ + z + 

z^2 โˆ’ 1

zห™ = 0. (1)

This equation is often used to model electrical and physiological oscillations. Balthasar van der Pol first wrote about (1) in this context in 1926. Since then the van der Pol equation (1) has borne his name. For the purpose of this problem, assume that  is a parameter whose (positive) value can be chosen arbitrarily.

(a) Given z = y 1 and ห™z = y 2 , show that the van der Pol equation can be written as the first order system

yห™ 1 = y 2 , yห™ 2 = โˆ’y 1 + 

1 โˆ’ y 12

y 2 (2)

(b) For each of the values  = 0.01,  = 0.1,  = 1,  = 5 and  = 10, use ode45 and the initial conditions z(0) = 1 and ห™z(0) = 0 to solve the van der Pol IVP on the interval 0 โ‰ค t โ‰ค 100. Plot each of the five solutions on a separate set of axes and use num2str to put the relevant value of  somewhere on the plot.

(c) For each of the initial values z(0) = 10, z(0) = 5, z(0) = 2, z(0) = 0. 5 and z(0) = 0, use the second initial value ห™z(0) = 0, the parameter value  = 1 and ode45 to solve van der Pol IVP on the interval 0 โ‰ค t โ‰ค 100. Plot each of the five solutions on a separate set of axes and use num2str to put the relevant values of  and z(0) somewhere on the plot.

(d) Based on your calculations above, describe the way the shape of the solution changes when you keep the initial values fixed, but vary the parameter .

(e) Based on your calculations above, describe the way the shape of the solution changes when you fix  and ห™z(0), but vary z(0).

D. Williams, Summer 2005 Page 1 of 2

AMATH 301 Due Thursday, 08/04/05 Homework #

  1. Boundary Value Problems. Consider the boundary value problem

(1 + x)yโ€ฒโ€ฒ^ + yโ€ฒ^ = f (x), y(0) = 0, y(1) = 3. (3)

(a) The differential equation is said to be homogeneous when f (x) = 0. Use the shooting method to solve the homogeneous equation with the given boundary values.

(b) The differential equation is said to be inhomogeneous when f (x) 6 = 0. Suppose the inhomogeneous term is

f (x) = 150 cos (5ฯ€x) โˆ’ 15 x.

Use the shooting method to solve the inhomogeneous equation with the given boundary values.

(c) Now solve the homogeneous and inhomogeneous problems using the direct solve method discussed in class. Also follow the instructions below.

  • For both the homogeneous and inhomogeneous problems, use four different grids. Define the grids with n = 8, n = 16, n = 25 and n = 50 subintervals.
  • For both the homogeneous and inhomogeneous problems and for each value of n, plot the calculated solution in its own subplot of a 2 by 2 subplot array (one array for homogeneous, one array for inhomoge- neous).
  • For the homogeneous problem and for each value of n, also plot the exact solution y(x) = (^) log(2)^3 log(1 + x) as a comparison to the numerically calulated solutions.
  • For the inhomogenous problem and for each value of n, plot a highly- accurate numeric solution calculated with a shooting method to com- pare against the solutions calculated with the direct method (the exact solution can be calculated, but itโ€™s a ridiculously complicated looking function). To achieve high accuracy, use the commands TOL=1e-13; options=odeset(โ€™RelTolโ€™,TOL,โ€™AbsTolโ€™,TOL); [T Y]=ode45(@odefunc,xspan,ivals,options); with the shooting method, where (as usual) odefunc is a function defined in a separate .m file that calculates the ODE, xspan is the x- interval over which we want the solution, ivals are the initial values and options are the high-accuracy error tolerances.

D. Williams, Summer 2005 Page 2 of 2