> #OK to post HW > #Timothy Nasralla, 9/13/21, HW 2 > #Question 1, write a code to solve for the given sequence. > #Similar to the first assignment I used a recursive function that proves to be effective in showing a(n) is equal to n^3. ; > a := proc(n) option remember: > if n = 0 then > a = 0: > elif n = 1 then > a = 1: > elif n = 2 then > a = 8: > elif n = 3 then > a = 27: > else > 4*a(n - 1) - 6*a(n - 2) + 4*a(n - 3) - a(n - 4): > fi: > end: > ; > seq(a(n),n=0..8) a = 0, a = 1, a = 8, a = 27, a = 64, a = 125, a = 216, a = 343, a = 512 ; > #Question 2, solve the given ODE > dsolve({diff(y(t),t)=(y(t))^3/(t+1),y(0)=1},y(t)) 1 y(t) = ---------------------- (1/2) (1 - 2 ln(t + 1)) ; > #Question 3, solve the given second order ODE with the given initial conditions > dsolve({D(D(y))(t)-3*D(y)(t)+2*y(t)=0,y(0)=2,D(y)(0)=3},y(t)) y(t) = exp(2 t) + exp(t) ; > #Question 4, find the eigenvalues and eigenvectors of the given 2x2 matrix > 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] ; > B:=Matrix([[3,-4],[4,3]]) [3 &uminus0;4] B := [ ] [4 3 ] ; > evalf(Eigenvectors(B)) [3. + 4. ⅈ] [ⅈ &uminus0;ⅈ] [ ], [ ] [3. - 4. ⅈ] [ 1. 1. ] ; > #The Eigenvectors function in evalf returns the eigenvalues and their respective eigenvectors from left to right. ;