MATH383: A first course in differential equationsApril 2, 2020

Homework 11

Due date: April 9, 2020, 11:55PM.

Bibliography: Lesson 21, Trench, 3.1-3.3

  1. Exercises 1-5, p. 106

  2. Exercises 1-5, p. 124

  3. Exercise 13, p. 108

  4. Exercises 13, p. 126

Solutions

Here is a template for this numerical methods homework.

1. Euler's method. Ex.1. y'=f(x,y)=2x2+3y2-2, y(2)=1, h=0.05.

(%i1) 

f(x,y):=2*x^2+3*y^2-2$

(%i2) 

h:0.05$ x0:2$ y0:1$

(%i5) 

for i:1 thru 3 do
  ( x1: x0+h, y1: y0+h*f(x0,y0), x0: x1, y0: y1,
    display([i,x1,y1]) )$

[i,x1,y1]=[1,2.05,1.45]

[i,x1,y1]=[2,2.1,2.085625] [i,x1,y1]=[3,2.149999999999999,3.07909974609375]

(%i6) 


              

2. Runge-Kutta method. Ex.1. y'=f(x,y)=2x2+3y2-2, y(2)=1, h=0.05.

(%i6) 

f(x,y):=2*x^2+3*y^2-2$

(%i7) 

h:0.05$ x0:2$ y0:1$

(%i10) 

for i:1 thru 3 do
  ( x1: x0+h,
        k1: h*f(x0,y0),
        k2: h*f(x0+0.5*h, y0+0.5*k1),
        k3: h*f(x0+0.5*h, y0+0.5*k2),
        k4: h*f(x0+h, y0+k3),
        y1: y0+(1/6)*(k1+2*k2+2*k3+k4),
        x0: x1, y0: y1,
    display([i,x1,y1]) )$

[i,x1,y1]=[1,2.05,1.550598189929713]

[i,x1,y1]=[2,2.1,2.469649728729797] [i,x1,y1]=[3,2.149999999999999,4.530350898626433]

(%i11)