On Thu, Mar 03, 2011 at 07:40:07PM -0600, Barton Willis wrote:
>
>Such schemes exist, I think; you might examine the source code for cf and cfdisrep:
>
>(%i6) cfdisrep(cf(1/3 + sqrt(5)));
>(%o6) 2+1/(1+1/(1+1/(2+1/2)))
>
>(%i7) ?print(%);
>((MPLUS SIMP CF) 2 ((MEXPT SIMP) ((MPLUS SIMP CF) 1 ((MEXPT SIMP) ((MPLUS SIMP CF) 1 ((MEXPT SIMP) ((MPLUS SIMP CF) 2 ((RAT SIMP) 1 2)) -1)) -1)) -1))
>(%o7) 2+1/(1+1/(1+1/(2+1/2)))
>
>You would also need to investigate how the cf flag alters simplification (maybe the cf flag is
>ignored when it shouldn't be. I don't know.)
>
Yes, cfdisrep is another example similar to what I am trying to do.
So it seems that there many functions such as cfdisrep, factor and
taylor that return expressions in a particular form which is not
automatically simplified or evaluated unless the user explicitly
requests that. But there are also some other functions that don't do
that. For example, for some square matrix A
get_lu_factors(lu_factor(A))
returns a list of matrices [P,L,U] such that A=P.L.U. It would be nice
if get_lu_factors returned the 3 matrices as product that would not get
automatically simplified or evaluated.
The purpose of my original post was to ask if there is a general
mechanism that allows you to do that. It would be nice if there was such
a general mechanism, and it would be even better if this could be
accomplished without having to write any lisp code. Maybe a solution
would be to output nouns of infix operators in a way better than
'?mtimes(2,3)
Maybe 2 '* 3 or even 2 * 3.