algorithms for 'invert', was: program works with maxima 5.29.1 but freezes with maxima 5.30.0



So it depends upon what you're trying to achieve, and which fields/rings are involved.

For example, even though Common Lisp supports numerator/denominator rational numbers,
I almost never use them because they are too slow (too many GCD's involved).  It is
better to rearrange the computations to involve only integers, and produce the final
result as a rational number when/if needed.

I've found the same thing true in Maxima: when operating on very large rational functions,
I keep the numerator & denominator separate.

In particular, the adjoint method avoids divisions until the very last step.

If relatively large integer matrices are involved, it is worth the effort to compute
the result mod p for various p's and Chinese remainder the result.

The advantages of certain 'efficient' matrix operations like LU quickly disappear when
operating with rings other than floating point numbers.

My rule of thumb: if I have to wait very long for a computation to finish, and if I
can think of a way while waiting to speed up the computation by reprogramming it, I'll
do it.

At 12:51 AM 4/19/2013, Robert Dodier wrote:
>On 2013-04-16, Dmitry Shkirmanov <piminusmeson at bk.ru> wrote:
>
>> Hello, list. I have wxmaxima program that takes a few seconds to run 
>> with maxima 5.29.1. But  in maxima 5.30.0 it freezes.  Is there any way 
>> to make it work with maxima 5.30?
>
>Well, it turns out the problem is very simple. The previous version of
>the function 'invert' used the adjoint method, while the current version
>uses the LU decomposition. (Yes, it was yours truly who made the change,
>after some discussion on the mailing list.) For the matrices in the
>program given, the results are substantially different -- the ones
>produced by the adjoint method are "simpler". 
>
>Not sure where to go from here. I remember from working on the code that
>the adjoint method often produces 'simpler' results, but it is practical
>only for small matrices. Maybe use the adjoint method for small matrices
>and punt to LU otherwise? Just guessing.
>
>In the case at hand, I think all you have to do is load(invert) before
>loading the temp3.wxm script -- share/matrix/invert.mac is an
>implementation of the adjoint method (in fact the previous 'invert'
>function was a Lisp version of that code).
>
>best
>
>Robert Dodier