> #OK to Post Homework > #Jeton Hida, September 27, 2021, Assignment 6 > > #Question 1 #0 y.o, 1 y.o, 2 y.o, 3y.o #P(S) 0 -> 1 = .95, P(S) 1 -> 2 = .97, > P(S) 2 -> 3 = .9, S=Survival #Fertility rate 0 y.o = .1, 1 y.o = 1.2, 2 y.o = > .9, 3 y.o = .1 #n3(t)=.9*n2(t-1), n3(t-1) = .9 *(.97*(.95*n0(t-4))) > #n2(t)=.97*n1(t-1), n2(t-1) = .97*(.95*n0(t-3)), n2(t-2) = .97*(.95*n0(t-4)) > #n1(t)=.95*n0(t), n1(t-1) = .95*n0(t-2), n1(t-2)=.95*n0(t-3), n1(t-3) = > .95*n0(t-4) #n0(t)=.1*n0(t-1)+1.2*(.95*n0(t-2))+.9*(.97*(.95*n0(t-3)))+.1*(.9*(.97*(.95*n0(t-4)))) #the number of 0 y.o olds at time t > #REC:=[.1, 1.2*.95, .9*.97*.95, .1*.9*.97*.95] > read "/Users/jeton/Desktop/Math 336/M5.txt" > GrowthCe([.1, 1.2*.95, .9*.97*.95, .1*.9*.97*.95]) 1.385732629 > #Question 2 with(LinearAlgebra) [&x, Add, Adjoint, BackwardSubstitute, BandMatrix, Basis, BezoutMatrix, BidiagonalForm, BilinearForm, CARE, CharacteristicMatrix, CharacteristicPolynomial, Column, ColumnDimension, ColumnOperation, ColumnSpace, CompanionMatrix, CompressedSparseForm, ConditionNumber, ConstantMatrix, ConstantVector, Copy, CreatePermutation, CrossProduct, DARE, DeleteColumn, DeleteRow, Determinant, Diagonal, DiagonalMatrix, Dimension, Dimensions, DotProduct, EigenConditionNumbers, Eigenvalues, Eigenvectors, Equal, ForwardSubstitute, FrobeniusForm, FromCompressedSparseForm, FromSplitForm, GaussianElimination, GenerateEquations, GenerateMatrix, Generic, GetResultDataType, GetResultShape, GivensRotationMatrix, GramSchmidt, HankelMatrix, HermiteForm, HermitianTranspose, HessenbergForm, HilbertMatrix, HouseholderMatrix, IdentityMatrix, IntersectionBasis, IsDefinite, IsOrthogonal, IsSimilar, IsUnitary, JordanBlockMatrix, JordanForm, KroneckerProduct, LA_Main, LUDecomposition, LeastSquares, LinearSolve, LyapunovSolve, Map, Map2, MatrixAdd, MatrixExponential, MatrixFunction, MatrixInverse, MatrixMatrixMultiply, MatrixNorm, MatrixPower, MatrixScalarMultiply, MatrixVectorMultiply, MinimalPolynomial, Minor, Modular, Multiply, NoUserValue, Norm, Normalize, NullSpace, OuterProductMatrix, Permanent, Pivot, PopovForm, ProjectionMatrix, QRDecomposition, RandomMatrix, RandomVector, Rank, RationalCanonicalForm, ReducedRowEchelonForm, Row, RowDimension, RowOperation, RowSpace, ScalarMatrix, ScalarMultiply, ScalarVector, SchurForm, SingularValues, SmithForm, SplitForm, StronglyConnectedBlocks, SubMatrix, SubVector, SumBasis, SylvesterMatrix, SylvesterSolve, ToeplitzMatrix, Trace, Transpose, TridiagonalForm, UnitVector, VandermondeMatrix, VectorAdd, VectorAngle, VectorMatrixMultiply, VectorNorm, VectorScalarMultiply, ZeroMatrix, ZeroVector, Zip] > LM:=Matrix([[.1, 1.2, .9, .1], [.95, 0, 0, 0], [0, .97, 0, 0], [0, 0, .9, 0]]) > Eigenvalues(LM) Vector[column](4, [1.385732628853638 + 0.*I, -0.58335151608636 + 0.40312587748502526*I, -0.58335151608636 - 0.40312587748502526*I, -0.11902959668091699 + 0.*I]) > #Largest eigenvalue agrees with growth constant found above! > #Question 3 #4 sites 1,2,3,4 denoted by S1,S2,S3,S4 respectively > #Prob of staying at S1 = .5, Prob at staying at S2 = .4, Prob at staying at S3 > = .3, Prob at staying at S4 = .2 > #Prob of 1->2 = Prob of 1->3 = Prob of 1->4 = .167 #Prob of 2->1 = Prob of > 2->3 = Prob of 2->4 = .2 #Prob of 3->1 = Prob of 3->2 = Prob of 3->4 = .233 > #Prob of 4->1 = Prob of 4->2 = Prob of 4->3 = .267 #P= Transition Matrix > > P:=Matrix([[.5,.167,.167,.167],[.2,.4,.2,.2],[.233,.233,.3,.233],[.267,.267,.2 > 67,.2]]) > evalf(evalm(P&^1000)) Matrix(4, 4, [[0.4201023560, 0.3502853665, 0.3003672119, 0.2626555046], [0.4195034329, 0.3497859786, 0.2999389904, 0.2622810472], [0.4190752116, 0.3494289238, 0.2996328183, 0.2620133156], [0.4199342499, 0.3501451981, 0.3002470185, 0.2625504016]]) > #Around 42% of people stay on S1, 34.9% of people stay on S2, 29.9% of people > stay on S3, 26.2% of people stay on S4 #Page Rank would now be from most > popular to least popular S1,S2,S3,S4