Reminder

Old HW is being flushed.

Please pay attention to due dates and exams

Canvas nags automatically.  It is your own fault if you turn it off.

WebAssign will nag. Instructions were in a Canvas announcement.

2.1: Direction Fields

You can make a picture of every solution of a 1st order ODE y'=f[x,y] in a couple of different ways.

StreamPlot makes a pretty picture by joining up the little bits of straight lines witht he specified vectors.

f[x_,y_]:= x Sin[x y]
StreamPlot[{1,f[x,y]}, {x,-3,3},{y,-3,3}]

VectorPlot makes a clumsy looking pic like the text.

f[x_,y_]:= x Sin[x y]
VectorPlot[{1,f[x,y]},{x,-3,3},{y,-3,3},
StreamPoints->10,
StreamStyle->Red]

If you want the arrows all the same length

f[x_,y_]:= x Sin[x y]
VectorPlot[{1,f[x,y]},{x,-3,3},{y,-3,3},
VectorScale->{Automatic,Automatic,None},
StreamStyle->Red,
StreamPoints->{
{-2,1}
}]

2.1: Autonomous 1st Order ODEs 
aka Boring Direction Fields

An autonomous ODE has no visible independent variable (in the real world usually time) in it.  It looks like y'=f[y]. The direction field is boring because it does the same thing all the way along

f[t_,y_]:= y Sin[y]
StreamPlot[{1,f[t,y]}, {t,-3,3},{y,-7,7},
FrameLabel->{"t","y"}]

Zeros of f are called equilibrium solns.  It is stable if both sides head inwards  It is unstable if both sides head outwards.  It is semi-stable if one side heads in and the other heads out.

2.2 Separable Equations

Just like in Calc an ODE of the form
	dy/dx = g[x]h[y]
is separable.  You get the general solution by separating the variables
	1/h[y]dy = g[x]dx
and integrating
	∫((h[y])^(-1))dy = ∫g[x]dx+C
You only need to put a constant of integration on one side.

On an exam you are welcome to use a calculator to do integrals.  For me it is always faster less error prone to just do simple integrals manually.

As always: You can use DSolve to check answers; You plug Initial Conditions in to general solutions to determine constants.

Example 1:  Solve y'=y sec(ln(y)) ((sec(x))^2)   with y(1)=2

Integrate[(1/(y Sec[Log[y]])),y]
Integrate[((Sec[x])^2),x]

General Solution is: ({{Sin[Log[y]], =, Tan[x]+C}})
Plug in IC:  Sin[Log[2]]=Tan[1]+C  so C=Sin[Log[2]]-Tan[1]≈-0.918

2.3 Linear 1st Order ODE

A linear 1st order ODE has the form
	(Subscript[a, 1])[x]y'[x]+(Subscript[a, 0])[x]y[x]=g[x]
The standard form is 
	y'[x]+P[x]y[x]=f[x]
These are very important ODEs.

Solution technique find a multiplier (called an intergating factor and always called μ[x]) that collapses the right hand side to a single product rule term.
	({{y'[x], +, P[x]y[x], =, f[x]}, {μ[x]y'[x], +, μ[x]P[x]y[x], =, μ[x]f[x]}, {μ[x]y'[x], +, μ'[x]y[x], =, μ[x]f[x]}})
There is one bit of wishful thinking here but I can just make it an equation 
	({{μ'[x], =, μ[x]P[x]}})
for μ[x] and then it become part of the procedure. The solution of this equation is 
	({{μ[x], =, (Subscript[C, 0])(e^(∫p[x]dx))}}) 
and since multiplying an ODE by a non-zero constant does not do anything we might as well keep life simple and take (Subscript[C, 0])=1. Since I fixed this 
	({{μ[x]y'[x], +, μ'[x]y[x], =, μ[x]f[x]}, { ,  , (μ[x] y[x])', =, μ[x] f[x]}})
and I integrate to get the general solution
	({{μ[x]y[x], =, ∫μ[x]f[x]dx, +, C}})
As always if I have an initial condition I plug it into the general solution.

Example 2:  Solve ({{x y'-2 y= , 3(x^4)}})  with y( 1 )=2

Standard Form is:
	({{y', +, (-2/x)y, =, 3(x^3)}})
So p=-2/x and f=3(x^3).
So μ=(e^(-2 ln(x)))=(x^(-2)).  
Mulitplying by μ gives the equation
	(x^(-2))y'-2(x^(-3))y=3x
As promised the y terms collapse to 
	({{((x^(-2))y)', =, 3 x}})
which we integrate to the general solution. 
	(({{(x^(-2))y, =, (3/2) x}})^2)+C
Plugging in the IC gives
	2=(3/2)+C
or C=2-(3/2)