Fourth 3-Week Block

December 16, 2008

(a) \frac{dx}{dt}+x=e^{-t}

(b) \frac{dy}{dx}+y=cos(x)

(c) \frac{d^2y}{dx^2}+4\frac{dy}{dx}+4y=0

(d) \frac{d^2x}{dt^2}-2\frac{dx}{dt}+5x=0

 

I then solved each equation using the laplace transform and plotted them and this is what I recieved.

(a) \frac{dx}{dt}+x=e^{-t}

q45(b) \frac{dy}{dx}+y=cos(x)

q46

(c) \frac{d^2y}{dx^2}+4\frac{dy}{dx}+4y=0

q47

(d) \frac{d^2x}{dt^2}-2\frac{dx}{dt}+5x=0

q48

The laplace transform is a great way to solve some differential equations.  I learned alot from this project it was a little difficult at first doing everything in mathlab.  But once I figured out what I needed to do and how to do it I was able to solve these problems.

Third 3-Week Block Parts 1 & 2

December 8, 2008

 The differential equations \frac{dx}{dt} = ax+by and \frac{dy}{dt} = cx+dy and the associated linear function T[(x,y)]=(ax + by , cx + dy) are expressed in:

 \left( \begin{array}{cc} a & b \\ c & d \end{array} \right) \left( \begin{array}{c} x \\ y \end{array} \right) = \left( \begin{array}{c} ax + by \\ cx + dy \end{array} \right) 

The constants a,b,c, and d are given values from -5 to 5 and the vector fields are generated.  We had to find the lines on the unit vecotrs and in order to do this we had to use the equations ax+by=\lambdax and cx+dy=\lambday.   Using substitution the quadratic (\lambda-a)(\lambda-d)-bc was obtained.  We then recieved the eigan values.  These values are then plugged back into the linear equation obtained from rearranging the the equation ax+by=\lambdax into y=\frac{\left(\lambda -a \right)}{b} x The vector fields below were produced with matlab. 

saddle-0-1-1-0

The first case encountered was the saddle.  This occurs when there are two real roots to the quadratic (\lambda - a)(\lambda - d) - bc    The values of the constants were: a=0, b=1, c=1, d=0.  The the eigan values were -1 and 1.   

 

 sink2

In this case the sink is produced when the eigan values are both negative real numbers.    The values of the constants were: a=-1, b=-1, c=-1, d=-2.  The eigan values were: -2.6180 and -0.3820

 

 source1

 The source can be done by having two positive real  eigan values.  The values of the constants were: a=1, b=1, c=1, d=2.  The eigan values were:     0.3820 and 2.6180

spiral-in-0-1-1-1

In this case the inward spiral is produced with constants that give a negative real value with an imaginary value and its conjugates eigan values.  The values of the constants were: a=0, b=-1, c=1, d=-1.  The eigan values were: -0.5000 + 0.8660i and -0.5000 – 0.8660i

 

spiral-out-0-1-1-1

 

 

 

In this case the eigan values mus be positive real values with an imaginary value and is conjugate.  The values of the constants were:  a=0, b=1, c=-1, d=1.  The eigan values were: 0.5000 + 0.8660i and 0.5000 – 0.8660i

center-0-1-1-0

 

In this case the circle occurs when the eigan values are strictly imaginary.  The values of the constants were:  a=0, b=-1, c=1, d=0.  The eigan values were: 0 + 1.0000i and 0 – 1.0000i

single-line-2-2-2-2

All in all there were many different cases for these constants.  As the constants changed so did the eigen values.  This project was successful.

 

Second 3-week block project

November 4, 2008

In this project I decided to work with microsoft excel first to make my table and plot the graphs.  All I did was plot in the numbers and dragged them down until I received enough variables to make a good graph. I had to use the Euler’s method and lorenz equations to do this.

Lorenz equations:

\frac{dx}{dt}=\sigma(y-x)

\frac{dy}{dt}=x(\rho-z)-y

\frac{dz}{dt}=xy-\beta z

Euler’s Method:

When using Euler’s method it does not give you an exact answer it can only give you an approximation. When choosing \Delta x you need to experiment to find what works. If you choose your \Delta x to be a small number then the graph may be very difficult to read because the area isn’t big enough. I had chosen \Delta x to be .01 in which the graphs came out to be readable.

I used \sigma =10, \beta = \frac{8}{3} and \rho = 28 to plot the graph and this is what excel came out with.

sigma: 10 t x(t) y(t) z(t)
rho: 28 0 0.383205 0.39771154 0.96382726
beta: 2.66666667 0.01 0.38465565 0.49733839 0.93964925
delta t: 0.01 0.02 0.39592392 0.59645417 0.91650498
    0.03 0.41597695 0.69771967 0.89442635

Graphs:

Graphing Euler’s Method and Lorenz equations using matlab

Ok this part was difficult at first because everytime I created an M file matlab could not find it. I tried many different things in order to diagnose the problem. I made sure all the files had .m after them and they did. Then it hit me and it was because of where the files were being saved. They were being saved in a different folder in which matlab could not find them. So I then saved them in the right folder and everything starting to work properly. I then graphed the files and this is what I got.

X(t), Y(t), Z(t)

The Rossler Attractor equations:

\frac{dx}{dt} = -y-z

\frac{dy}{dt} = x+ay

\frac{dx}{dt} = b+z(x-c)

Using matlab I was able to create the rossier attractor. I had to also make a .m file for this. There were a few problems at first because once again matlab could not find the file but this time the file was saved in the right directory. After once again diagnosing the problem I found that the m file had an error in it. So I then fixed the file and everything worked properly. Matlab came up with this after I plotted it.

euler_system.m

function [ t, y ] = euler_system( f, t_range, y_initial, nstep)

t(1) = t_range(1);

dt = ( t_range(2) – t_range(1) ) / nstep;

y(:,1) = y_initial;

for i = 1 : nstep
t(i+1) = t(i) + dt;
y(:,i+1) = y(:,i) + dt * feval ( f, t(i), y(:,i) );
end

plot(t,y)

plot3(y(1,:),y(2,:),y(3,:))

Rossler Attractor Graph:

Differential Equation 1st 3-week block

October 9, 2008

The differential equation that I have been working on is \frac{dy}{dx}=\frac{x-y}{x+y}.

The first step that I had taken was to use matlab to plot the diferential equation \frac{dy}{dx}=\frac{x-y}{x+y}. I have never used mathlab before so this was a tedious task. In mathlab everything must be case sensitive and there can be no syntax errors or it will not work.

My first step was to plot the exponential curve. To plot the curve I had to enter these following steps in matlab:

>> dsolve(’Dy=(x-y)/(x+y)’, ‘x’)
ans =
(-x*C1+(2*x^2*C1^2+1)^(1/2))/C1
(-x*C1-(2*x^2*C1^2+1)^(1/2))/C


>> sol1=dsolve(’Dy=(x-y)/(x+y)’,’y(0)=2′,’x’)
sol1 =
-x+2*(1/2*x^2+1)^(1/2)

>> subs(sol1,’x’,1)
ans =
1.4495

>> ezplot (sol1,[-5 5])
http://mth21202jeffrey.files.wordpress.com/2008/10/jeff-and-kevin1.jpg?w=450

After finding the curve for my equation I am able to find the point of the plot to complete the meshgrid. I had originally used the points -2 and 3; I received a few errors as you can see right below. >> ezplot (sol1,[-5 5])
>> [x, y]=meshgrid(-2:0.2:3, 0:0.2:4);
>> s=(x-y)/(x+y);
Warning: Rank deficient, rank = 2, tol = 1.3963e-13.
>> quiver(x, y,ones(size(S)),s), axis tight
??? Undefined function or variable ‘S’.

The program was trying to divide by zero which is not possible so the errors kept coming. So I decided to change the digits from 0 to 10,-10 which allowed the program to plot the graph. My partner and I had trouble uploading the pictures so they will be on here as soon as we can get it to work.  We finally figured out how to post the images so here they are.

//mth21202jeffrey.files.wordpress.com/2008/10/jeff-and-kevin2.jpg” cannot be displayed, because it contains errors.

Euler’s Method

The Euler’s method is \frac{dy}{dx}\approx \frac{y(x+\Delta x) - y(x)}{ \Delta x}.  I then worked out the problem a little bit and came out with y(x+\Delta x)=y(x) + \Delta x(-x(y+1)).  I then input this equation into excel and plotted the data.  This is what I got.

This came out to be a really good graph.  It’s identical to the mathlab one.  But as you can see with this one it is alot more clearer.


Follow

Get every new post delivered to your Inbox.