[Date Index]
[Thread Index]
[Author Index]
Re: Eliminating common factors?
*To*: mathgroup at smc.vnet.net
*Subject*: [mg93354] Re: Eliminating common factors?
*From*: AES <siegman at stanford.edu>
*Date*: Tue, 4 Nov 2008 06:21:14 -0500 (EST)
*Organization*: Stanford University
I appreciate the effort Bob Hanlon put into listing multiple solutions
to my original post in his response reproduced below. My actual
calculation, which I simplified for the initial post, was
sx0sqr = wx0sqr/4; sy0sqr = wy0sqr/4;
sxsqr = sx0sqr + (mx4 lamsqr (z - z0x)^2/(16 pisqr sx0sqr));
sysqr = sy0sqr + (my4 lamsqr (z - z0y)^2/(16 pisqr sy0sqr));
srsqr = sxsqr + sysqr;
sr0sqr = sx0sqr + sy0sqr;
wxsqr = 4 sxsqr; wysqr = 4 sysqr;
{wxsqr, wysqr}
leading to the output
{4 (wx0sqr/4 + (lamsqr mx4 (z - z0x)^2)/(4 pisqr wx0sqr)),
4 (wy0sqr/4 + (lamsqr my4 (z - z0y)^2)/(4 pisqr wy0sqr))}
This is just the first cell of a lengthy and messy symbolic calculation
of optical beam propagation formulas, in which the objective is to
transform these results in x,y coordinates into comparable formulas in
cylindrical coordinates and derive relations between rectangular and
cylindrical beam parameters.
By accident as much as design, the outputs above, except for the
superfluous factors of 4, come out in just the form conventionally used
in the relevant literature, namely a "constant" or z-independent term,
plus a separate z-dependent term containing the physically significant
factors (z-z0x)^2 and (z-z0y)^2, which I'd like to preserve intact since
they'll provide helpful physical insight in messier results later on.
The problem is that _every_one_ of the commands suggested below (plus
the FactorTerms command suggested by someone else), while getting rid of
the unnecessary factors of 4, also expands out the (z-z0)^2
factors into 3 separate terms, thus making the results longer, messier,
and less easy to view.
One solution would be to replace each of the (z-z0)^2 factors by a
single factor zminusz0sqr in my initial inputs, then convert back at the
very end of the calculations. Doing this will make any of the Hanlon
suggestions work as desired.
I realize it's pointless to ask why Mathematica doesn't automatically
remove the utterly superfluous integer factors of 4 in the above
outputs. In fact, I still wonder if there is some deep, deep reason
that I don't grasp that says that Mathematica _should_not_ do this
apparently obvious simplification, because doing it could possibly lead
to trouble in some other situation if Mathematica were designed to do
this automatically.
=============================================
>From Bob Hanlon:
In the simple form provided, just about any command that touches it will
work. Without the actual expression there is no way to help.
expr = 4 (a/4 + b/(4 c))
4*(a/4 + b/(4*c))
expr // Simplify
a + b/c
expr // Apart
a + b/c
expr // Expand
a + b/c
expr // ExpandAll
a + b/c
expr // Cancel // Apart
a + b/c
expr // Together // Apart
a + b/c
expr // Factor // Apart
a + b/c
Bob Hanlon
Prev by Date:
**strange effect: program works only when board clicked**
Next by Date:
**Re: Trinomial decics x^10+ax+b = 0; Help with Mathematica code**
Previous by thread:
**Re: Eliminating common factors?**
Next by thread:
**Re: Re: Eliminating common factors?**
| |