> #HW 17, Tim Nasralla, 11/1/21 ; > with(LinearAlgebra): > read "/Users/tan88/OneDrive - Rutgers University/M17.txt" ; > #Question 1, check the calculated solution for the equation given. ; > dsolve({diff(x(t),t)=3*x(t)-y(t),diff(y(t),t)=2*x(t), x(0)=2, y(0)=3},{x(t),y(t)}) {x(t) = exp(2 t) + exp(t), y(t) = exp(2 t) + 2 exp(t)} ; > NULL; > #Question 2, use Maple for the linear algebra calculations and for checking the solution found. ; > J := Matrix(2, 2): > J[1, 1] := 1: > J[2, 1] := 2: > J[1, 2] := 3: > Eigenvalues(J) [Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd(3, rowalign = "", columnalign = "", groupalign = "", rowspan = "1", columnspan = "1"), rowalign = "", columnalign = "", groupalign = ""), Typesetting:-mtr( Typesetting:-mtd(uminus02, rowalign = "", columnalign = "", groupalign = "", rowspan = "1", columnspan = "1"), rowalign = "", columnalign = "", groupalign = ""), foreground = "[0,0,0]", readonly = "false", align = "axis", rowalign = "baseline", columnalign = "right", groupalign = "{left}", alignmentscope = "true", columnwidth = "auto", width = "auto", rowspacing = "1.0ex", columnspacing = "0.8em", rowlines = "none", columnlines = "none", frame = "none", framespacing = "0.4em 0.5ex", equalrows = "false", equalcolumns = "false", displaystyle = "false", side = "right", minlabelspacing = "0.8em")] ; > Eigenvectors(J) (Typesetting:-mtable(Typesetting:-mtr(Typesetting:-mtd( &uminus0;2, rowalign = "", columnalign = "", groupalign = "", rowspan = "1", columnspan = "1"), rowalign = "", columnalign = "", groupalign = ""), Typesetting:-mtr( Typesetting:-mtd(3, rowalign = "", columnalign = "", groupalign = "", rowspan = "1", columnspan = "1"), rowalign = "", columnalign = "", groupalign = ""), foreground = "[0,0,0]", readonly = "false", align = "axis", rowalign = "baseline", columnalign = "center", groupalign = "{left}", alignmentscope = "true", columnwidth = "auto", width = "auto", rowspacing = "1.0ex", columnspacing = "0.8em", rowlines = "none", columnlines = "none", frame = "none", framespacing = "0.4em 0.5ex", equalrows = "false", equalcolumns = "false", displaystyle = "false", side = "right", / / minlabelspacing = "0.8em"))comma|Typesetting:-mtable| \ \ / Typesetting:-mtr|Typesetting:-mtd(&uminus0;1, rowalign = "", \ columnalign = "", groupalign = "", rowspan = "1", /3 columnspan = "1"), Typesetting:-mtd|-, rowalign = "", \2 columnalign = "", groupalign = "", rowspan = "1", \ columnspan = "1"|, rowalign = "", columnalign = "", / \ groupalign = ""|, Typesetting:-mtr(Typesetting:-mtd(1, / rowalign = "", columnalign = "", groupalign = "", rowspan = "1", columnspan = "1"), Typesetting:-mtd(1, rowalign = "", columnalign = "", groupalign = "", rowspan = "1", columnspan = "1"), rowalign = "", columnalign = "", groupalign = ""), foreground = "[0,0,0]", readonly = "false", align = "axis", rowalign = "baseline", columnalign = "center", groupalign = "{left}", alignmentscope = "true", columnwidth = "auto", width = "auto", rowspacing = "1.0ex", columnspacing = "0.8em", rowlines = "none", columnlines = "none", frame = "none", framespacing = "0.4em 0.5ex", equalrows = "false", equalcolumns = "false", displaystyle = "false", side = "right", \/ minlabelspacing = "0.8em"|| /\ ; > dsolve({diff(x(t),t)=x(t)+3*y(t),diff(y(t),t)=2*x(t), x(0)=9, y(0)=5},{x(t),y(t)}) / 3 42 { x(t) = - exp(-2 t) + -- exp(3 t), \ 5 5 3 28 \ y(t) = - - exp(-2 t) + -- exp(3 t) } 5 5 / ; > #Question 3, I used the linear algebra method to solve this system. ; > NumeroTres := Matrix(3,3): NumeroTres[1,1] := 1: NumeroTres[1,2] := 1: NumeroTres[1,3] := 1: NumeroTres[2,1] := 1: NumeroTres[2,2] := 1: NumeroTres[3,1] := 1: > evalf(Eigenvectors(NumeroTres)) / / / / \Typesetting:-mtable\Typesetting:-mtr\Typesetting:-mtd\ &uminus0;10 2.246979605 + 1.times10 ⅈ, rowalign = "", columnalign = "", groupalign = "", rowspan = "1", \ columnspan = "1"/, rowalign = "", columnalign = "", \ / / groupalign = ""/, Typesetting:-mtr\Typesetting:-mtd\ &uminus0;10 &uminus0;0.8019377358 - 1.866025404times10 ⅈ, rowalign = "", columnalign = "", groupalign = "", \ rowspan = "1", columnspan = "1"/, rowalign = "", \ / columnalign = "", groupalign = ""/, Typesetting:-mtr\ / Typesetting:-mtd\ &uminus0;11 0.5549581322 - 1.339745960times10 ⅈ, rowalign = "", columnalign = "", groupalign = "", \ rowspan = "1", columnspan = "1"/, rowalign = "", \ columnalign = "", groupalign = ""/, foreground = "[0,0,0]", readonly = "false", align = "axis", rowalign = "baseline", columnalign = "center", groupalign = "{left}", alignmentscope = "true", columnwidth = "auto", width = "auto", rowspacing = "1.0ex", columnspacing = "0.8em", rowlines = "none", columnlines = "none", frame = "none", framespacing = "0.4em 0.5ex", equalrows = "false", equalcolumns = "false", displaystyle = "false", side = "right", \/ / / minlabelspacing = "0.8em"/\comma\Typesetting:-mtable\ / / Typesetting:-mtr\Typesetting:-mtd\ &uminus0;9 2.246979634 + 1.514675242times10 ⅈ, rowalign = "", columnalign = "", groupalign = "", \ / rowspan = "1", columnspan = "1"/, Typesetting:-mtd\ &uminus0;10 &uminus0;0.8019377350 + 3.686305552times10 ⅈ, rowalign = "", columnalign = "", groupalign = "", \ / rowspan = "1", columnspan = "1"/, Typesetting:-mtd\ &uminus0;11 0.5549581323 - 2.254559307times10 ⅈ, rowalign = "", columnalign = "", groupalign = "", \ rowspan = "1", columnspan = "1"/, rowalign = "", \ / columnalign = "", groupalign = ""/, Typesetting:-mtr\ / Typesetting:-mtd\ &uminus0;9 1.801937769 + 1.888769131times10 ⅈ, rowalign = "", columnalign = "", groupalign = "", \ / rowspan = "1", columnspan = "1"/, Typesetting:-mtd\ &uminus0;10 0.4450418682 - 5.947994638times10 ⅈ, rowalign = "", columnalign = "", groupalign = "", \ / rowspan = "1", columnspan = "1"/, Typesetting:-mtd\ &uminus0;11 &uminus0;1.246979604 + 5.809451696times10 ⅈ, rowalign = "", columnalign = "", groupalign = "", \ rowspan = "1", columnspan = "1"/, rowalign = "", \ columnalign = "", groupalign = ""/, Typesetting:-mtr( Typesetting:-mtd(1., rowalign = "", columnalign = "", groupalign = "", rowspan = "1", columnspan = "1"), Typesetting:-mtd(1., rowalign = "", columnalign = "", groupalign = "", rowspan = "1", columnspan = "1"), Typesetting:-mtd(1., rowalign = "", columnalign = "", groupalign = "", rowspan = "1", columnspan = "1"), rowalign = "", columnalign = "", groupalign = ""), foreground = "[0,0,0]", readonly = "false", align = "axis", rowalign = "baseline", columnalign = "center", groupalign = "{left}", alignmentscope = "true", columnwidth = "auto", width = "auto", rowspacing = "1.0ex", columnspacing = "0.8em", rowlines = "none", columnlines = "none", frame = "none", framespacing = "0.4em 0.5ex", equalrows = "false", equalcolumns = "false", displaystyle = "false", side = "right", \/ minlabelspacing = "0.8em"/\ ; > #Since the imaginary aspect of each eigenvalue and eigenvector is extremely small, (1*10^-9 and smaller), I approximated the final vector and ignored the imaginary aspect. > solve({1=2.24*A-0.8*B+0.555*C, 2=1.8*A+.445*B-1.25*C,-1=A+B+C},{A,B,C}) {A = 0.5225449199, B = -0.4977946937, C = -1.024750226} ; > #Next step was calculating the A, B, and C values multiplied by the eigenvectors respectively. > 0.5225449199*2.246979634; 1.801937769*0.5225449199 ;1*0.5225449199 1.174147793 0.9415934272 0.5225449199 ; > -0.4977946937* (-0.8019377350) ; -0.4977946937*0.4450418682 ; -0.4977946937*1 0.3992003492 -0.2215394805 -0.4977946937 ; > -1.024750226*0.5549581322 ; -1.024750226 *(-1.246979604) ; -1.024750226 * 1 -0.5686934714 1.277842631 -1.024750226 ; > #Answer left on paper ; > NULL; > #Question 4 ; > HW2g(u,v,[[1,1,1],[1,1,1],[1,1,1]]) [ 2 1 2 2 1 2 ] [u + u v + - v , -2 u v - 2 u + 2 u - - v + v] [ 4 2 ] ; (10)> Orb2(,u,v,[1,2],1000,1010) [[4, -4], [4, -4], [4, -4], [4, -4], [4, -4], [4, -4], [4, -4], [4, -4], [4, -4], [4, -4], [4, -4]] ; (10)> Orb2(,u,v,[1,.1],1000,1010) [[1.102500000, -0.1050000000], [1.102500000, -0.1050000000], [1.102500000, -0.1050000000], [1.102500000, -0.1050000000], [1.102500000, -0.1050000000], [1.102500000, -0.1050000000], [1.102500000, -0.1050000000], [1.102500000, -0.1050000000], [1.102500000, -0.1050000000], [1.102500000, -0.1050000000], [1.102500000, -0.1050000000]] ; (10)> Orb2(,u,v,[2,1],1000,1010) [[25 -15] [25 -15] [25 -15] [25 -15] [25 -15] [[--, ---], [--, ---], [--, ---], [--, ---], [--, ---], [[4 2 ] [4 2 ] [4 2 ] [4 2 ] [4 2 ] [25 -15] [25 -15] [25 -15] [25 -15] [25 -15] [25 -15] [--, ---], [--, ---], [--, ---], [--, ---], [--, ---], [--, ---] [4 2 ] [4 2 ] [4 2 ] [4 2 ] [4 2 ] [4 2 ] ] ] ] ; (10)> Orb2(,u,v,[20,2],1000,1010) [[441, -840], [441, -840], [441, -840], [441, -840], [441, -840], [441, -840], [441, -840], [441, -840], [441, -840], [441, -840], [441, -840]] ; (10)> Orb2(,u,v,[1,2000],1000,1010) [[1002001, -2002000], [1002001, -2002000], [1002001, -2002000], [1002001, -2002000], [1002001, -2002000], [1002001, -2002000], [1002001, -2002000], [1002001, -2002000], [1002001, -2002000], [1002001, -2002000], [1002001, -2002000]] ; > #While adjusting [a,b] to some extreme values it is clear that the Hardy Weinberg rule holds for generations stabilizing after the first. ; > M:=[[1,1,2],[1,1,2],[1,1,2]] M := [[1, 1, 2], [1, 1, 2], [1, 1, 2]] ; > HW2g(u,v,M) [ 2 2 2 2 ] [ 4 u + 4 u v + v 6 u + 7 u v + 2 v - 6 u - 3 v] [- -----------------, -------------------------------] [ 4 (u + v - 2) 2 (u + v - 2) ] ; (17)> Orb2(,u,v,[1,2],1000,1010) [[0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0], [0, 0]] ; > M:=[[2,2,2],[2,2,2],[2,2,2]] M := [[2, 2, 2], [2, 2, 2], [2, 2, 2]] ; > HW2g(u,v,M) [ 2 1 2 2 1 2 ] [u + u v + - v , -2 u - 2 u v - - v + 2 u + v] [ 4 2 ] ; (20)> Orb2(,u,v,[1,2],1000,1010) [[4, -4], [4, -4], [4, -4], [4, -4], [4, -4], [4, -4], [4, -4], [4, -4], [4, -4], [4, -4], [4, -4]] ; > M:=[[4,4,4],[4,4,4],[4,4,4]] M := [[4, 4, 4], [4, 4, 4], [4, 4, 4]] ; > HW2g(u,v,M) [ 2 1 2 2 1 2 ] [u + u v + - v , -2 u - 2 u v - - v + 2 u + v] [ 4 2 ] ; (23)> Orb2(,u,v,[1,2],1000,1010) [[4, -4], [4, -4], [4, -4], [4, -4], [4, -4], [4, -4], [4, -4], [4, -4], [4, -4], [4, -4], [4, -4]] ; > M:=[[2,2,2],[2,1,2],[2,2,2]] M := [[2, 2, 2], [2, 1, 2], [2, 2, 2]] ; > HW2g(u,v,M) [ 2 2 2 2 ] [ 8 u + 8 u v + v 8 u + 8 u v + 3 v - 8 u - 4 v] [- -----------------, -------------------------------] [ / 2 \ / 2 \ ] [ 4 \v - 2/ 2 \v - 2/ ] ; (26)> Orb2(,u,v,[1,2],1000,1010) ; > ;