Dennis J. Darland Practice in Programming ASUS Development Computer - Ubuntu 14.04 Starting Mon May 21 20:48:12 CDT 2018 Finished Mon May 21 20:48:16 CDT 2018 |\^/| Maple 2016 (X86 64 LINUX) ._|\| |/|_. Copyright (c) Maplesoft, a division of Waterloo Maple Inc. 2016 \ MAPLE / All rights reserved. Maple is a trademark of <____ ____> Waterloo Maple Inc. | Type ? for help. > 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] > # define main function > main := proc() > > print("Maple output"); > print("Chapter 2"); > prob05(); > end; main := proc() print("Maple output"); print("Chapter 2"); prob05() end proc > > prob05 := proc() > local a,b,c,d,e,m_a,m_b,m_c,m_d,m_e,d_a,d_b,d_c,d_d,d_e,dd_a,dd_b,dd_c,dd_d,dd_e; > > a := <4.0,-3.0,0.0>; > b := <6.0,8.0,0.0>; > > print("Problem 5"); > print("a := ", a); > print("b := ", b); > c := a + b; > d := b - a; > e := a - b; > f := <2.0,-3.0,7.0>; > g := <12.0,45.0,-8.0>; > h := <-5.0,-3.0,42.0>; > > print("c := ", c); > print("d := ", d); > print("e := ", e); > m_a := mag(a); > m_b := mag(b); > m_c := mag(c); > m_d := mag(d); > m_e := mag(e); > print("magnitude of a := ", m_a); > print("magnitude of b := ", m_b); > print("magnitude of c := ", m_c); > print("magnitude of d := ", m_d); > print("magnitude of e := ", m_e); > d_a := direction_r(a); > d_b := direction_r(b); > d_c := direction_r(c); > d_d := direction_r(d); > d_e := direction_r(e); > print("direction in radians of a := ", d_a); > print("direction in radians of b := ", d_b); > print("direction in radians of c := ", d_c); > print("direction in radians of d := ", d_d); > print("direction in radians of e := ", d_e); > dd_a := direction_d(a); > dd_b := direction_d(b); > dd_c := direction_d(c); > dd_d := direction_d(d); > dd_e := direction_d(e); > print("direction in degrees of a := ", dd_a); > print("direction in degrees of b := ", dd_b); > print("direction in degrees of c := ", dd_c); > print("direction in degrees of d := ", dd_d); > print("direction in degrees of e := ", dd_e); > > print("a.a",dot(a,a)); > print("a.b",dot(a,b)); > print("b.a",dot(b,a)); > print("a.c",dot(a,c)); > print("d.a",dot(d,a)); > print("a.e",dot(a,e)); > print("e.a",dot(e,a)); > > print("axa",cross(a,a)); > print("axb",cross(a,b)); > print("bxa",cross(b,a)); > print("axc",cross(a,c)); > print("dxa",cross(d,a)); > print("axe",cross(a,e)); > print("exa",cross(e,a)); > > print("fxg",cross(f,g)); > print("fxh",cross(f,h)); > print("gxh",cross(g,h)); > print("gxf",cross(g,f)); > print("hxf",cross(h,f)); > print("hxg",cross(h,g)); > > af := ; > ag := ; > print("afxag",cross(af,ag)); > > > end; Warning, `f` is implicitly declared local to procedure `prob05` Warning, `g` is implicitly declared local to procedure `prob05` Warning, `h` is implicitly declared local to procedure `prob05` Warning, `af` is implicitly declared local to procedure `prob05` Warning, `ag` is implicitly declared local to procedure `prob05` prob05 := proc() local a, b, c, d, e, m_a, m_b, m_c, m_d, m_e, d_a, d_b, d_c, d_d, d_e, dd_a, dd_b, dd_c, dd_d, dd_e, f, g, h, af, ag; a := <4.0, -3.0, 0.>; b := <6.0, 8.0, 0.>; print("Problem 5"); print("a := ", a); print("b := ", b); c := a + b; d := b - a; e := a - b; f := <2.0, -3.0, 7.0>; g := <12.0, 45.0, -8.0>; h := <-5.0, -3.0, 42.0>; print("c := ", c); print("d := ", d); print("e := ", e); m_a := mag(a); m_b := mag(b); m_c := mag(c); m_d := mag(d); m_e := mag(e); print("magnitude of a := ", m_a); print("magnitude of b := ", m_b); print("magnitude of c := ", m_c); print("magnitude of d := ", m_d); print("magnitude of e := ", m_e); d_a := direction_r(a); d_b := direction_r(b); d_c := direction_r(c); d_d := direction_r(d); d_e := direction_r(e); print("direction in radians of a := ", d_a); print("direction in radians of b := ", d_b); print("direction in radians of c := ", d_c); print("direction in radians of d := ", d_d); print("direction in radians of e := ", d_e); dd_a := direction_d(a); dd_b := direction_d(b); dd_c := direction_d(c); dd_d := direction_d(d); dd_e := direction_d(e); print("direction in degrees of a := ", dd_a); print("direction in degrees of b := ", dd_b); print("direction in degrees of c := ", dd_c); print("direction in degrees of d := ", dd_d); print("direction in degrees of e := ", dd_e); print("a.a", dot(a, a)); print("a.b", dot(a, b)); print("b.a", dot(b, a)); print("a.c", dot(a, c)); print("d.a", dot(d, a)); print("a.e", dot(a, e)); print("e.a", dot(e, a)); print("axa", cross(a, a)); print("axb", cross(a, b)); print("bxa", cross(b, a)); print("axc", cross(a, c)); print("dxa", cross(d, a)); print("axe", cross(a, e)); print("exa", cross(e, a)); print("fxg", cross(f, g)); print("fxh", cross(f, h)); print("gxh", cross(g, h)); print("gxf", cross(g, f)); print("hxf", cross(h, f)); print("hxg", cross(h, g)); af := ; ag := ; print("afxag", cross(af, ag)) end proc > > dot := proc(a,b) > local b_t,m,r; > b_t := b^%T; # transpose > r := b_t . a ; # dot product > end; dot := proc(a, b) local b_t, m, r; b_t := b^%T; r := b_t . a end proc > > cross := proc(a,b) > local r; > r := a &x b; # cross product > end; cross := proc(a, b) local r; r := LinearAlgebra:-`&x`(a, b) end proc > > > > > > mag := proc(a) > local a_t,m,r_m; > a_t := a^%T; # transpose > m := a_t . a ; # dot product > r_m := sqrt(m); > end; mag := proc(a) local a_t, m, r_m; a_t := a^%T; m := a_t . a; r_m := sqrt(m) end proc > > direction_r := proc(a) > local dir; > > dir := arctan(a[2],a[1]); > > end; direction_r := proc(a) local dir; dir := arctan(a[2], a[1]) end proc > > direction_d := proc(a) > local dir; > > dir := arctan(a[2],a[1]) * 180.0 / Pi; > > end; direction_d := proc(a) local dir; dir := arctan(a[2], a[1])*180.0/Pi end proc > > > > # call main > main(); "Maple output" "Chapter 2" "Problem 5" [4.0 ] [ ] "a := ", [-3.0] [ ] [ 0. ] [6.0] [ ] "b := ", [8.0] [ ] [0. ] [10.] [ ] "c := ", [5. ] [ ] [0. ] [2. ] [ ] "d := ", [11.] [ ] [0. ] [-2. ] [ ] "e := ", [-11.] [ ] [ 0. ] "magnitude of a := ", 5.000000000 "magnitude of b := ", 10.0 "magnitude of c := ", 11.18033989 "magnitude of d := ", 11.18033989 "magnitude of e := ", 11.18033989 memory used=2.9MB, alloc=40.3MB, time=0.16 "direction in radians of a := ", -0.6435011088 "direction in radians of b := ", 0.9272952180 "direction in radians of c := ", 0.463647609000806 "direction in radians of d := ", 1.39094282700242 "direction in radians of e := ", -1.75064982658737 "direction in degrees of a := ", -36.86989765 "direction in degrees of b := ", 53.13010233 "direction in degrees of c := ", 26.5650511736093 "direction in degrees of d := ", 79.6951535208279 "direction in degrees of e := ", -100.304846455669 "a.a", 25. "a.b", 0. "b.a", 0. "a.c", 25. "d.a", -25. "a.e", 25. "e.a", 25. [0.] [ ] "axa", [0.] [ ] [0.] [ -0. ] [ ] "axb", [ 0. ] [ ] [50.00] [ 0. ] [ ] "bxa", [ 0. ] [ ] [-50.00] [-0.] [ ] "axc", [0. ] [ ] [50.] [ 0. ] [ ] "dxa", [ 0. ] [ ] [-50.] [ 0. ] [ ] "axe", [-0. ] [ ] [-50.] [0. ] [ ] "exa", [0. ] [ ] [50.] [-291.00] [ ] "fxg", [100.00 ] [ ] [126.00 ] [-105.00] [ ] "fxh", [-119.00] [ ] [-21.00 ] [1866.00] [ ] "gxh", [-464.00] [ ] [189.00 ] [291.00 ] [ ] "gxf", [-100.00] [ ] [-126.00] [105.00] [ ] "hxf", [119.00] [ ] [21.00 ] [-1866.00] [ ] "hxg", [ 464.00 ] [ ] [-189.00 ] [fy gz - fz gy ] [ ] "afxag", [-fx gz + fz gx] [ ] [fx gy - fy gx ] > quit memory used=3.8MB, alloc=40.3MB, time=0.18