From: S. B. Gray on
In response to someone who objected to my statement that replacement
rules are not adequate for what I want to do, I will state the problem
more completely without getting into irrelevant details.

I have n points in R3 in general position. Through all (n choose 3) sets
of 3 points I construct a plane and a circle. The plane computation
results in three parameters for each plane, a[i],b[i], and c[i], each a
simple but not trivial function of x,y,z of the 3 points it goes
through. The plane is now described by 3 parameters instead of the 9 for
the 3 points. Each circle is described, after a moderately complex
computation, as center, radius, and unit normal, each also a function of
x,y,z of the 3 points. So the circle is now described by 7 parameters,
each with a clear geometric meaning that can be verified using
Graphics3D, rather than the original 9.

To avoid extreme complexity in the following steps, I do not let Mathematica
reduce these parameters to the initial x,y,z's, but define new symbolic
variables describing the plane and circle. Next, I want to find the line
that is the intersection of two of the planes, z=x*zm + zd and y=x*ym +
yd, where the four new parameters are functions of the 6 parameters
describing the 2 planes. Finally I want to compute the two (or zero)
intersections of that line and the circle on one of the 2 planes, in
terms of ym,yd,zm,zd and the 7 circle parameters.

If I let Mathematica express these intersections in terms of the x,y,z's of the
six points defining the two planes, the result is a horribly complicated
expression that is not only incomprehensible but involves repeated
evaluation of quite a few subexpressions. It makes much more sense to
define new variables at each step and derive symbolic expressions for
them in terms of the results of the previous step.

My questions are:

1. If I do everything symbolically, what is the best method of
preventing Mathematica from expressing the final answer in terms of the initial
ones?

2. If substitution rules allow this to be done, how to do it?

3. Having read a few responses to my first, crude, statement of this
problem, I still do not see a clear answer.

4. It would be nice for Mathematica to first, be able to prevent full evaluation
of the final answer in terms of the initial parameters, and, second, for
Mathematica to find suitable intermediate symbolic variables by itself, both to
create comprehensible expressions and to reduce duplicate evaluations.

5. Obviously computations by many Mathematica users involve a similar number of
separate steps where the same type of help would be useful, so I wonder
if WR is planning to address this.

Steve Gray

From: David Bailey on
On 21/06/10 07:11, S. B. Gray wrote:
> variables describing the plane and circle. Next, I want to find the line
It always helps to post some code.

However, when you say you define some new variables, I am guessing that
you wrote an actual assignment:

xn= a x + b y + c z;

(say)

This is not usually the best way to do algebraic manipulations, because
after such an assignment, whenever you write (or otherwise create) an
expression involving xn, it will evaluate to an expression involving x,y,z.

Don't make such an assignment, but change variables using a replacement
rule. Thus to revert to {x,y,z}, do :

expr /.{xn->a x+b y+c z,yn-> ...... }

Notice that if you use Solve to get the Xn in terms of the {x,y,z}, the
answer comes back as rules - ready made for a replacement!

You should only use an assignment when you really want Mathematica to
use that assignment to eliminate the variable whenever it can - which
isn't that often when doing algebra, as opposed to more general
programming.

David Bailey

http://www.dbaileyconsultancy.co.uk