Some usage questions



> How do you deal with %R variables?  Maxima sticks them
> in results sometimes

As documented under ALGSYS, after any command that introduces %R
variables, %RNUM_LIST is set to the list of those variables.

> 2) How to coerce maxima into simplifying expressions?  It 
> will sometimes produce results like
> 
>               2 A + 2 %I B
>               ------------
>                   2
> 
> I've tried using simplify and similar things, but haven't 
> found any way to turn it into a simple "A + %I B".

By "simplify", I assume you mean the internal Lisp function.  Simplify
is generally idempotent (but cf. expand), so applying simplify to the
result of a Maxima function -- which is already simplified -- will
generally not do anything.

I am not sure I understand your use of the word "coerce" here, by the
way.  The general simplifier has already been applied to this
expression.  Now, arguably the general simplifier should handle this
case, but it doesn't... so you will have to apply other simplifications.

In your particular case, there are various ways to simplify to a+%i*b,
but I can't think of any general way to handle all such cases other than
defining your own simplification rule for tellsimpafter.

The most specific way is multthru, which operates only on the top-level
operator:

  Expr: (2*a+2*%i*b)/2;
  Multthru(Expr) => a+%i*b

It's true that that simplification looks easy enough and universal
enough to apply automatically, maybe even for cases like (6*a+8*b)/2.
It becomes less clear for cases like (3*b+2*a)/3 or (3/2*a + 2*b)/3 --
should these automatically become b+2/3*a and (1/2*a + 2/3*b)?  How
about inexact numbers (floats and bfloats)?

Note that it does not work for some other cases: Multthru(Expr^2) does
nothing.  Perhaps it (or some variant) should.  But should it also
handle (4+6*x)^2/4?  Or (sqrt(2)+sqrt(2)*x)^2/2?  Or
(sqrt(10)+sqrt(6)*x)^2/2?

Another possibility is Expand, which works on all levels, with some
control over what exactly gets expanded with its second and third
arguments.  But only those parts that get expanded will be simplified.
Similarly for Ratsimp and Rat.  So if you have any terms like
(2*a+2*b)^20/2^20, you are in tough luck.  Though Factor(Expr2) will
work, Factor(Expr2+1) will not; Gfactorsum will, but I'm not sure that's
the answer you want....

> is there a flag to tell it to print array indices as ... A [1][2]

Not for 2-dimensional display, but it does do this for linear display
(display2d:false).  You can look at dimension-array (displa.lisp) if you
want to write your own 2-dimensional display routine.

      -s