# [Maxima] Symbolic pseudo-inverse

Stavros Macrakis macrakis at alum.mit.edu
Mon Aug 24 14:47:27 CDT 2009

```This seems to work nicely except for one very big problem: it does not check
for expression zero equivalence except syntactically.  See below for an
example.

-s

(%i1) mm: matrix([2*sin(x),sin(2*x)],[1,cos(x)]);

(%o1) matrix([2*sin(x),sin(2*x)],[1,cos(x)])

(%i2) moore_penrose_pseudoinverse(mm);

(%o2) matrix([-cos(x)/(sin(2*x)-2*cos(x)*sin(x)),
sin(2*x)/(sin(2*x)-2*cos(x)*sin(x))],
[1/(sin(2*x)-2*cos(x)*sin(x)),
-2*sin(x)/(sin(2*x)-2*cos(x)*sin(x))])

(%i3) trigexpand(%);
Division by 0                                   <<<<<<<<<<<<<<<<< oops!
-- an error.  To debug this try debugmode(true);

(%i4) moore_penrose_pseudoinverse(trigexpand(mm));

(%o4) matrix([2*sin(x)/((4*cos(x)^2+4)*sin(x)^2+cos(x)^2+1),
1/((4*cos(x)^2+4)*sin(x)^2+cos(x)^2+1)],
[2*cos(x)*sin(x)/((4*cos(x)^2+4)*sin(x)^2+cos(x)^2+1),
cos(x)/((4*cos(x)^2+4)*sin(x)^2+cos(x)^2+1)])

On Mon, Aug 24, 2009 at 2:19 PM, Barton Willis <willisb at unk.edu> wrote:

> Try this and let me know how poorly / well it works:
>
>
> (%i53) moore_penrose_pseudoinverse(matrix([a,b],[2*a,2*b]));
> (%o53)
>
> matrix([a/(5*b^2+5*a^2),(2*a)/(5*b^2+5*a^2)],[b/(5*b^2+5*a^2),(2*b)/(5*b^2+5*a^2)])
>
>
> (1) Unlike most functions in linearalgebra, moore_penrose_pseudoinverse
> assuming that moore_penrose_pseudoinverse is at least useable, that's a
> bug.
>
> (2) There is no user documentation for moore_penrose_pseudoinverse; and
> that's a bug too.
>
> Barton
>
> maxima-bounces at math.utexas.edu wrote on 08/24/2009 11:51:17 AM:
>
>
> >
> > Does anyone know if there is some implementation for calculating a
> > pseudo inverse in Maxima? I've found this link - "http://
> > www.math.utexas.edu/pipermail/maxima/2007/008247.html" - but it
> > seems that the implementation is not exactly for Maxima and it only
> > handle numerical matrices...
>
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.math.utexas.edu/pipermail/maxima/attachments/20090824/1971b116/attachment.htm
```