Movatterモバイル変換


[0]ホーム

URL:


Jump to content
WikibooksThe Free Textbook Project
Search

Octave Programming Tutorial/Linear algebra

From Wikibooks, open books for an open world
<Octave Programming Tutorial
This page may need to bereviewed for quality.

Functions

[edit |edit source]
  • d = det(A) computes thedeterminant of the matrixA.
  • lambda = eig(A) returns theeigenvalues ofA in the vectorlambda, and
  • [V, lambda] = eig(A) also returns theeigenvectors inV butlambda is now a matrix whose diagonals contain the eigenvalues. This relationship holds true (within round off errors)A = V*lambda*inv(V).
  • inv(A) computes the inverse of non-singular matrixA. Note that calculating the inverse is often 'not' necessary. See the next two operators as examples. Note that in theoryA*inv(A) should return the identity matrix, but in practice, there may be some round off errors so the result may not be exact.
  • A / B computesX such thatXB=A{\displaystyle XB=A}. This is called right division and is done without forming the inverse ofB.
  • A \ B computesX such thatAX=B{\displaystyle AX=B}. This is called left division and is done without forming the inverse ofA.
  • norm(A, p) computes thep-norm of the matrix (or vector)A. The second argument is optional with default valuep=2{\displaystyle p=2}.
  • rank(A) computes the (numerical)rank of a matrix.
  • trace(A) computes thetrace (sum of the diagonal elements) ofA.
  • expm(A) computes the matrix exponential of a square matrix. This is defined as
I+A+A22!+A33!+{\displaystyle I+A+{\frac {A^{2}}{2!}}+{\frac {A^{3}}{3!}}+\cdots }

Below are some more linear algebra functions. Usehelp to find out more about them.

  • balance (eigenvalue balancing),
  • cond (condition number),
  • dmult (computes diag(x) * A efficiently),
  • dot (dot product),
  • givens (Givens rotation),
  • kron (Kronecker product),
  • null (orthonormal basis of the null space),
  • orth (orthonormal basis of the range space),
  • pinv (pseudoinverse),
  • syl (solves the Sylvester equation).

Factorizations

[edit |edit source]
  • R = chol(A) computes the Cholesky factorization of the symmetric positive definite matrixA, i.e. the upper triangular matrixR such thatRTR=A{\displaystyle R^{T}R=A}.
  • [L, U] = lu(A) computes the LU decomposition ofA, i.e.L is lower triangular,U upper triangular andA=LU{\displaystyle A=LU}.
  • [Q, R] = qr(A) computes the QR decomposition ofA, i.e.Q is orthogonal,R is upper triangular andA=QR{\displaystyle A=QR}.

Below are some more available factorizations. Usehelp to find out more about them.

  • qz (generalized eigenvalue problem: QZ decomposition),
  • qzhess (Hessenberg-triangular decomposition),
  • schur (Schur decomposition),
  • svd (singular value decomposition),
  • housh (Householder reflections),
  • krylov (Orthogonal basis of block Krylov subspace).

Return to theOctave Programming Tutorial index

Retrieved from "https://en.wikibooks.org/w/index.php?title=Octave_Programming_Tutorial/Linear_algebra&oldid=4021421"
Category:

[8]ページ先頭

©2009-2025 Movatter.jp