VectorSymbol

VectorSymbol[v]

represents a vector with name v.

VectorSymbol[v,d]

represents a vector of length d.

VectorSymbol[v,d,dom]

represents a vector with elements in the domain dom.

Details

  • The name v in VectorSymbol[v,d,dom] can be any expression.
  • A valid dimension specification d in VectorSymbol[v,d,dom] is any positive integer. It is also possible to work with symbolic dimension specifications.
  • Element domain specifications dom in VectorSymbol[v,d,dom] include:
  • Complexescomplex numbers
    Integersintegers
    Realsreal numbers
    NonNegativeRealsreal numbers x with x0
    PositiveRealsreal numbers x with x>0
  • In arithmetic and many other functions that work with lists, VectorSymbol objects do not automatically combine with other list arguments.
  • Optimization functions, equation solvers and D recognize that VectorSymbol objects represent vector variables.

Examples

open allclose all

Basic Examples  (1)

Assign the value of the variable v to represent a length n vector with name "v":

Arithmetic operations recognize that v is not a scalar:

D recognizes that v is a vector variable:

Scope  (5)

Compute derivatives with respect to a vector variable:

Compute derivatives involving vector-valued functions:

This requires a real-valued vector:

Use a vector variable in optimization:

Solve equations and inequalities involving a vector variable:

Applications  (7)

Use a symbolic vector as a variable for optimization:

Find the vector that has the smallest sum of elements with a constraint:

Using a variable y treated by default as a scalar does not work since Total[y + {1,2,3}] expands:

Find the radius and center of a minimal enclosing ball that encompasses a set of k points in n dimensions:

The ball encloses point if Norm[pi-c]<=r:

Visualize the sphere and points:

The optimization works in any dimension:

Solve a differential equation for a vector-valued function:

Plot the solution:

Check that the residual is small:

Approximate the variance for a perturbed vector:

Order zero approximation:

Compare with the exact value:

Order-one approximation:

Compare with the exact value:

Order-two approximation:

Since the second derivative does not depend on , the order-two approximation equals the exact value:

Find GammaDistribution parameters that best fit the given data using the maximum likelihood method:

Maximize the log-likelihood function :

Compute the gradient of :

Find a zero of the gradient, with replaced by :

Visualize the result:

Compare with the result computed using EstimatedDistribution:

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 TemplateBox[{Total, paclet:ref/Total}, RefLink, BaseStyle -> {InlineFormula}][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), VectorSymbol, Wolfram Language function, https://reference.wolfram.com/language/ref/VectorSymbol.html.

Text

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

CMS

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

APA

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

BibTeX

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

BibLaTeX

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