--------------------------------------------------------------------------------
Wed Apr 28 20:03:37 MDT 2004

The following matlab script works out all the critical points
with their eigenvalues and eigenvectors. See if you can adapt it to
do the rest of the homework! 


% script hw13_20
clear all
xp = sym('6*x1 - 5*y1 +x1^2');
yp = sym('2*x1-y1+y1^2');
[x,y] = solve('6*x - 5*y +x^2 = 0','2*x-y+y^2 = 0')
x0 = eval(x);
y0 = eval(y);
J = jacobian([xp;yp]);
n = length(x0)
for i = 1:n
    sprintf('------------------------')
    i
    x1 = x0(i);y1 = y0(i);
    [x1,y1]
    a = eval(J(1,1));
    b = eval(J(1,2));
    c = eval(J(2,1));
    d = eval(J(2,2));
    A = [a, b;c, d]
    [V,D]=eig(A)
end

--------------------------------------------------------------------------------
Mon Apr 26 23:13:16 MDT 2004
they work exactly the same way; I'll explain in class tomorrow
 Vageli
PS: try this, for example, to get the plot I did in class
(de: x"-x+x^2=0)
%-------------------------
function xp = f(x,y)
    xp = y ;

  function yp = g(x,y)
    yp = x-x.^2; % need x.^2 because plotting treats this as vector
%-------------------------

> How are we to plot numbers 20 and above. they have X^2 and Y^2 
> making the mat not a square, which is a parameter on the program you gave.

--------------------------------------------------------------------------------
Homework due this week: (due on Thursday--I will have solutions ready so
you can use them to study for exam! No late homeworks will be accepted this
week) 
                        WEEK 13
25( 4/20) 6.1-2, Phase plane and stability
26( 4/22) Near-linear systems and critical points
          6.2, p.389 (1*,4*,6*,7*,10*,20*,21*,30*,32*)
                     (use draw.m to draw phase portraits)
--------------------------------------------------------------------------------
Tue Apr 13 12:46:35 MDT 2004 : update on homework due Thu. April 15
I goofed here, I was under the impression problems 35, 36, Sec. 5.4 were giving
distinct eigenvalues.
 Let us substitute two problems with distinct eigenvalues, here they are:
21( 4/ 6) Eigenvalues, eigenvectors; Real or complex eigenvalues
          Sec. 5.2 p.312(1,2*,8,9*,11,12*, 41*, 45*) (NOTE CHANGES!!!)
22( 4/ 8) Review of eigenvalues; Real equal eigenvalues
          Sec. 5.4 p.340(1,2,3*,4*) (NOTE CHANGES!!!!)
 Sorry for this confusion! You can solve this with the matlab commands I gave
in class. I will post a script for direction fields tonite.
--------------------------------------------------------------------------------
Thu Mar 25 12:10:10 MST 2004
 SInce I will not have solutions available before I return next Tuesday,
the homework that was due today will be extended to next Thursday.
If you have already turned it in but are missing some problems, you can turn 
them in with the next assignment, next Thursday.
Next week's homework:
Sec 3.5 : 9*, 10, 13*, 17, 23*, 26, 31*, 32*, 33*, 35
--------------------------------------------------------------------------------
{6} Sat Feb 21 14:29:00 MST 2004
{Q}: i was doing number 28 in matlab but keep getting error
that i cant figure what wrong with it.  
> THis is the matlab in my computer at home and i have the file in my directory
as well.

{A}: here is problem 31, p.444, which is very similar
(if you use Matlab to get the answers for these, I will still
expect that you work them out using partial fractionsi):
>> F = sym('(10*s-3)/(25-s^2)')
 
F =
 
(10*s-3)/(25-s^2)
 
>> f = ilaplace(F)
 
f =
 
-47/10*exp(5*t)-53/10*exp(-5*t)

-----------------------------------------
and here is the partial fractions version:
F(s) = (10*s-3)/(25-s^2) = A/(s-5) + B/(s+5)
A = (s-5)*F(s)|_(s=5) = -47/10
B = (s+5)*F(s)|_(s=5) = -53/10
f(t) = A*exp(5*t) + b*exp(-5*t)

--------------------------------------------------------------------------------
{5} Sat Feb 21 13:51:26 MST 2004
You can find a link on the page to using Matlab to compute Laplace transforms
and their inverses. I will discuss it more in class, and it will be easier 
to get it if you try it on your own beforehand. Have fun!
--------------------------------------------------------------------------------
{4} Tue Feb 10 22:34:49 MST 2004
{Q}:
> There is an error on line 26 of the Euler code.  The error is in the
> line with the direction field command that you told us not to modify.
>
> The error reads as follows:
>
> ??? Undefined function or variable 'df'.
>
> Error in ==> C:\matlabR12\work\euler.m
> On line 26  ==>   df(@f,X1,Y1,'x','y','dirfield','r',0);

{A}: this is most likely caused by matlab not finding df.m, the function
that produces the direction field plots. It should be saved in the same
working directory as your scripots euler.m and impeuler.m  and you should
click
file --> set path
to add that directory to the matlab path.
Then on the matlab command window
type, say:
euler(-2,1,2,100)
and you will see a window open with the trajectory plotted on a background
of a direction field plot.

--------------------------------------------------------------------------------
{3} Wed Feb  4 01:07:20 MST 2004
Q:                   concerning problem 64 in section 1.4.  This is a
problem dealing with torricelli's law.  so i was using the equation volume=
area*y. considering the area to be, area=pi*radius^2, this differential
equation was constructed:

                                (dv/dt)=pi * [ 1 - (sqrt y)/2] * (dy/dt)

the statement:     1- (sqrt y)/2  was a figured equation to account for
the change of the radius of the container as it empties.  as well, pi
indicates the value 3.14.....

where it is given in the problem statement that (dy/dt) = 4 in/hr.  also
the initial condition is stated y(1) = 4 .so the question is, am i on the
right track, and if so what may need to happen to find the value of the
hole of radius r?
------------------
A: use eq. 24,
  A(y) dy/dt = -a sqrt(2 g y)  where a = pi*r^2 the area of the aperture
now A(y) = pi x^2 = pi g(y)^2 and you are given that the rate of
emptying is constant, dy/dt = -4in/hr = - (1/3) ft/hr
You get an eguation involving g(y) and the unknown radius r (all other
quantities are known). We also know that when y = 4ft, g(y) = 1ft.
This gives enough info to get r and g(y)

--------------------------------------------------------------------------------
{2} Sat Jan 31 00:08:58 MST 2004
    Note the solution to the problem 28, 1.2, contains an error,
since I assumed the ball was thrown straight up, rather than straight down.
This gives a longer time of travel, but the same velocity when the ball
hits the ground. Why?
--------------------------------------------------------------------------------
{1} Sat Jan 24 01:13:11 MST 2004
Q:   I am having a little trouble formulating an
equation for  number 44 on page 18 of section 1.2 for our first
assignment.  if you could give any hints as to how to begin
with this problem, I appreciate any help that you are able to offer.

A:   In the police test:
The car is moving along the x direction. At t=0 it is at location x=0 and
has speed v=25mph. It has constant (unknown) acceleration equal to -a
(i.e. it deccelerates). Relate its velocity to acceleration, its position to
its velocity (just like we did for the free-fall problem, with -a instead of g),
and solve these differential equations to find relationships giving the 
velocity and position as a function of time. 
 Now use these relationships with v(travel) = 0 and x(travel) = 45'
to determine the time of skidding, t=travel, and the decceleration. 

Once you know the decceleration, you can do the problem over, this time with 
unknown initial velocity. For a length of travel determined by the original 
skidmarks to be 210 feet, you can solve for the initial velocity. 
--------------------------------------------------------------------------------
