# 2250-1 7:30am Lecture Record Week 4 S2012

Last Modified: January 30, 2012, 06:01 MST.    Today: July 17, 2018, 17:25 MDT.

## Jan 30: Jules Verne Problem. Numerical Solutions for y'=F(x)

Jules Verne problem. A rocket from the earth to the moon.
Slides: Jules Verne Problem (127.3 K, pdf, 03 Mar 2012)
```Numerical Solution of y'=f(x,y)
Two problems will be studied, in maple labs 3, 4.
First problem
y' = -2xy, y(0)=2
Symbolic solution y = 2 exp(-x^2)
Second problem
y' = (1/2)(y-1)^2, y(0)=2
Symbolic solution y = (x-4)/(x-2)
The work begins in exam review problems ER-1, ER-2, both due
before the first midterm exam. The maple numerical work is due
much later, after Semester Break. Here's the statements for the
exam review problems, which review chapter 1 methods to find the
symbolic solutions:Exam Review: Problems ER-1, ER-2 (109.3 K, pdf, 10 Dec 2011)```
```Numerical Solution of y'=F(x)
Example: y'=2x+1, y(0)=1
Symbolic solution y=x^2 + x + 1.
Dot table. Connect the dots graphic.
How to draw a graphic without knowing the solution equation for y.
Making the dot table by approximation of the integral of F(x).
Rectangular rule.
Dot table steps for h=0.1.
Answers: (x,y) = [0, 1], [.1, 1.1], [.2, 1.22], [.3, 1.36], [.4, 1.52],
[.5, 1.70], [.6, 1.90], [.7, 2.12], [.8, 2.36], [.9, 2.62], [1.0, 2.90]
The exact answers for y(x)=x^2+x+1 are
(x,y) = [0., 1.], [.1, 1.11], [.2, 1.24], [.3, 1.39], [.4, 1.56],
[.5, 1.75], [.6, 1.96], [.7, 2.19], [.8, 2.44], [.9, 2.71], [1.0, 3.00]
```
``` Maple support for making a connect-the-dots graphic.
Example: L:=[[0., 1.], [2,3], [3,-1], [4,4]]; plot(L);JPG Image: connect-the-dots graphic (11.2 K, jpg, 12 Sep 2010) ```
```Rect, Trap, Simp rules from calculus
RECT
Replace int(F(x),x=a..b) by rectangle area (b-a)F(a)
TRAP
Replace int(F(x),x=a..b) by trapezoid area (b-a)(F(a)+F(b))/2
SIMP
(b-a)(F(a)+4F(a/2+b/2)+F(b))/6

The Euler, Heun, RK4 rules from this course: how they relate to
calculus rules RECT, TRAP, SIMP
Numerical Integration   Numerical Solutions of DE
RECT                    Euler
TRAP                    Heun [modified Euler]
SIMP                    Runge-Kutta 4 [RK4]

Example: y'=3x^2-1, y(0)=2 with solution y=x^3-x+2.
Example: y'=2x+1, y(0)=1 with solution y=x^2+x+1.
Dot tables,  connect the dots graphic.
How to draw a graphic without knowing the solution equation for y.

What to do when int(F(x),x) has no formula?
Key example y'=sqrt(x)exp(x^2), y(0)=2.
Challenge: Can you integrate sqrt(x) exp(x^2)?
Making the dot table by approximation of the integral of F(x).
Accuracy: Rect, Trap, Simp rules have 1,2,4 digits resp.
```
``` Maple code for the RECT rule, applied to quadrature problem y'=2x+1, y(0)=1.
# Group 1, initialize.
F:=x->2*x+1:
x0:=0:y0:=1:h:=0.1:Dots:=[x0,y0]:n:=10:

# Group 2, repeat n times. RECT rule.
for i from 1 to n do
Y:=y0+h*F(x0);
x0:=x0+h:y0:=Y:Dots:=Dots,[x0,y0];
od:

# Group 3, display dots and plot.
Dots;
plot([Dots]);
```
```Example for your study:
Problem:  y'=x+1, y(0)=1
It has a dot table with x=0, 0.25, 0.5, 0.75, 1 and
y= 1, 1.25, 1.5625, 1.9375, 2.375.
The exact solution y = 0.5(1+(x+1)^2) has values
y=1, 1.28125, 1.625, 2.03125, 2.5000.
Determine how the dot table was constructed and identify
which rule, either Rect, Trap, or Simp, was applied.
```

## Jan 31: Numerical Solutions for y'=f(x,y)

#### Second lecture on numerical methods

```Euler, Heun, RK4 algorithms
Computer implementation in maple
Geometric and algebraic ideas in the derivations.
Numerical Integration   Numerical Solutions of DE
RECT                    Euler
TRAP                    Heun [modified Euler]
SIMP                    Runge-Kutta 4 [RK4]

Numerical work maple L3.1, L3.2, L3.3, L4.1, L4.2, L4.3 will be
submitted after Semester Break. No numerical problems from ch 2
are assigned.
All discussion of maple programs will be based in the TA session
[Patrick].
There will be one additional presentation of maple lab details
in the main lecture. The examples used in maple labs 3, 4 are
the same as those in exam review problems ER-1, ER-2. Each has
form dy/dx=f(x,y) and requires a non-quadrature algorithm, e.g.,
Euler, Heun, RK4.
```
```Numerical Solution of y'=f(x,y)
Two problems will be studied, in maple labs 3, 4.
First problem
y' = -2xy, y(0)=2
Symbolic solution y = 2 exp(-x^2)
Second problem
y' = (1/2)(y-1)^2, y(0)=2
Symbolic solution y = (x-4)/(x-2)
The work begins in exam review problems ER-1, ER-2, both due
before the first midterm exam. The maple numerical work is due
much later, after Semester Break.Exam Review: Problems ER-1, ER-2 (109.3 K, pdf, 10 Dec 2011)```
```Examples
Web references contain two kinds of examples.
The first three are quadrature problems dy/dx=F(x).
The fourth is of the form dy/dx=f(x,y), which requires a
non-quadrature algorithm like Euler, Heun, RK4.

y'=3x^2-1, y(0)=2, solution y=x^3-x+2
y'=exp(x^2), y(0)=2, solution y=2+int(exp(t^2),t=0..x).
y'=2x+1, y(0)=3 with solution y=x^2+x+3.
y'=1-x-y, y(0)=3, solution y=2-x+exp(-x).
```
Introduction: Maple Labs 3 and 4, due after Semester Break.
Maple lab 3 S2012. Numerical DE (60.0 K, pdf, 09 Dec 2011)
Maple lab 4 S2012. Numerical DE (56.4 K, pdf, 09 Dec 2011)
References for numerical methods:
Manuscript: Numerical methods manuscript (149.9 K, pdf, 03 Mar 2012)
Text: Maple L3 snips S2012 (maple text) (5.0 K, txt, 24 May 2007)
Maple Worksheet: Maple L3 snips S2012 (maple .mws) (6.6 K, mws, 25 May 2007)
Text: Maple code for maple labs 3 and 4 (5.1 K, txt, 10 Dec 2011)
Maple Worksheet: Sample maple code for Euler, Heun, RK4 (1.9 K, mws, 21 Aug 2010)
Maple Worksheet: Sample maple code for exact/error reporting (2.1 K, mws, 21 Aug 2010)
How to use maple at home (6.8 K, txt, 28 Dec 2011)
Maple lab 3 symbolic solution, ER-1 solution. (184.6 K, jpg, 08 Feb 2008)
Transparencies: Sample Report for 2.4-3. Includes symbolic solution report. (175.9 K, pdf, 02 Jan 2010)
S2012 notes on numerical DE report for Ch2 Ex 10 (35.5 K, pdf, 09 Dec 2011)
S2012 notes on numerical DE report for Ch2 Ex 12 (51.8 K, pdf, 09 Dec 2011)
S2012 notes on numerical DE report for Ch2 Ex 4 (35.0 K, pdf, 09 Dec 2011)
S2012 notes on numerical DE report for Ch2 Ex 6 (47.9 K, pdf, 09 Dec 2011)
Sample Report for 2.4-3 (175.9 K, pdf, 02 Jan 2010)
Transparencies: ch2 Numerical Exercises 2.4-5,2.5-5,2.6-5 plus Rect, Trap, Simp rules (219.5 K, pdf, 29 Jan 2006)

## 1 Feb: Linear Algebraic Equations. No matrices. Section 3.1.

```Linear Algebraic Equations sections 3.1, 3.2
Frame sequences
Toolkit: combo, swap, multiply
Plane and space geometry
The three possibilities
Unique solution
No solution
Infinitely many solutions
Method of elimination
Example for a unique solution
x + 2y =  1
x -  y = -2
Example for no solution
x + 2y = 1
x + 2y = 2
Example for infinitely many solutions
x + 2y = 1
0 = 0
Parameters in the general solution
Differential equations example, problem 3.1-26
y'' -121y = 0, y(0)=44, y'(0)=22
General solution given: y=A exp(11 x) + B exp(-11 x)
Substitute y into y(0)=44, y'(0)=22 to obtain a 2x2
system for unknowns A,B that has the unique solution
A=23, B=21.
```
Prepare 3.1 problems for next collection. See problem notes section 3.1:
html: Problem notes S2012 (5.2 K, html, 08 Apr 2012)

## 2 Feb: Patrick

Exam 1 review, questions and examples on exam problems 1,2,3,4,5.
Murphy's Lecture, time permitting: Maple Lab 2, problem 1,2,3 details.
Exam 1 date is 23 Sep at 7:25am in WEB 103. Also possible are 20 Sep and 22 Sep, 12:50pm in JWB 335.
Sample Exam: Exam 1 key from S2010. See also F2009, exam 1.
Exams and exam keys for the last 5 years (18.9 K, html, 02 May 2012)

## 3 Feb: Frame Sequences. Three Possibilities. No matrices. Sections 3.2, 3.3.

```Maple lab 2 problem 1
Discussion: Option 1: Freezing pipes maple lab 2
Problem: u' + ku = kA(t)
Integration methods
Tables
Maple
```
Option 1: Maple Lab 2, Newton cooling freezing pipes (135.7 K, pdf, 09 Dec 2011)
Option 1: maple worksheet text freezing pipes (1.3 K, txt, 10 Dec 2011)
Option 2: Maple Lab 2, Newton cooling swamp cooler (135.7 K, pdf, 09 Dec 2011)
Option 2: maple worksheet text swamp cooler (1.3 K, txt, 10 Dec 2011)
For more on superposition y=y_p + y_h, see Theorem 2 in the link
Linear DE part I (152.7 K, pdf, 07 Aug 2009)
Manuscript: Linear equation applications, brine tanks, home heating (374.2 K, pdf, 28 Jul 2009)
Slides: Brink tanks (95.3 K, pdf, 04 Mar 2012)
Slides: Home heating (109.8 K, pdf, 04 Mar 2012)
```Lecture: 3.1, 3.2, 3.3
Frame sequences
Toolkit: combo, swap, multiply
Plane and space geometry
The three possibilities
Unique solution
No solution
Infinitely many solutions
Free variable
Signal equation
Echelon form
The last frame test
The last frame algorithm
A detailed account of the three possibilities
Unique solution == zero free variables
No solution == signal equation
Infinitely many solutions == one+ free variables
```
```How to solve a linear system using the toolkit
Toolkit: swap, combo, mult
Toolkit operations neither create nor destroy solutions!
Frame sequence examples
Computer algebra systems and error-free frame sequences.
How to program maple to make a frame sequence without errors.
```
```Solved Problems
Example 4 in 3.2
Back-substitution should be presented as combo operations in a
frame sequence, not as isolated, incomplete algebraic jibberish.
Technically, back-substitution is identical to applying the
frame sequence method to variables in reverse order.
The textbook observes that an echelon matrix as frame one is
a special case, when only combo operations are required to
determine the last frame. Then, and only then, does the last
frame algorithm apply to write out the general solution.
Problem 3.2-24
The book's answer is wrong, it should involve k-4.
See references on 3 possibilities with symbol k.
```

Beamer slides: 3 possibilities with symbol k (60.0 K, pdf, 31 Jan 2010)
Slides: 3 possibilities with symbol k (98.8 K, pdf, 03 Mar 2012)
Manuscript: Example 10 in Linear algebraic equations no matrices (460.2 K, pdf, 10 Feb 2012)
In all your solved problems, to be submitted for grading, please use frame sequences to display the solution, as in today's lecture examples. Expected is a sequence of augmented matrices. Yes, you may use maple to make the frame sequence. The maple answer check for the last frame is rref(A).

## 6 Feb: Augmented Matrix for System Ax=b. RREF. Last Frame Algorithm. Sections 3.3, 3.4.

```Maple lab 2 problem 1
Discussion: Option 1: Freezing pipes maple lab 2
Problem: u' + ku = kA(t)
Integration methods
Tables
Maple
```
Option 1: Maple Lab 2, Newton cooling freezing pipes (135.7 K, pdf, 09 Dec 2011)
Option 1: maple worksheet text freezing pipes (1.3 K, txt, 10 Dec 2011)
Option 2: Maple Lab 2, Newton cooling swamp cooler (135.7 K, pdf, 09 Dec 2011)
Option 2: maple worksheet text swamp cooler (1.3 K, txt, 10 Dec 2011)
For more on superposition y=y_p + y_h, see Theorem 2 in the link
Linear DE part I (152.7 K, pdf, 07 Aug 2009)
Manuscript: Linear equation applications, brine tanks, home heating (374.2 K, pdf, 28 Jul 2009)
Slides: Brink tanks (95.3 K, pdf, 04 Mar 2012)
Slides: Home heating (109.8 K, pdf, 04 Mar 2012)
```Review
Last frame test. The RREF of a matrix.
Last frame algorithm.
Scalar form of the solution.
Translation of equation models
Scalar equations to augmented matrix
Augmented matrix to scalar equations
Matrix toolkit: Combo, swap and multiply
```