octave:2> A=randn(4) A = 0.093364 -0.464814 0.100451 0.057313 1.491946 -1.725091 1.651884 -0.423881 -1.251246 0.743893 -1.557639 0.275313 -1.006633 -0.950183 1.493734 0.759344 octave:3> expm(A) ans = 0.811803 -0.250200 -0.038232 0.164709 0.592448 0.254502 0.272579 -0.219323 -0.614235 0.246522 0.427957 0.132969 -2.689988 -0.240276 1.066197 2.380758 octave:4> eye(4)+A+A^2/2+A^3/6 ans = 0.96646 -0.37823 0.16905 0.12735 1.43678 -0.46038 1.47792 -0.41530 -1.12497 0.67122 -0.30101 0.25129 -2.14936 -0.66463 1.75527 2.24714 octave:5> eye(4)+A+A^2/2+A^3/6+A^4/24 ans = 7.2633e-01 -1.7762e-01 -1.6138e-01 1.8443e-01 9.9858e-02 6.6671e-01 -4.2747e-01 -1.0480e-01 -3.1874e-01 7.4015e-05 8.4851e-01 6.4366e-02 -2.9714e+00 -1.2564e-04 6.5498e-01 2.4451e+00 octave:6> eye(4)+A+A^2/2+A^3/6+A^4/24+A^5/120 ans = 0.852906 -0.284521 0.020067 0.155143 0.825519 0.059641 0.604378 -0.273440 -0.753977 0.363229 0.229022 0.165412 -2.553006 -0.354289 1.259914 2.348828 octave:7> expm(A) ans = 0.811803 -0.250200 -0.038232 0.164709 0.592448 0.254502 0.272579 -0.219323 -0.614235 0.246522 0.427957 0.132969 -2.689988 -0.240276 1.066197 2.380758 octave:8> [V,D > octave:8> help eig 'eig' is a built-in function from the file libinterp/corefcn/eig.cc -- LAMBDA = eig (A) -- LAMBDA = eig (A, B) -- [V, LAMBDA] = eig (A) -- [V, LAMBDA] = eig (A, B) -- [V, LAMBDA, W] = eig (A) -- [V, LAMBDA, W] = eig (A, B) -- [...] = eig (A, BALANCEOPTION) -- [...] = eig (A, B, ALGORITHM) -- [...] = eig (..., EIGVALOPTION) Compute the eigenvalues (LAMBDA) and optionally the right eigenvectors (V) and the left eigenvectors (W) of a matrix or a pair of matrices. The flag BALANCEOPTION can be one of: "balance" Preliminary balancing is on. (default) "nobalance" Disables preliminary balancing. The flag EIGVALOPTION can be one of: "matrix" Return the eigenvalues in a diagonal matrix. (default if 2 or 3 outputs are specified) "vector" Return the eigenvalues in a column vector. (default if 1 output is specified, e.g. LAMBDA = eig (A)) The flag ALGORITHM can be one of: "chol" Uses the Cholesky factorization of B. (default if A is symmetric (Hermitian) and B is symmetric (Hermitian) positive definite) "qz" Uses the QZ algorithm. (When A or B are not symmetric always the QZ algorithm will be used) no flag chol qz ----------------------------------------------------------------------------- both are symmetric "chol" "chol" "qz" at least one is not "qz" "qz" "qz" symmetric The eigenvalues returned by 'eig' are not ordered. See also: eigs, svd. Additional help for built-in functions and operators is available in the online version of the manual. Use the command 'doc ' to search the manual index. Help and information about Octave is also available on the WWW at http://www.octave.org and via the help@octave.org mailing list. octave:9> [V,D]=eig(A); octave:10> A*V,V*D ans = 0.3610114 -0.1047260 0.0897579 -0.2585374 2.0519212 0.0488866 -0.0086463 -0.5151770 -1.2295782 -0.0092230 -0.0273682 -0.1755919 1.1994955 -0.6834553 0.2499041 -0.3363269 ans = 0.3610114 -0.1047260 0.0897579 -0.2585374 2.0519212 0.0488866 -0.0086463 -0.5151770 -1.2295782 -0.0092230 -0.0273682 -0.1755919 1.1994955 -0.6834553 0.2499041 -0.3363269 octave:11> D D = Diagonal Matrix -2.70025 0 0 0 0 0.69322 0 0 0 0 0.26708 0 0 0 0 -0.69007 octave:12> exp(D) ans = 0.067189 1.000000 1.000000 1.000000 1.000000 2.000145 1.000000 1.000000 1.000000 1.000000 1.306146 1.000000 1.000000 1.000000 1.000000 0.501541 octave:13> diag(exp(diag(D))) ans = Diagonal Matrix 0.067189 0 0 0 0 2.000145 0 0 0 0 1.306146 0 0 0 0 0.501541 octave:14> V*diag(exp(diag(D)))/V ans = 0.811803 -0.250200 -0.038232 0.164709 0.592448 0.254502 0.272579 -0.219323 -0.614235 0.246522 0.427957 0.132969 -2.689988 -0.240276 1.066197 2.380758 octave:15> expm(A) ans = 0.811803 -0.250200 -0.038232 0.164709 0.592448 0.254502 0.272579 -0.219323 -0.614235 0.246522 0.427957 0.132969 -2.689988 -0.240276 1.066197 2.380758 octave:16> phi1m(A) ans = 0.945752 -0.150914 -0.011679 0.065519 0.381359 0.519888 0.278003 -0.128199 -0.373564 0.174331 0.605721 0.081006 -1.076716 -0.208873 0.544955 1.585444 octave:17> (expm(A)-eye(4))/A ans = 0.945752 -0.150914 -0.011679 0.065519 0.381359 0.519888 0.278003 -0.128199 -0.373564 0.174331 0.605721 0.081006 -1.076716 -0.208873 0.544955 1.585444 octave:18> (expm(A)-eye(4))*inv(A) ans = 0.945752 -0.150914 -0.011679 0.065519 0.381359 0.519888 0.278003 -0.128199 -0.373564 0.174331 0.605721 0.081006 -1.076716 -0.208873 0.544955 1.585444 octave:19> A=[1,2,3;4,5,6;7,8,9] A = 1 2 3 4 5 6 7 8 9 octave:20> det(A) ans = 0 octave:21> phi1m(A) ans = 6.9425e+04 8.5303e+04 1.0118e+05 1.5722e+05 1.9318e+05 2.2914e+05 2.4501e+05 3.0105e+05 3.5709e+05 octave:22> (expm(A)-eye(4))*inv(A) error: operator -: nonconformant arguments (op1 is 3x3, op2 is 4x4) octave:22> (expm(A)-eye(3))*inv(A) warning: matrix singular to machine precision ans = Inf Inf Inf Inf Inf Inf Inf Inf Inf octave:23> toeplitz([-2,1,0]) ans = -2 1 0 1 -2 1 0 1 -2 octave:24> ese11ODE octave:25> yee yee = 4.1804e-05 5.9119e-05 4.1804e-05 octave:26> yeexp yeexp = 6.6769e-05 9.4426e-05 6.6769e-05 octave:27> ese11ODE octave:28> yee yee = 6.3344e-05 8.9582e-05 6.3344e-05 octave:29> yeexp yeexp = 6.6207e-05 9.3630e-05 6.6207e-05 octave:30> ese11ODE octave:31> ese11ODE octave:32> diary off