Section 9.2 Lecture Notes (Part 4)The goal in this activity is to investigate some modeling using systems of differential equations. Our firstexample will be an electrical circuit, so let's take a moment to recall the following laws.

The current I is the rate at which the charge Q flows. Consequently, .

Component Laws: The voltage is measured in volts, denoted by V. The current is measured in amperes,denoted by A.

Ohm's Law: We will let represent the voltage drop across a resistor. By Ohm's Law,

The resistance R is measured in ohms, denoted by Ω.

Faraday's Law: We will let represent the voltage drop across an inductor. By Faraday's Law,

The inductance L is measured in henrys, denoted by H.

Capacitance Law: We will let represent the voltage drop across an inductor. By the Capacitance Law,

The capacitance C is measured in farads, denoted by F.

Kirchoff's Voltage Law: The sum of the voltage drops around any closed loop in a circuit must equal zero.

Kirchoff's Current Law: The sum of currents flowing into or out of any junction equals zero. In the followingimage, note that the currents , , and are each flowing into the junction (red filled point).

Using Kirchoff's Current Law, we would write:

Another way of saying Kirchoff's Current Law is to say "the flow into the junction must equal the flow coming outof the junction. So is the flow into the junction in the picture above and there is no flow coming out ofthe junction, so the flow out of the junction equals zero. Let's look at another picture.

1

This time the flow into the junction is and the flow out of the junction is , so we would write:

Now, let's look at an example.

Example #1:Consider the following circuit.

Write a system that models the flow of the currents and .

Solution: Note that I is flowing into the junction point and and are flowing out of the junction point, so:

If we circle clockwise around the loop on the left containing the resistor and induction, by Ohm's Law andFaraday's Law, we get:

Now, let's substitute and and simplify.

2

We have our first equation. Now we need a second equation. This time we will loop clockwise around the outerloop containing the resistor and capacitor. By Ohm's Law and the Capacitance Law, we get:

Now, the current flowing through the capacitor is . The current is equal to the rate at which the charge is

changing, so , or equivalently, . Let's differentiate our last equation and insert this result.

Now, let's insert , differentiate, and manipulate a bit.

Now, how do we get rid of the on the right side of this last equation? The answer is, substitute our first

solution .

We now have our second equation, so our system of equations for the currents is:

3

Example #2:Using the equations in Example #1, suppose that ohms, henry, and farads. Assume the

initial currents at time are given by amperes and amperes.

Solution: Enter the values ohms, henry in our first equation.

Next, enter the values ohms, henry, and farads in our second equation.

Thus, our two equations are:

We can check these with Matlab.

syms I1(t) I2(t) R=2;L=1;C=1/8;eqns=[diff(I1,t)==-R/L*I1-R/L*I2;… diff(I2,t)==R/L*I1+(R/L-1/(R*C))*I2]

eqns(t) =

Same equations. Now, we can write this system in matrix form.

4

The trace is and the determinant is .

We can check this with Matlab.

syms lambda A=[-2 -2;2 -2];p=charpoly(A,lambda)

p =

solve(p,lambda)

ans =

Next, use our shortcut for finding the corresponding eigenvectors, subtracting λ from each diagonal element ofmatrix A.

Looking at the first row, the following vector will zero out the first row.

Choosing the eigenvalue , we get:

Because any multiple of an eigenvector is also an eigenvector, we will multiply this last result by and use:

5

We can check this with Matlab.

[V,D]=eig(sym(A))

V =

D =

Again, our eigenvector is a multiple of the Matlab's eigenvector. Let's multiply the second column of the matrix Vby .

-i*V(:,2)

ans =

That's our hand-calculated eigenvector. Because any multiple of an eigenvector is also an eigenvector, ourwork is correct to this point. Now, we substitute our eigenvalue and eigenvector to get a complex solution andexpand the result.

We can check our effort with Matlab.

syms t reallambda=-2+2i;v=[1;-i];z=exp(lambda*t)*v;real(z)

ans =

6

imag(z)

ans =

Same as our hand-calculated answers above. The real and imaginary parts of this complex solution gives us afundamental set of real solutions, so our general solution for our system is:

Now, our initial condition is:

Substituting this in our general solution gives us:

This makes us giggle! Note that this is equivalent to:

We never get this lucky. Now we can substitute and into our general solution.

Therefore, the following equations give us the currents in the circuit at time t.

7

Let's check our answer with Matlab. Recall that the original initial value problem was:

syms I1(t) I2(t) eqns=[diff(I1,t)==-2*I1-2*I2;diff(I2,t)==2*I1-2*I2];conds=[I1(0)==5;I2(0)==4];[I1sol,I2sol]=dsolve(eqns,conds)

I1sol =

I2sol =

Same answer! How about visualizing our result?

fplot(I1sol,I2sol,[0,2*pi])line(5,4,'Marker','o')text(5.2,4.2,'(5,4)')line(0,0,'Marker','o')text(0.2,0.2,'(0,0)')axis([-1,6,-1,5])grid onxlabel('I_1-axis')ylabel('I_2-axis')title('Both currents head towards zero.')

8

Note that the currents start at the initial condition . Now, there is no voltage source in our circuit, so onewould expect the current to die. Sure enough, both currents wind up at zero (see the point ).

Example #3:Consider the two tanks picture below.

Each tank contains 200 gallons of a salt solution. Pure water pours into the top tank at a rate of 10 gal/min. Saltsolution pours out of the top tank at a rate of 10 gal/min and enters the bottom tank at a rate of 10 gal/min. Saltsolution pours out of the bottom tank at a rate of 10 gal/min. At time , the salt content in the top tank is 50lb and the salt content in the bottom tank is 0 lb (pure water).

Part 1: Set up, in matrix-vector form, an initial value problem that models the salt content in each tank overtime.

Part 2: Sketch both solutions and versus time t. What is the eventual salt content in each tank? Giveboth a physical and a mathematical reason for your answer.

Solution: Because pure water (no salt content) is poured in the top tank from above, the rate at which salt iscoming in is:

9

Because solution flows into and out of the top tank at the same rate (10 gal/min), the volume of the solution inthe top tank remains a constant gallons. Because represents the salt content (in pounds) in thesolution in the top tank,

Therefore, our equation for the solution change in the top tank is:

For the tank at the bottom, the rate at which the salt flows into the tank equals the rate at which it flows out ofthe tank above, so:

Because solution flows into and out of the bottom tank at the same rate (10 gal/min), the volume of the solutionin the bottom tank remains a constant gallons. Because represents the salt content (in pounds) inthe solution in the bottom tank,

Therefore, our equation for the solution change in the bottom tank is:

Because the salt content in the top tank at time is 50 pounds, . Because the salt content in the

bottom tank at time is 0 pounds (pure water), . Thus, we have the following initial value problem.

Now we can put this in matrix form.

10

The trace of the matrix is and the determinant is. Therefore,

We can check this with Matlab.

syms lambda A=[-1/20, 0;1/20, -1/20];p=charpoly(A,lambda)

p =

solve(p)

ans =

Perfect! This is a single repeated eigenvalue of algebraic multiplicity 2. Now we can use our shortcut to find thecorresponding eigenvector.

Examining the second row (remember, our shortcut does not work for a row containing a zero), we see that

will zero out the second row. Hence,

11

Because any multiple of an eigenvector is also an eigenvector, we will multiply this eigenvector by 20 andchoose

Again, we can check this with Matlab.

[V,D]=eig(sym(A))

V =

D =

Perfect! Thus, our first solution is:

To find our second solution, we have to solve the equation:

Note that if we multiply 20 times the first column and 0 times the second column, we have a solution.

Thus,

and our second solution is:

12

Therefore, our general solution is:

Now we substitute our initial condition.

Therefore, and . Substituting these into our general solution, our solution is:

Thus, we have solutions for the salt content in each tank.

We can check our work with Matlab.

syms x1(t) x2(t) eqns=[diff(x1,t)==-1/20*x1;diff(x2,t)==1/20*x1-1/20*x2];conds=[x1(0)==50,x2(0)==0];[x1sol,x2sol]=dsolve(eqns,conds)

x1sol =

x2sol =

Same as our hand-calculated answers!

13

Physically, because pure water is pouring into the top tank, one would imagine that eventually both tanks willhave nothing but pure water in them. Let's sketch the graphs of and to visualize this idea. First, let'sexamine the numeric value of .

[exp(-1);exp(-2);exp(-3);exp(-4)]

ans = 4×1 0.3679 0.1353 0.0498 0.0183

Note that these numbers go from about 36% down to 1%. If we consider our first equation, , if

, then will be about 36% of 50 pounds. Similarly, if , then will be about 1% of 50pounds. Note that:

The number is called a time constant and is a interval of four time constants, a good interval overwhich to sketch our graph.

fplot([x1sol,x2sol],[0,80])grid onxlabel('t-axis')ylabel('x_1 and x_2 axis')title('Salt content in two tanks.')legend('Top Tank','Bottom Tank')

14

Sure enough, the salt content in both tanks appears to be heading toward zero pounds. Our image also showsthat the salt content in the top tank approaches zero quicker, which makes sense. Our image also shows thatthe salt content in the bottom tank first increases, then decreases to zero. Also makes sense.

Now, what analytic approach can we use to verify that both salt contents are eventually zero? Let's take the limitof as .

We can check this with Matlab.

limit(x1sol,t,Inf)

ans =

Checks. Now, we can use l'Hopital's rule to help with the second solution.

15

We can also check this with Matlab.

limit(x2sol,t,Inf)

ans =

Same answer! We're done! ðŸ™‚

16

The post examplestofollow60SS.pdf appeared first on graduate researcher | Professional essay writing services.