maxima written in maxima



I agree with Stavros..

Very little internal code has been written using pattern matching
(One, used in Moses' integrator, is used in probably 15-20 places;
it may also be used in summation). The user-level pattern matcher
I wrote, and which may have been rewritten in commercial Macsyma,
is used in a few places perhaps like ODE solving(?). Only a few
end users have tried it.

There is a philosophical issue about pattern matching.  It is
possible to make things "look right" by amassing a number
of special case patterns, without every getting to the core
issue.  You could solve polynomial factorization by pattern
matching.  Poorly.

I think that large systems using patterns are terrible maintenance
nightmares. Patterns tend to interact.  For example, say you
decide that you want log(a*b) to simplify to log(a)+ log(b), and
make that 'always happen'.  Would you be surprised if
integration ceased to work? I wouldn't be surprised.

RJF


Stavros Macrakis wrote:

>>What parts of Maxima can be written in Maxima, and does it
>>make sense to do so? ...
>>Does it make Maxima more maintainable for solve to
>>be written in Maxima, or not?  It seems to me, if one is 
>>implementing some formula, a language that is closer to 
>>mathematical notation would be preferable.
>>    
>>
>
>The advantage of the Maxima language for writing math is infix notation
>-- which does indeed often make things simpler and more compact,
>especially when most of the content of a function is a fixed
>mathematical formula, e.g.
>
>   disc(a,b,c):=b^2-4*a*c
>vs.
>   (defun disc (a b c) (sub (pow b 2) (mul 4 a c)))
>
>However, most Maxima internals don't include long formulas.
>
>The disadvantages of the Maxima language are many:
>
> -- it is simply not a very well-designed or complete
>    programming language;
> -- since it doesn't support lexical scope, variable name
>    conflicts with user variables could cause complications;
> -- there are few editing and debugging tools available for it;
> -- it doesn't benefit from libraries of Lisp functions; though
>    it is possible to call Lisp functions using ?function notation,
>    since its semantics involve the simplifier, you can't (for
>    example) use lists that don't start with (mlist);
> -- its existing library of functions is specifically tailored to
>    user programming;
>
>That is the language.  Then there is the implementation.  Since it has
>not been used as a production language implementation, it has bugs which
>have never been fixed, including inconsistencies between the interpreted
>and compiled versions (certain flags are ignored, for example).  In some
>cases, compiled code is comparable to hand-coded Lisp, in other cases it
>is somewhat inefficient.
>
>There is another issue which is orthogonal to Lisp vs. Maxima languages,
>namely the style of programming, procedural vs. pattern-driven.
>Currently, Maxima uses pattern-matching in very few places internally --
>the SIN integration package is the only one I can think of off the top
>of my head.  You could certainly imagine large parts of the simplifier
>and other modules being written in terms of pattern match and replace.
>
>Maxima does of course have pattern matching facilities.  Frankly, I have
>not used them much, so I leave it to Rich Fateman (who if I remember
>correctly wrote them) to comment on their usability, semantics, and
>efficiency.  Certainly in principle a pattern-matching implementation
>could be *both* cleaner *and* more efficient than hand-written code.
>
>So would any of these changes make Maxima more maintainable?  Probably
>yes: a pattern-driven, infix-notation system is probably easier to work
>on for many people.  Not that it is trivial, of course: interactions
>among patterns can be very tricky; but still it could well be better.
>But how about the intermediate period?
>
>Oh, and by the way, who is going to bell the cat? i.e. who is actually
>going to do the work?  And will it have been worth it in the end?
>
>        -s
>
>_______________________________________________
>Maxima mailing list
>Maxima@www.math.utexas.edu
>http://www.math.utexas.edu/mailman/listinfo/maxima
>  
>