MatrixSymbol

MatrixSymbol[a]

represents a matrix with name a.

MatrixSymbol[a,{m,n}]

represents an mn matrix.

MatrixSymbol[a,{m,n},dom]

represents a matrix with elements in the domain dom.

MatrixSymbol[a,{m,n},dom, sym]

represents a matrix with the symmetry sym.

Details

  • The name a in MatrixSymbol[a,{m,n},dom, sym] can be any expression.
  • Valid dimension specifications m and n in MatrixSymbol[a,{m,n},dom, sym] are positive integers. It is also possible to work with symbolic dimension specifications.
  • Element domain specifications dom in MatrixSymbol[a,{m,n},dom, sym] include:
  • Complexescomplex numbers
    Integersintegers
    Realsreal numbers
    NonNegativeRealsreal numbers x with x0
    PositiveRealsreal numbers x with x>0
  • Some symmetry specifications have names:
  • Symmetric[{1,2}]symmetric matrix
    Antisymmetric[{1,2}]antisymmetric matrix
  • In arithmetic and many other functions that work with lists, MatrixSymbol objects do not automatically combine with other list arguments.
  • Optimization functions, equation solvers and D recognize that MatrixSymbol objects represent vector variables.

Examples

open allclose all

Basic Examples  (1)

Assign the value of the variable a to represent an mn matrix with name "a":

Arithmetic operations recognize that a is not a scalar:

D recognizes that a is a matrix variable:

Scope  (5)

Compute derivatives with respect to a matrix variable:

Compute derivatives involving matrix-valued functions:

This requires a real-valued matrix:

Use a matrix variable in optimization:

Solve equations and inequalities involving a matrix variable:

Applications  (4)

Approximate the determinant of a perturbed matrix:

Order zero approximation:

Compare with the exact value:

Order one approximation:

Compare with the exact value:

Order two approximation:

Compare with the exact value:

Derive a least-squares solution for data given as a list of pairs :

Find the vector of vertical deviations for the data:

Define the sum of squares of the vertical deviations for the data:

Set up the least-squares equations:

Generate some data:

Solve the least-squares problem for this data:

Find an optimality condition for a portfolio optimization problem with the expected return and standard deviation :

The goal is to maximize when the vector of asset weights satisfies Total[x]=1. The constraint can be used to represent where the unconstrained vector variable consists of the first coordinates of :

The maximum occurs at a critical point of :

Express the condition in terms of :

Compute the gradient of the log-likelihood function of the linear regression model represented by the equation , where are normally distributed random variables with mean zero and variance :

The log-likelihood function is given by:

Compute :

Express the result in terms of :

Compute :

Wolfram Research (2024), MatrixSymbol, Wolfram Language function, https://reference.wolfram.com/language/ref/MatrixSymbol.html.

Text

Wolfram Research (2024), MatrixSymbol, Wolfram Language function, https://reference.wolfram.com/language/ref/MatrixSymbol.html.

CMS

Wolfram Language. 2024. "MatrixSymbol." Wolfram Language & System Documentation Center. Wolfram Research. https://reference.wolfram.com/language/ref/MatrixSymbol.html.

APA

Wolfram Language. (2024). MatrixSymbol. Wolfram Language & System Documentation Center. Retrieved from https://reference.wolfram.com/language/ref/MatrixSymbol.html

BibTeX

@misc{reference.wolfram_2024_matrixsymbol, author="Wolfram Research", title="{MatrixSymbol}", year="2024", howpublished="\url{https://reference.wolfram.com/language/ref/MatrixSymbol.html}", note=[Accessed: 21-December-2024 ]}

BibLaTeX

@online{reference.wolfram_2024_matrixsymbol, organization={Wolfram Research}, title={MatrixSymbol}, year={2024}, url={https://reference.wolfram.com/language/ref/MatrixSymbol.html}, note=[Accessed: 21-December-2024 ]}