Function Repository Resource:

# CoordinateVector

Find the coordinate vector of a vector with respect to a basis

Contributed by: Dennis M Schneider
 ResourceFunction["CoordinateVector"][vec,basis] finds the coordinates of the vector vec with respect to the basis basis. ResourceFunction["CoordinateVector"][vec,basis,var] finds the coordinates of a vector when the vector and the basis vectors are members of a function space consisting of functions of var.

## Details and Options

The input vector is given in terms of the standard basis.
The input vector may be a list of vectors.

## Examples

### Basic Examples (1)

Get the coordinates of a given vector in a given basis:

 In[1]:=
 Out[1]=

### Scope (15)

#### Vectors in ℝn

When 1 is viewed as a vector space, its elements are singletons, i.e. (α). The standard basis for 1 is {(1)}, so to find the coordinates of the vector (5) with respect to the basis {(1)}, proceed as follows:

 In[2]:=
 Out[2]=

Find the coordinates of a vector in 4 with respect to a basis of 4:

 In[3]:=
 Out[4]=

Verify the result:

 In[5]:=
 Out[5]=

Find the coordinates of a vector in 4 with respect to a basis for a three-dimensional subspace of 4:

 In[6]:=
 Out[7]=

Verify the result:

 In[8]:=
 Out[8]=

Find the coordinates of a list of vectors with respect to a basis:

 In[9]:=
 Out[10]=

Verify the result:

 In[11]:=
 Out[11]=

Find the coordinate vector of a vector with symbolic entries:

 In[12]:=
 Out[12]=

Verify the result:

 In[13]:=
 Out[13]=

If the vectors listed as the basis vectors are not independent, an error message is returned:

 In[14]:=
 Out[14]=

Check that the given list of vectors is not independent:

 In[15]:=
 Out[15]=

If a vector is not in the span of the given list of vectors, an error message is returned:

 In[16]:=
 Out[16]=

Check that at least one of the given vectors is not in the span:

 In[17]:=
 Out[17]=

#### Spaces of matrices (2)

The standard basis for the space of 2×4 matrices is:

 In[18]:=
 Out[18]=

Find the coordinate vector of the 2×4 matrix with respect to this basis:

 In[19]:=
 Out[19]=

Verify the result:

 In[20]:=
 Out[20]=

Find the coordinates of a matrix with symbolic entries:

 In[21]:=
 Out[19]=

Check that the result is correct:

 In[22]:=
 Out[22]=

#### Function spaces (6)

Find the coordinates of a list of two vectors (functions) with respect to the standard basis {1,x,x2,x3} of the space of polynomials of degree at most 3:

 In[23]:=
 Out[19]=

Verify the result:

 In[24]:=
 Out[24]=

Find the coordinates of two vectors (functions) with respect to a basis for a two-dimensional subspace of the space of polynomials of degree at most 4:

 In[25]:=
 Out[19]=

Verify the result:

 In[26]:=
 Out[26]=

This example exploits trigonometric identities to find the vector's coordinates:

 In[27]:=
 Out[19]=

Verify the result:

 In[28]:=
 Out[28]=

Example involving exponential and hyperbolic functions:

 In[29]:=
 Out[19]=

Verify the result:

 In[30]:=
 Out[30]=

A more complicated function:

 In[31]:=
 Out[31]=

Verify the result:

 In[32]:=
 Out[32]=

The following example involves a dependent list of exponential and hyperbolic functions. The given list of vectors is dependent because the vector cos2(x) is a linear combination of 1 and cos(2x):

 In[33]:=
 Out[32]=

## Publisher

Dennis M Schneider

## Version History

• 3.0.0 – 31 August 2020
• 2.0.0 – 23 September 2019
• 1.0.0 – 12 September 2019