MathGroup Archive 1994

[Date Index] [Thread Index] [Author Index]

Search the Archive

Symbolic Linear Algebra Package

Brian  Eberman writes:
>  I am looking for a symbolic linear algebra backage, (also possibly
>  multilinear algebra?) for Mathematica.  I would like to be able to
>  specify the properties of the elements of equations and get the
>  appropriate simplifications.  
>  For example if R is unitary
>  that R . Transpose(R) = Id.

>  I do not subscribe to the mathgroup so please respond directly if you
>  have any information.

As no return address was evident I am responding to the group.

I wrote a package called Dot Algebra. This package implements a set of 
rules for the symbols "dot", "tr", "inv", and "iden", corresponding to 
Dot, Transpose, Inverse, and IdentityMatrix.  In addition, the element 
"zero" is defined. The rules allow the manipulation of algebraic 
expressions abstractly without reference to the internal structure of 
the objects. In addition, Expressions can be manipulated with 
dotExpand[expr] and dotCollect[expr, var].

To take an example from econometrics, 

In[1]:= <<FRB`DotAlgebra` (* load the package *)

In[2]:= e = y - dot[x, b] (* define the residual error *)

Out[2]= y - x.b

In[3]:= ssq = dot[tr[e], e] (* define the sum of squares *)

Out[3]= (-b'.x' + y').(y - x.b)

In[4]:= dssq = dotD[ssq, b] (* differentiate the sum *)

Out[4]= -2 x'.y + 2 x'.x.b

In[5]:= dotSolve[dssq == zero, b] (* set the result to zero and solve *)

Out[5]= {{b -> (x'.x)  .x'.y}}

Remarks: dotSolve calls Solve, which in turn calls InverseFunction.
InverseFunction is defined for dot with various arguments in this package
that simply assumes the appropriate arguments are invertable. dotD replaces
dot with Dot, calls D, and re-replaces Dot with dot. This is done to get the
chain rule right.

Rules for unitary matrices are not included but could be easily added.

I would be happy to e-mail the package to any interested parties.  Any
feedback would be welcomed.

Mark Fisher
Trading Risk Analysis
Federal Reserve Board, Washington, DC
mfisher at

  • Prev by Date: output to file
  • Next by Date: Re: Special Input Forms
  • Previous by thread: output to file
  • Next by thread: ShowLegend