3rd 3 week block

December 4, 2008

This week, I am working on systems of linear differential equations. A line can be defined as all multiples of any non zero vector. In other terms, if you have a vector 4i+3j ,and you multiply it by a scalar of 5 and -5 respectively, that vector would be extended by five times tis length it the positive and negative directions, yielding a larger vector of the same size. As those scalars approach \infty ,you yield a line extending in the positive and negative directions of your original vector, with infinite magnitude, which is simply a line.

Vector fields, are vectors set up with variables multiplying the i and j parameters. Consider the vector field (x+y)i+xj . This vector field looks like this:

Notice the flow in this example:In the first quadrant, the vectors seem to curl away form the origin and increase in magnitude.  In the second quadrant, some vectors flow away into the third quadrant and increase in magnitude, while others flow into the first quadrant.  In the third quadrant, all vectors seem to flow straight away from the origin and increase in magnitude.  In the fourth quadrant, some vectors will flow into the first quadrant, and others flow into the third. It appears that in the bottom left and the top right, the vectors magnitude increase and flow away from the origin.  The vectors appear to flow out from a certain line in each quadrant, these lines are called invariant lines because they are lines where no vectors vary in direction.

In the vector field above, we can solve for the invariant lines in the following way: set \frac {dx}{dt}=x+y=\lambda x. Where \lambda is a constant, and the slope of one of the invariant lines. We then set our other differential equation \frac {dy}{dt}=x=\labmda y$. After doing this, you will find that we can solve for lambda by substitution, and we’ll get a quadratic of: \lambda^2-\lambda-1,which has two distinct roots of \lambda \approx -1.61803 and 0.61803. This may look familiar, as it is the the negative of the Golden Ratio, otherwise denoted as - \phi. These values for lambda are called eigenvalues, the value of the constant lambda multiplied by x or y in either case. This will get us the slopes and the equations of the invariant lines.  The lines flow directly through the origin, so their equations are just y=mx .  So, the equations of these invarient lines are :y=- \phi x,and y=0.61803x .  The graph below allows us to see the invariant lines graphed with the vector field plot:equationsgraph

Part 2

Since we will always get a quadratic for the eigenvalue equations, you may recall that there are 3 cases for a quadratic equation. Either it will have 2 real roots, one real root, or two complex (no real)roots. In this part we will examine the three cases.

We have already examined what happens when there are two real roots. There are two distinct invariant lines,where the direction of the vectors do not vary. When there are two complex roots, it is logical to assume that there will be no invariant lines, because the solutions for lambda do not lie on the real Cartesian plane. Consider the vector fields of these two linear differential equations: \frac {dx}{dt}=2x-5y , and \frac {dy}{dt}=x-y . If we set these two equations to \lambda x and \lambda y respectively, we will get two complex solutions: \frac {1+\sqrt{-11}}{2} , and \frac {1-\sqrt {-11}}{2} . Using Mathematica, we can see that this equation will form a spiral about the origin, and show no invariant lines whatsoever.

In the case above, there are two complex roots.  Now let’s consider a case where the roots will be purely imaginary.  Consider the case with these differential equations: \frac {dx}{dt}=3y, and \frac {dy}{dt}=2x $.  Setting each equation equal to $latexc \lambda x$, and \lambda y respectively, gives us:  _________________

Notice how the vectors in this figure seem to always be changing direction about the origin. This would mean that there are no invariant lines, which makes senes since the eigenvalues were found to be complex.

Consider the vector fields of these two differential equations: \frac {dy}{dt}=-2x+y and \frac {dx}{dt}=2y. If we set each of these equations equal to \lambda x and \lambda y respectively, we will get only one distinct eigenvector \lambda =1. Refer to the vector field below:eigen1

We can see some interesting activity in this graph. The vectors seem to curl into the origin and decrease in length exponentially. We can see that the origin is the center point of this activity, and that all points seem to coalesce and curl into the origin. This only gives us one unique solution, because \lambda =1, the equation of the only invariant line is y=x. Solving these differential equations using the “dsolve” method in matlab yields the following results for the differential equations \frac {dy}{dt}=-2x+y and \frac {dx}{dt}=2y are 2x+c(e^t) ,and insert formula here.

4th 3 week block

December 4, 2008

This week I was asked to work on Laplace transforms.

Laplace was a mathematician who invented a method for solving linear differential equations.  He would transform a differential equation into an integral with the form of: \int\limits_{0}^{\infty} e^(-st)*x(t)\, dt , for some value of s.  If the function converges, then we will have the LaPlace solution for the differential equations.  If the function does not converge, then we will not have a solution to the differential equation by the LaPlace method, but the solution still may exist.  Using properties of LaPlace transforms along with a little bit of algebra, this can be reduced to : \mathscr {L} [x]= \frac {1}{(1+s)^2}+\frac {A}/(1+s) .  Where A is x(0).

Solving differential equations by the LaPlace method in Matlab:

I was asked to consider the following differential equations and solve them in matlab using LaPlace transforms:

\frac {dx}{dt} +x=e^-t  This equation is a non homogeneous differential equation, meaning the right hand side of the equals sign is not zero.  Using properties of LaPlace equations, we can take the LaPlace transform of all the elements in this equation: \mathscr{L} [\frac {dx}{dt}+\mathscr{L} [x]=\mathscr{L} [e^-t] .  Using matlab, we take the inverse laplace transform, which in the case above will solve for x(t).  Matlab generates the following result for this differential equation: \frac {t}{e^t} +\frac {A}{e^t}.      Looking at the differential equation latex \frac {dy}{dx}+y=cos(x)$, I solved this function using matlab as well.  This is a non homogeneous situation, because the right hand side is not equal to zero.  Using the inverse laplace transform in this situation in matlab we get an answer in the form of a dirac function, which is a somewhat of a chaotic function.  I then attempted to  get a simpler answer, and was refered to using mathematica to take the laplace transform and split it into partial fractions, and addd the results for your answer.  I used matlab, and acheived the following results: \frac {3t}{e^(2t)}+\frac {1}{e^(2t)}

The next situation is

Second 3 week block

October 11, 2008

I am working on systems of non-linear differenital equations during this three week block; specifically, the Lorenz equations. For a very long time, most physicists and mathematicians believed that everything that happens in the universe can be predicted by specific equations and by the laws of physics. A mathematician Edward Lorenz came up with three equations in which it is impossible to predict where a certain moving point on the graph of one will be over a time frame t. These equations are: \frac {dx}{dt}=\sigma (y-x),\frac {dy}{dt}=x(\rho-z)-y,\frac {dz}{dt}=xy-\beta z . \sigma , \rho , and \beta are all positive constants. For certain values of these constants,the solutions may be chaotic, which means that a point’s path along the curve cannot be predicted, thus throwing the idea that every event in this universe can be predicted, right out the window!

Using Microsoft Excel, we can use Euler’s method for these differential equations, just as it was done in the first three week block. This chart shown below shows examples for \rho , \sigma and \beta equaling constants, and random values for x(t), y(t) and z(t). The chart was then graphed, as seen below also:

As you can see from the graphs below, when x(t), y(t) and z(t) are plotted with respect to each other, the solution graphs are chaotic, just as Lorenz predicted. But, Euler’s method for solving ODEs is not adequate enough to show a solution on excel, because it can only graph the equations in 2 dimensions. I will use Matlab to show what these equations look like when graphed in three dimensions.

Using Matlab, we can view the Euler approximation of a system of ODEs. Matlab allows us to see what all three Lorenz equations look like, when graphed together using Euler’s method:The topmost figure seen here, is what happens when the Lorenz equations, \frac {dx}{dt}, \frac {dy}{dt} and \frac {dz}{dt} are graphed in 3D space. The bottom most figure shows a 2D graph of x(t), y(t) and z(t) graphed with respect to time (t).

Although we can see Euler’s method graphed in three dimensions in Matlab, Euler’s method is still an approximation. While graphing, even with very small \Delta t , we still may get to the point where we do not know what the graph actually looks like. Matlab has a function called ode45, which will give a much better approximation of the ODE than Euler’s method ever will. In this example, Euler’s method works fine for a while, but at a point, it will become very erroneous. The Graph below shows the graph of the Lorenz equations in three dimensions, using the ode45 Matlab approximation:lorenzdemo

In conclusion, some non-linear ODEs cannot be solved using any mathematical methods, and the Lorenz equations cannot be. The ode45 method in matlab is the best way to see a graphical approximation of the differential equations, because Euler’s method is an approximation, that will fail at a certain point because you will not be able to figure out what the graph looks like when x(t), y(t) and Z(t) approach \infty .

Predator Prey Models

Predator Prey Models are special non linear differential equations similar to those of the Lorenz equations, they are chaos equations graphed with respect to time.  i have been having a great deal of difficulty using matlab, the code keeps generating errors and it has proven very difficult to do.



9/9/08

August 26, 2008

I am working on the differential equation \frac{dy}{dx}=\frac {y^2+1}{x^2+1}

Euler’s method for solving differential equations states :\frac{y(x+\Delta x))-y(x)}{\Delta x} \approx \frac {dy}{dx}. Using this method, we can approximate the plot of a differential equation knowing an initial condition of \frac {dy}{dx} and letting \Delta x be equal to a small interval such as .1, .01 etc. For very small changes in x, this will tell us the slope of points on the function.

Using Euler’ method for the equation above, with the initial condition of y(0)=1 the following is true: y(x+\Delta x)=y(x)+\frac {y^2+1}{x^2+1}\Delta x. This is found by manipulating Euler’s equation to be y(x+\Delta x)=y(x)+\frac {dy}{dx}\Delta x and substituting \frac {dy}{dx} with our differential equation. This just gives us an easier way to represent the function, and allows us to solve for \frac{dy}{dx} easier.

Using matlab with the dsolve function, I yielded the result for this differential equation: tan(atan(x))+C1 where c is any constant. atan means arctan in matlab. So this solution can be simplified to y= x+c where c is any constant. This seems to be correct, as the meshgrid command yields a graph of many lines with the same slope:

meshgrid of my Differential Equation

meshgrid of my Differential Equation

This result shows the set of all solutions for this differential equation. Each line has the slope of 1 and each line is shifted up, due to the fact that there is always an arbirtary constant C.

Also using Euler’s method on Microsoft Excel, I was able to portray a statplot and a graph of my formula. Using the starting point (1,1), you could clearly see the solved differential equation of y=x+C. For \Delta x=.000001, you could see that the arbitrary constant C was equal to 0.5, and you could see that the differential equation solved using the dsolve function in Matlab of y=x+C holds true. So at the point (1,1), y= x+0.5

Additional Notes: I encountered a problem in Matlab when trying to plot the function using the meshgrid command. A warning popped up stating that the matrix was singular, meaning Matlab had a problem with the differential equation. This error usually occurs when the function approaches an asymptote; however the functions denominator can never be zero, because for all real numbers, x^2+1 can never equal zero. Therefore, the denominator will never be zero in this graph. The reason why this error is occurring was a mystery. The error was resolved however, you must put a period after the expression in the numerator and matlab will carry out the meshgrid command.


Follow

Get every new post delivered to your Inbox.