Professional Documents
Culture Documents
In[1]:=
j-1
k=1
k=j+1
A = {{5, 1, 2},
{1, 4, - 2},
{2, 3, 8}};
In[3]:=
b = {19, - 2, 39};
In[4]:=
In[5]:=
gs[A, b, xinit]
The error for each X is:
-8
{-6.12272 10
, -6.76053 10
-7
-8
, 7.10333 10
Problem 2
T ' (t) = k1 (T(t) - Ta ) + k2 (T(t) - T ) + P
equation =
T '[t] k1 T[t] - A - c Cos
Pi
12
+ k2 (T[t] - Tw) + P;
t
12
12
-P+k1 A+k2 T
k1 +k2
Sin
Pi
12
t -
Sin 12 t1+
2
144 (k1 +k2 )2
2
Cos 12 t
- P + k1 A + k2 Tw
k1 + k2
144 k1 + k2
Pi2
12
(k1 + k2) 12 k1 + 12 k2 - 12 k1 + 12 k2 +
Cos
Pi
12
1+
144 k1 + k22
Pi2
Problem 3
Here, we have the differential equation: y - y = 0. If we set the initial conditions to y(0)=1 and y(0)= -1,
we obtain the following solution and graph.
In[6]:=
Out[6]=
In[7]:=
0.3
Out[7]=
0.2
0.1
10
Next, if we solve the same differential equation with initial conditions of y(0)=1.001 and y(0)= -0.999,
we obtain a different solution and a completely different graph.
In[8]:=
Out[8]=
In[9]:=
In[10]:=
6
Out[10]=
10
This is known as chaos theory. A small change in initial conditions can lead to a huge change down the
road. In this particular example, the original intial conditions of (1) and (-1) caused the solution to
reduce into a decaying function because the C1 went to zero. However, in the second set of initial
conditions, the growth function and the decaying function made its way into the solution, making the
graph completely different the second time around because the growth function took over.
Problem 4
a)
In[11]:=
In[12]:=
Now to put the functions of Y and their derivatives in a matrix 3x3, because it is third order.
In[19]:=
trix = {{y1[x], y2[x], y3[x]}, {D[y1[x], x], D[y2[x], x], D[y3[x], x]},
{D[y1[x], {x, 2}], D[y2[x], {x, 2}], D[y3[x], {x, 2}]}};
In[20]:=
Out[20]//MatrixForm=
So now we must find the Wronskian, which is the determinant of this matrix.
In[21]:=
Out[21]=
WW = Det[trix]
- y3[x] y2 [x] y1 [x] + y2[x] y3 [x] y1 [x] + y3[x] y1 [x] y2 [x] y1[x] y3 [x] y2 [x] - y2[x] y1 [x] y3 [x] + y1[x] y2 [x] y3 [x]
Now we must make some constraints to solve our particular solution. First of all, our particular solution
is defined by:
In[22]:=
The constraints I will make are in order to get rid of any term associated with the deriative of j (i.e. j', j'').
This means:
In[23]:=
similarly:
In[24]:=
This leaves us with the following equations for the particular solution and its derivatives:
In[25]:=
In[14]:=
In[15]:=
After this, we need to find the Wronskian of y1, y2, and y3. This is done using cramers rule. The
matrix will consist of the same matrix as seen above, but the column for each respective y will be
replaced with a column of (0,0,g(x))T. The g(x) is in the third row because it corresponds to the second
derivative, or the last row in the Wronskian matrix. To simplify this, we can pull out the g(x) from the
matrix and put it into the final equation later. So the Wronskian for each function of y will be equal to the
determinant of the respective matrix. By doing this, we will receive three determinants of matrices that
will correspond to the three functions y (y1, y2, y3):
In[26]:=
Now finally, we can obtain our particular solution by the sum of the integrals of dividing each y-Wronskian by the total Wronskian, and multiplying by the g(x) for each one:
Yp = nk=1 yk (x)
Wk (x)
W(x)
g(x) x
W1 (x)
W(x)
g(x) x + y2 (x)
Out[29]=
W2 (x)
W(x)
w2
WW
g(x) x + y3 (x)
w1
WW
W3 (x)
W(x)
g(x) x
g[x], x +
w3
WW
g[x], x
(- y3[x] y2 [x] y1 [x] + y2[x] y3 [x] y1 [x] + y3[x] y1 [x] y2 [x] y1[x] y3 [x] y2 [x] - y2[x] y1 [x] y3 [x] + y1[x] y2 [x] y3 [x])) x y1[x] +
y2[x] y3 [x] y1 [x] + y3[x] y1 [x] y2 [x] - y1[x] y3 [x] y2 [x] y2[x] y1 [x] y3 [x] + y1[x] y2 [x] y3 [x])) x y2[x] +
y2[x] y3 [x] y1 [x] + y3[x] y1 [x] y2 [x] - y1[x] y3 [x] y2 [x] y2[x] y1 [x] y3 [x] + y1[x] y2 [x] y3 [x])) x y3[x]
B)
Now for the solution of the differential equation as given by: y - 2y - y + 2y = e 4 x
In[30]:=
y1[x] = E ^ 2 x;
y1 '[x] = D[y1[x], x];
y1 ''[x] = D[y1 '[x], x];
y2[x] = E ^ x;
y2 '[x] = D[y2[x], x];
y2 ''[x] = D[y2 '[x], x];
y3[x] = E ^ (- x);
y3 '[x] = D[y3[x], x];
y3 ''[x] = D[y3 '[x], x];
g[x] = E ^ (4 x);
In[43]:=
Out[43]=
In[44]:=
Out[44]=
characteristic = L ^ 3 - 2 L ^ 2 - L + 2 0
2 - L - 2 L2 + L3 0
Factor[characteristic]
(- 2 + L) (- 1 + L) (1 + L) 0
Solve[characteristic]
{{L - 1}, {L 1}, {L 2}}
Therefore: 1 = -1, 2 = 1, 3 = 2
Now using the equation yh as derived in part a:
In[45]:=
Out[45]=
yh
C3 -x + C2 x + C1 2 x
And now for the particular solution, we can use the formula for yp as derived in part a:
In[46]:=
YParticular
4 x
Out[46]=
30
Therefore our final general solution is given by the homogeneous solution plus the particular solution, Y
= Yp + Yh
In[41]:=
Out[41]=
Ygeneral = YParticular + yh
C3 -x + C2 x + C1 2 x +
4 x
30
C)
And now to check the answer by utilizing the DSolve function:
In[42]:=
Out[42]=
4 t
30