Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

Simplifying and Rearranging Expressions

165 views
Skip to first unread message

David Park

unread,
Jan 29, 2009, 5:55:04 AM1/29/09
to
I want to start a thread on this because I believe many MathGroup people
will have some useful things to say.

A common task for Mathematica users is to obtain an expression that is in a
particular form. For students and teachers this may often be a textbook
form, or there may be other reasons that a particular form is desired.

It might be thought that this should be an easy task but quite often it can
be a very difficult task, even involving mathematical derivation and many of
the capabilities of Mathematica. Not obtaining a specific form may be a
matter of not knowing how to solve the problem in the first place.

Nevertheless, even simple rearrangement can be difficult. I sometimes think
of it as doing surgery on expressions. I believe it is generally desirable
to use Mathematica to rearrange an expression and not retype the expression.
Retyping is too error prone.

Simplify and FullSimplify are amazingly useful but it is difficult to
control them and obtain a precise result. One will often have to do
additional piecemeal operations. One downside of Simplify and FullSimplify
is that they can return different forms with different Mathematica versions.
Then any additional operations in an old notebook may no longer work. It
would be nice if there was a method of using these commands that would be
more version independent.

Various routines such as Together, Apart, Factor, TrigReduce, TrigFactor,
TrigExpand, TrigToExp, GroebnerBasis etc., can be useful in getting a
specific form. MapAt is very useful for doing surgery on specific parts of
an expression. Mathematica often gets two factors that have extra minus
signs. You can correct that by mapping Minus onto the two factors. For
integrals in the wrong form you could cheat by trying to find the constant
by which they differ by subtracting and simplifying, and then use that in
the derivation.

Over the years I've collected a number of routines that aid in manipulating
expressions and have included them in the Presentations package. Some of
these are: CompleteTheSquare, FactorOut (any 'factor' expression with
ability to hold results such as factoring from a matrix), MultiplyByOne (a
common mathematical technique), LinearBreakout, PushOnto (much better than
Through), HoldOp (hold a specific operation but evaluate the arguments),
CreateSubexpression (creates a tooltip and holds expressions together with a
tag so they won't get split by routines like Simplify),
ReleaseSubexpressions, MaplevelParts (apply an operation to a subset of
level parts, for example Factor three out of five terms in a sum),
MapLevelPatterns, EvaluateAt (evaluate specific parts of held expressions),
EvaluateAtPattern. SymbolsToPatterns, LHSSymbolsToPatterns (convert specific
derived rules to general patterned rules).

It is very useful to get Mathematica generated expressions into the form
that one wants. I believe that this is probably a sticking point with many
users. In general it is not a trivial topic. Others may have some good
general ideas that I don't know about. Someday someone may even write a good
tutorial on it.

David Park

djm...@comcast.net

<http://home.comcast.net/~djmpark> http://home.comcast.net/~djmpark/


AES

unread,
Jan 30, 2009, 2:31:32 PM1/30/09
to
In article <gls1u8$hjl$1...@smc.vnet.net>,
"David Park" <djm...@comcast.net> wrote:

> I want to start a thread on this because I believe many MathGroup people
> will have some useful things to say.

I'll bite, because I've done a bit of thinking on this.


> A common task for Mathematica users is to obtain an expression that is in a
> particular form. For students and teachers this may often be a textbook
> form, or there may be other reasons that a particular form is desired.

Just to add a bit of specificity to this, let's consider expressions
that arise in optics and e-m theory, which generally involve a set of
physical quantities (velocity of light, propagation constant,
permeabilities, index of refraction, frequency, wavelength,
characteristics impedance, critical angle of refraction, and multiple
others) that are conventionally written as

c, k, (or beta), mu, epsilon, n, f (or omega), lambda,
eta or z_0, thetaCrit, and so on

**each of which is directly linked or coupled to (that is, can be
calculated from) several others in the same set**.

[You have to put up with a side story at this point. The distinguished
physicist W. K. H. Panofsky, who just recently died, early in his career
co-authored with Melba Phillips a small but excellent text on classical
e-m, colloquially known as "Panofsky and Phillips", from which I and
many others studied. This was long enough ago that cgs and mks units
were still fighting it out in the physics community.]

[P and P beautifully sidestepped this issue by, as they noted in the
Preface to their book, writing every equation in their book using an
appropriate (but generally different) subset of the above symbols, such
that every equation was valid in mks units as it stood, **and could be
instantly converted to be exactly valid in cgs units as well, simply by
replacing any factor of epsilon that appeared in any of these equations
by 1/ 4 pi **.]


> It might be thought that this should be an easy task but quite often it can
> be a very difficult task, even involving mathematical derivation and many of
> the capabilities of Mathematica. Not obtaining a specific form may be a
> matter of not knowing how to solve the problem in the first place.

It may not be just a difficult task; in fact, **it may be an impossible
task** -- not to mention **an unnecessary and undesirable task**.

1) As already noted above, you may want to write expressions that
contain some subset of a linked set of variables in different ways at
different points in an exposition, because these different ways are
conventional in the field, and/or make the physical meaning clearer.

For example, you may want to write the space-time variation of a phasor
wave amplitude as Exp[ I k z - I omega t] because that's neat, simple,
and conventional.

But then, in discussing a waveguide mode where a factor k d (d =
waveguide width) appears, you may want to write that factor instead in
the form 2 pi d/lambda to emphasize that it's the width in wavelengths
that's important.

But if at some point in your notebook you're going to insert any of the
dependences within this set -- e.g., k := 2 pi / lambda -- then you're
stuck with this from then on.

2) A second point: My experience has been that useful identities that
often arise in analyses -- for example, with suitable qualifications the
infinite integral of Exp[- a x^2 + b x] == Exp[b^2/4a] -- sometime just
won't fall out (i.e., won't be explicitly evaluated by Mathematica if a
and b are actually more complicated expressions.

3) More generally, one very often wants to do the eventual numerical
calculations using only one or another form of dimensionless or
normalized variables, because that's numerically efficient as well as
physically and practically useful in expressing the results.

And, if at some point in an exposition you're going to convert your
analytical and expositional formulas into dimensionless formulas for
numerical calculation purposes -- **at that point you really don't care
how Mathematica arranges the resulting expression**.


> Nevertheless, even simple rearrangement can be difficult. I sometimes think
> of it as doing surgery on expressions. I believe it is generally desirable
> to use Mathematica to rearrange an expression and not retype the expression.
> Retyping is too error prone.

Last sentence is true; immediately preceding sentence may be true as
phrased -- but is a mistaken belief. Comments on this below.


> Simplify and FullSimplify are amazingly useful but it is difficult to
> control them and obtain a precise result. One will often have to do
> additional piecemeal operations. One downside of Simplify and FullSimplify
> is that they can return different forms with different Mathematica versions.
> Then any additional operations in an old notebook may no longer work. It
> would be nice if there was a method of using these commands that would be
> more version independent.

> Various routines such as Together, Apart, Factor, TrigReduce, TrigFactor,
> TrigExpand, TrigToExp, GroebnerBasis etc., can be useful in getting a
> specific form. MapAt is very useful for doing surgery on specific parts of
> an expression. Mathematica often gets two factors that have extra minus
> signs. You can correct that by mapping Minus onto the two factors. For
> integrals in the wrong form you could cheat by trying to find the constant
> by which they differ by subtracting and simplifying, and then use that in
> the derivation.

Let's say it like it is: It's not just "difficult" for ordinary users
to use and control many of these advanced tools: It's basically
**impossible** for the average user to learn what some of these tools
do, because they're so complex and the results can depend so critically
on what you put into them; all you end up doing is thrashing around
endlessly, trying to get them to produce the results you want.

The more powerful they get, the less they're worth trying to learn.


> It is very useful to get Mathematica generated expressions into the form
> that one wants. I believe that this is probably a sticking point with many
> users. In general it is not a trivial topic. Others may have some good
> general ideas that I don't know about.

My bottom lines are instead:

1) Accept that "Retyping is...error prone" -- and more generally that
"To err is human..." -- and to the extent that you have to do any form
of retyping, do a _lot_ of checking, rechecking, testing with simple
cases, and looking to see that results are physically meaningful.

2) Nonetheless, in general, "It is GENERALLY NOT very useful to get
Mathematica generated expressions into the form that one wants" -- at
least, not very often, and not if it involves any significant amount of
effort. It's wasted energy, and can add its own errors, or divert one
from seeing one's own errors.

3) Instead, if what you're doing is a complex analysis and/or
exposition, tackle the analysis portion initially with paper, pencil,
and a good soft eraser, the way God intended analysis to be done.

4) When and if certain calculations (series expansions, etc.) get
messy, run separate Mathematica symbolic calculations in auxiliary
notebooks to carry them out.

5) When it comes time for exposition, do the exposition using a tool
that's designed for exposition (e.g., TeX), while doing the numerical
calculations and graphing using a tool that's good at those things --
and while doing this repeat item 1) multiple times.


> Someday someone may even write a good tutorial on it.

How about instead someone **imbedding real TeX in Mathematica**, as part
of Mathematica's basic capabilities?

That is:

* TeX is (I believe) totally open source, free, highly stable, and
widely known and studied -- and it's full source code is very compact.

* So how about building the TeX source code into Mathematica's already
immense repertoire of rules and stuff, and allowing one to include at
any point in a "text portion" (I.e., a "non-evaluation portion") of a
Mathematica notebook cell the syntax

TeX[ ---any valid TeX syntax---]

such as TeX[$\alpha = \beta / \gamma^2$] to get that bit of inline math
into a Text or Header cell, or TeX[$$\alpha = \left( \beta /over
\gamma^2 \right)$$] to insert a display equation,

and just having Mathematica display the typeset box produced by TeX
using that syntax into the Mathematica notebook at that point, with the
stuff inside the [ ] brackets having no other evaluational function or
effect in Mathematica itself, except to be displayed?

Is there some reason this would be conceptually impossible? Would it be
that difficult to accomplish? Could it at least be implemented with some
reasonable subset of TeX syntax and capabilities?

If your goal is to have Mathematica notebooks serve simultaneously as
"exposition documents" and "calculation performing documents", might
this be a lot easier than endless fighting with option-laden and
temporally unstable Mathematica expressions like "Together, Apart,

Factor, TrigReduce, TrigFactor, TrigExpand, TrigToExp, GroebnerBasis"

and all their even more arcane extensions?

David Park

unread,
Jan 31, 2009, 1:13:45 AM1/31/09
to
From: AES [mailto:sie...@stanford.edu]


3) Instead, if what you're doing is a complex analysis and/or
exposition, tackle the analysis portion initially with paper, pencil,
and a good soft eraser, the way God intended analysis to be done.

........................

And perhaps using only integers, since I read that's all that God invented?

It reminds me of a story I read somewhere, I can't recall the exact book,
about the history of modern physics. Robert Serber was an important
physicist on the Manhattan project. He would tell the story that one night
he dreamed he had died and gone to heaven. Saint Peter issued him in to see
God and God said: "You probably don't remember me but I audited your course
on quantum mechanics at Berkeley." That is probably the best witness we have
that God did use paper, pencil and a good soft eraser! There were no CASs in
those days.

And to strengthen your case further we know there are good mathematicians
who would never touch a computer. Not to speak of the great mathematicians
of the past.

Nevertheless, I would still argue that users should be encouraged to do
derivations completely ACTIVELY using Mathematica. They may think about the
principles, strategy and tactics of a derivation when they are away from
Mathematica. But implementing a derivation or proof actively on Mathematica
has many advantages.

1) You have to gather explicitly the definitions and rules used in the
derivation. Knowing the starting point is often half the problem.
2) These definitions and rules are active knowledge that you not only use in
the specific derivation or proof but may be useful elsewhere. The same goes
for intermediate and final results. They are not just inert equations on a
piece of paper but active tools. They are the fruit of your labor. You can
use these tools in further derivations or in producing graphics or dynamic
presentations.
3) Active derivation has a great deal of self-proofing in it. Things have to
work. It is not totally foolproof, but it does impose a fair amount of
discipline.
4) One can try out ideas, and see their results much faster.
5) An interactive and dynamic medium of expression is just much better than
a static document.

A may seem like a lot of work, but in 99.99% of the cases Mathematica users
deal with it is entirely possible. The results will be well worth it. It is
no more work than writing any good paper without Mathematica. Any good
product requires work.

It also requires learning how to use the tools, and it requires that WRI
keep working on adapting Mathematica to the working requirements of
mathematicians, scientists and engineers. They haven't done that badly, and
we are still at the beginning of a technology and not at the end of it.
Remember what the Greeks said: The past is in front of you and the future is
behind you, because what you see is the past.

David Park
djm...@comcast.net
http://home.comcast.net/~djmpark/

Andrzej Kozlowski

unread,
Jan 31, 2009, 1:14:49 AM1/31/09
to
To my amazement I have found something that I agree here. I do agree
that it is largely a pointless waste of time to use computer algebra,
which relies on pretty complex algorithms (like Groebner basis) to
make this **look** the way you want them to look, for reasons that
have no particular relation to these algorithms. Its a waste of
computing resources, the effort of mathematicians and programmers and
most of all the user, who could much more easily achieve this effect
in other ways, one of which is TeX (even better was, in my opinion,
was David Bailey's clever idea to use color to manipulate Mathematica
expressions almost as one does by hand - unfortunately this appears to
have been abandoned due to lack of interest).
I don't think however there is any chance whatever of WRI
incorporating TeX into Mathematica, for two reasons. One is that it
would be going against their principal idea of having all Mathematica
expressions fully controllable by means of the Mathematica programming
language. Clearly this would not be true of TeX strings, if they were
meant to be interpreted for display. Secondly, because other CAS
systems have essentially tried to do this sort of thing with very
little to show for it in terms of market success. You seem to be
completely unaware of how tiny the TeX users community is compared
with the community of users of programs like Mathematica.
This reminds me also that a lot of suggestions which you have made
about the way Mathematica ought to be (simple, cheap, computation
engine, no fancy staff) has already been tried by WRI and clearly
failed. It was called something like The Computation Center, and
limited version of Mathematica, that Wolfram once sold for a fraction
of the price of the full thing. The only problem was that hardly
anyone bought it (I suspect you did not either).
Not surprisingly WRI is likely to be pretty skeptical of bright ideas
that remind them of things that they or others have already tired and
have been shown not to work.

Andrzej Kozlowski

On 30 Jan 2009, at 11:47, AES wrote:

> In article <gls1u8$hjl$1...@smc.vnet.net>,
> "David Park" <djm...@comcast.net> wrote:
>

>> I want to start a thread on this because I believe many MathGroup
>> people
>> will have some useful things to say.
>

> I'll bite, because I've done a bit of thinking on this.
>
>

>> A common task for Mathematica users is to obtain an expression that
>> is in a
>> particular form. For students and teachers this may often be a
>> textbook
>> form, or there may be other reasons that a particular form is
>> desired.
>

>> It might be thought that this should be an easy task but quite
>> often it can
>> be a very difficult task, even involving mathematical derivation
>> and many of
>> the capabilities of Mathematica. Not obtaining a specific form may
>> be a
>> matter of not knowing how to solve the problem in the first place.
>

>> Nevertheless, even simple rearrangement can be difficult. I
>> sometimes think
>> of it as doing surgery on expressions. I believe it is generally
>> desirable
>> to use Mathematica to rearrange an expression and not retype the
>> expression.
>> Retyping is too error prone.
>

> Last sentence is true; immediately preceding sentence may be true as
> phrased -- but is a mistaken belief. Comments on this below.
>
>

> Let's say it like it is: It's not just "difficult" for ordinary users
> to use and control many of these advanced tools: It's basically
> **impossible** for the average user to learn what some of these tools
> do, because they're so complex and the results can depend so
> critically
> on what you put into them; all you end up doing is thrashing around
> endlessly, trying to get them to produce the results you want.
>
> The more powerful they get, the less they're worth trying to learn.
>
>

>> It is very useful to get Mathematica generated expressions into the
>> form
>> that one wants. I believe that this is probably a sticking point
>> with many
>> users. In general it is not a trivial topic. Others may have some
>> good
>> general ideas that I don't know about.
>

> My bottom lines are instead:
>
> 1) Accept that "Retyping is...error prone" -- and more generally that
> "To err is human..." -- and to the extent that you have to do any form
> of retyping, do a _lot_ of checking, rechecking, testing with simple
> cases, and looking to see that results are physically meaningful.
>

> 2) Nonetheless, in general, "It is GENERALLY NOT very useful to get


> Mathematica generated expressions into the form that one wants" -- at
> least, not very often, and not if it involves any significant amount
> of
> effort. It's wasted energy, and can add its own errors, or divert one
> from seeing one's own errors.
>

> 3) Instead, if what you're doing is a complex analysis and/or
> exposition, tackle the analysis portion initially with paper, pencil,
> and a good soft eraser, the way God intended analysis to be done.
>

> 4) When and if certain calculations (series expansions, etc.) get
> messy, run separate Mathematica symbolic calculations in auxiliary
> notebooks to carry them out.
>
> 5) When it comes time for exposition, do the exposition using a tool
> that's designed for exposition (e.g., TeX), while doing the numerical
> calculations and graphing using a tool that's good at those things --
> and while doing this repeat item 1) multiple times.
>
>

>> Someday someone may even write a good tutorial on it.
>

> temporally unstable Mathematica expressions like "Together, Apart,


> Factor, TrigReduce, TrigFactor, TrigExpand, TrigToExp, GroebnerBasis"

Andrzej Kozlowski

unread,
Jan 31, 2009, 1:15:12 AM1/31/09
to
Correction, not "Computation Center" but "Calculation Center" which
has since been renamed CalcCenter and it seems it is still being sold:

http://www.wolfram.com/products/calccenter/

Andrzej Kozlowski

>>> I want to start a thread on this because I believe many MathGroup
>>> people
>>> will have some useful things to say.
>>

>> I'll bite, because I've done a bit of thinking on this.
>>
>>

>>> A common task for Mathematica users is to obtain an expression
>>> that is in a
>>> particular form. For students and teachers this may often be a
>>> textbook
>>> form, or there may be other reasons that a particular form is
>>> desired.
>>

>>> It might be thought that this should be an easy task but quite
>>> often it can
>>> be a very difficult task, even involving mathematical derivation
>>> and many of
>>> the capabilities of Mathematica. Not obtaining a specific form may
>>> be a
>>> matter of not knowing how to solve the problem in the first place.
>>

>>> Nevertheless, even simple rearrangement can be difficult. I
>>> sometimes think
>>> of it as doing surgery on expressions. I believe it is generally
>>> desirable
>>> to use Mathematica to rearrange an expression and not retype the
>>> expression.
>>> Retyping is too error prone.
>>

>> Last sentence is true; immediately preceding sentence may be true as
>> phrased -- but is a mistaken belief. Comments on this below.
>>
>>

>> Let's say it like it is: It's not just "difficult" for ordinary
>> users
>> to use and control many of these advanced tools: It's basically
>> **impossible** for the average user to learn what some of these tools
>> do, because they're so complex and the results can depend so
>> critically
>> on what you put into them; all you end up doing is thrashing around
>> endlessly, trying to get them to produce the results you want.
>>
>> The more powerful they get, the less they're worth trying to learn.
>>
>>

>>> It is very useful to get Mathematica generated expressions into
>>> the form
>>> that one wants. I believe that this is probably a sticking point
>>> with many
>>> users. In general it is not a trivial topic. Others may have some
>>> good
>>> general ideas that I don't know about.
>>

>>> Someday someone may even write a good tutorial on it.
>>

>> temporally unstable Mathematica expressions like "Together, Apart,


>> Factor, TrigReduce, TrigFactor, TrigExpand, TrigToExp, GroebnerBasis"

Daniel Lichtblau

unread,
Jan 31, 2009, 1:15:33 AM1/31/09
to
AES wrote:
> In article <gls1u8$hjl$1...@smc.vnet.net>,
> "David Park" <djm...@comcast.net> wrote:
> [...]

>> Various routines such as Together, Apart, Factor, TrigReduce, TrigFactor,
>> TrigExpand, TrigToExp, GroebnerBasis etc., can be useful in getting a
>> specific form. MapAt is very useful for doing surgery on specific parts of
>> an expression. Mathematica often gets two factors that have extra minus
>> signs. You can correct that by mapping Minus onto the two factors. For
>> integrals in the wrong form you could cheat by trying to find the constant
>> by which they differ by subtracting and simplifying, and then use that in
>> the derivation.
>
> Let's say it like it is: It's not just "difficult" for ordinary users
> to use and control many of these advanced tools: It's basically
> **impossible** for the average user to learn what some of these tools
> do, because they're so complex and the results can depend so critically
> on what you put into them; all you end up doing is thrashing around
> endlessly, trying to get them to produce the results you want.

It may well be difficult to use these in order to produce results that
satisfy certain constraints. But the functions named above are mostly
well defined in terms of what they do. This is in contrast to, say,
Simplify, which has operational semantics that are generally well known,
but is impossible to pin down in terms of expected result.


> The more powerful they get, the less they're worth trying to learn.

> [...]


> If your goal is to have Mathematica notebooks serve simultaneously as
> "exposition documents" and "calculation performing documents", might
> this be a lot easier than endless fighting with option-laden and

> temporally unstable Mathematica expressions like "Together, Apart,

> Factor, TrigReduce, TrigFactor, TrigExpand, TrigToExp, GroebnerBasis"

> and all their even more arcane extensions?

Again, these all have well defined semantics and produce results that
conform to vertain criteria. They are most definitely helpful to have
around, if you do work that requires any sort of canonical forms of
results. And there are other situations in which they can be useful or
even essential. This may not be true of your work, but if it involves
phases that do symbolic computation of any consequence, I would not be
surprised if you are missing out on some very useful tools.


Daniel Lichtblau
Wolfram Research

DrMajorBob

unread,
Jan 31, 2009, 6:42:44 AM1/31/09
to
David Park accomplishes much of what he is suggesting, already, in his
Presentations package. In example after example, he does quite a good job
with step-by-step derivations by manipulating one expression to get the
next. I think he's just looking for more ideas from the community and
possibly help (even from WRI) in getting further.

He's NOT suggesting anything that can't be done or isn't worth doing.

Anyone who thinks otherwise should seriously delve into the Presentations
package and see what I mean.

Bobby

On Sat, 31 Jan 2009 00:15:33 -0600, Daniel Lichtblau <da...@wolfram.com>
wrote:

> AES wrote:
>> In article <gls1u8$hjl$1...@smc.vnet.net>,
>> "David Park" <djm...@comcast.net> wrote:
>> [...]

>>> Various routines such as Together, Apart, Factor, TrigReduce,
>>> TrigFactor,
>>> TrigExpand, TrigToExp, GroebnerBasis etc., can be useful in getting a
>>> specific form. MapAt is very useful for doing surgery on specific
>>> parts of
>>> an expression. Mathematica often gets two factors that have extra minus
>>> signs. You can correct that by mapping Minus onto the two factors. For
>>> integrals in the wrong form you could cheat by trying to find the
>>> constant
>>> by which they differ by subtracting and simplifying, and then use that
>>> in
>>> the derivation.
>>

>> Let's say it like it is: It's not just "difficult" for ordinary users
>> to use and control many of these advanced tools: It's basically
>> **impossible** for the average user to learn what some of these tools
>> do, because they're so complex and the results can depend so critically
>> on what you put into them; all you end up doing is thrashing around
>> endlessly, trying to get them to produce the results you want.
>
> It may well be difficult to use these in order to produce results that
> satisfy certain constraints. But the functions named above are mostly
> well defined in terms of what they do. This is in contrast to, say,
> Simplify, which has operational semantics that are generally well known,
> but is impossible to pin down in terms of expected result.
>
>
>> The more powerful they get, the less they're worth trying to learn.
>> [...]
>> If your goal is to have Mathematica notebooks serve simultaneously as
>> "exposition documents" and "calculation performing documents", might
>> this be a lot easier than endless fighting with option-laden and

>> temporally unstable Mathematica expressions like "Together, Apart,


>> Factor, TrigReduce, TrigFactor, TrigExpand, TrigToExp, GroebnerBasis"

>> and all their even more arcane extensions?
>
> Again, these all have well defined semantics and produce results that
> conform to vertain criteria. They are most definitely helpful to have
> around, if you do work that requires any sort of canonical forms of
> results. And there are other situations in which they can be useful or
> even essential. This may not be true of your work, but if it involves
> phases that do symbolic computation of any consequence, I would not be
> surprised if you are missing out on some very useful tools.
>
>
> Daniel Lichtblau
> Wolfram Research
>
>
>

--
DrMaj...@longhorns.com

AES

unread,
Feb 1, 2009, 4:40:38 AM2/1/09
to
In article <gm0q8p$rrr$1...@smc.vnet.net>,
Andrzej Kozlowski <ak...@mimuw.edu.pl> wrote:

> To my amazement I have found something that I agree here. I do agree
> that it is largely a pointless waste of time to use computer algebra,
> which relies on pretty complex algorithms (like Groebner basis) to
> make this **look** the way you want them to look, for reasons that
> have no particular relation to these algorithms. Its a waste of
> computing resources, the effort of mathematicians and programmers and
> most of all the user, who could much more easily achieve this effect
> in other ways, one of which is TeX (even better was, in my opinion,
> was David Bailey's clever idea to use color to manipulate Mathematica
> expressions almost as one does by hand - unfortunately this appears to
> have been abandoned due to lack of interest).

Thank you -- always glad to have positive feedback (or negative
feedback, for that matter).

> I don't think however there is any chance whatever of WRI
> incorporating TeX into Mathematica, for two reasons. One is that it
> would be going against their principal idea of having all Mathematica
> expressions fully controllable by means of the Mathematica programming
> language. Clearly this would not be true of TeX strings, if they were
> meant to be interpreted for display.

Well, suppose you want to load an externally generated logo, in some
format like jpeg or PDF, into a Mathematica notebook, just to be
displayed as part of the exposition. You _can_ modify this object using
the Mathematica programming language if you want to; but you have no
desire to do so, you just want to display it.

Isn't this a close analog? Mathematica could modify or control those
TeX input strings, e.g., via options in the TeX[--TeX strings---]
command, as well as displaying them -- it just wouldn't be necessary or
desirable to do so, in most cases.



> Secondly, because other CAS
> systems have essentially tried to do this sort of thing with very
> little to show for it in terms of market success. You seem to be
> completely unaware of how tiny the TeX users community is compared
> with the community of users of programs like Mathematica.

No, I'm aware of how massively _important_ TeX has been and continues to
be to several equally important communities in this world -- which is to
say, I have an understanding of what a limited (and even sometimes
damaging) measure of importance "market success" can be, in a broader
view of the world.


> This reminds me also that a lot of suggestions which you have made
> about the way Mathematica ought to be (simple, cheap, computation
> engine, no fancy staff) has already been tried by WRI and clearly
> failed. It was called something like The Computation Center, and
> limited version of Mathematica, that Wolfram once sold for a fraction
> of the price of the full thing. The only problem was that hardly
> anyone bought it (I suspect you did not either).

Not really my view. I do believe that, if all positive and negative
factors were taken into account, Wolfram could make a _much_ greater
beneficial contribution to the world, _and_ make a lot of money, if the
undeniably massive skills and talents of its employees were brought to
the world in the form of some _modular_ collection of applications,
utilities, and plug-ins of different levels of sophistication and
complexity, separately purchasable, aimed at different users or market
segments having different levels of sophistication and economic
capability, each module well documented for its audience, all
interoperable through some common set of formats.

[And please give a broad and flexible interpretation to the term
"modular" in the preceding sentence.]


> Not surprisingly WRI is likely to be pretty skeptical of bright ideas
> that remind them of things that they or others have already tired and
> have been shown not to work.

In addition to Mathematica, I've purchased, successfully used, but most
often not particularly loved various components of MS Office, the Apple
iLife and iWork packages, and the Adobe suite of of interrelated
programs -- and a number of free-standing third-party apps for parts of
the same tasks, which I've often liked much better.

None of these four packages of course come close to Mathematica for
overall capability; but they do illustrate many of the usability
benefits -- not to mention the market success! -- of providing wide
subsets of integrated capabilities through a "modular" approach to a
related subset of tasks and objectives.

In other words, they worked just fine -- and were and are market
successes as well.

--AES

AES

unread,
Feb 1, 2009, 4:40:27 AM2/1/09
to
In article <gm0q6p$rpr$1...@smc.vnet.net>,
"David Park" <djm...@comcast.net> wrote:

> Nevertheless, I would still argue that users should be encouraged to do
> derivations completely ACTIVELY using Mathematica. They may think about the
> principles, strategy and tactics of a derivation when they are away from
> Mathematica. But implementing a derivation or proof actively on Mathematica
> has many advantages.

I'll back down on my recent assertions on this point. People doing
analyses should do them in whatever way works for them, and both David
and I can well have different but valid suggestions on this.

What I'm not at all ready to back down on at all-- and what Andrzej
Kozlowski appears to agree with me on, at least partially -- is the
broader assertion:

Proposing to do analysis; numerical calculation; graphing and animation;
and preparation of final expositions or presentations (i.e., reports,
articles, talks, online web sites), using just one massive "integrated"
package (e.g., Mathematica) and/or one single format (e.g., Mathematica
notebooks), is an absolutely bad, undesirable, misguided, unworkable
idea.

It may be workable, even convenient, in some limited cases: A simple
derivation, leading to a simple report or memo, which also functions as
a seminar presentation or class lecture.

But as a general or universal approach, it's a terrible idea, for many
reasons, not all of these connected specifically with Mathematica, but
with many of them very well illustrated by Mathematica.

David Bailey

unread,
Feb 1, 2009, 4:41:32 AM2/1/09
to
I very much agree that this capability would greatly enhance the range
of tasks that can be handled by Mathematica. Some years ago (version
3.1) I developed the "Coloured Expressions" package to attack this
problem. My idea was that in many real world cases, expressions can be
large and heterogeneous - you absolutely need to be able to direct an
operation such as Together at one particular part of an expression. The
package had a palette, and when you selected a subexpression and pressed
a button, the selected expression was wrapped in Red[] (in those days
Red was not a built-in symbol) and MakeBoxes rules were used to make
this display as a red expression. Several colours were available,
together with a set of functions that could apply a function such as
Together, or a transformation such as Sin[x]->x-x^3/6 to the coloured
parts of the total expression. Essentially this was a more visual way of
achieving what David Park's MaplevelParts function does (we discussed
this privately some time ago). Those who used the package seemed to like it.

It seems to me that with version 6/7 a better approach might be to
expand an expression by recursively wrapping each box in a structure
that would flash as the mouse passed over it and would have a
tooltip specifying a tag - something like "1.3.2.1" (the first box of
the second box of the third box of the first box of the total expression).

Such a string could be fed to a modified version of MaplevelParts.

Of course, given an expression such as a+b+c+d, it was possible to
colour (say) b and d - forcing these to be treated as a single
subexpression, whereas the actual BoxForm uses a flat representation of
such an expression - so a little more subtlety might be required -
perhaps "1.3.2.1(2,4)"

In manipulating an expression, I think it is important to distinguish
between universally valid mathematical operations, operations with
restricted validity, such as the Sin expansion example above, and
totally arbitrary operations (such as a transformation rule) that can
destroy the mathematical integrity of an expression completely (e.g.
Cox[x]->x-x^3/6). A great deal of the value of such an expression
manipulation system would be that it would provide something akin to an
audit trail. Thus you don't want most of the steps to rely on
transformation steps that depend on the user rather than on Mathematica
or a stock of validated expressions.

David Bailey
http://www.dbaileyconsultancy.co.uk

John Doty

unread,
Feb 1, 2009, 4:51:13 AM2/1/09
to
David Park wrote:

> Nevertheless, even simple rearrangement can be difficult. I sometimes think
> of it as doing surgery on expressions. I believe it is generally desirable
> to use Mathematica to rearrange an expression and not retype the expression.
> Retyping is too error prone.

In most cases, any description of how to rearrange an expression to a
specific form in a CAS will be more complex than a retyped expression. I
believe this is a theorem.

Therefore, in most cases, the easiest way will be to retype. It's not
error prone if you check it, e.g.:

Simplify[ retyped == original ]

--
John Doty, Noqsi Aerospace, Ltd.
http://www.noqsi.com/
--
The axiomatic method of mathematics is one of the great achievements of
our culture. However, it is only a method. Whereas the facts of
mathematics once discovered will never change, the method by which these
facts are verified has changed many times in the past, and it would be
foolhardy to expect that changes will not occur again at some future
date. - Gian-Carlo Rota

David Bailey

unread,
Feb 2, 2009, 6:20:29 AM2/2/09
to
John Doty wrote:
> David Park wrote:
>
>> Nevertheless, even simple rearrangement can be difficult. I sometimes think
>> of it as doing surgery on expressions. I believe it is generally desirable
>> to use Mathematica to rearrange an expression and not retype the expression.
>> Retyping is too error prone.
>
> In most cases, any description of how to rearrange an expression to a
> specific form in a CAS will be more complex than a retyped expression. I
> believe this is a theorem.
>
> Therefore, in most cases, the easiest way will be to retype. It's not
> error prone if you check it, e.g.:
>
> Simplify[ retyped == original ]
>
Testing successive transformations in this way is useful, but not all
transformations are exact. Particularly in physics, it is common to take
a Taylor expansion of part of an expression, or maybe even change
notation is some subtle way.

David Bailey
http://www.dbaileyconsultancy.co.uk

David Park

unread,
Feb 2, 2009, 6:22:06 AM2/2/09
to
It's OLD technology Tony.

As so often happens, you snip out the more forceful and useful items in my
replies.

For technical development and communication, an interactive and dynamic
medium, used actively, is orders of magnitude better that a static document.
I think this would be apparent to anyone who had ever actually seen and used
a well written dynamic document. The present old technology is now dominant
but it won't be forever and perhaps not even for long.

WRI is on the right path, and actually not that far from the goal. They need
help from users to get the users` perspective. But there is a certain
responsibility on users also to see the vision and learn how to use the
superb instrument they have.

From: AES [mailto:sie...@stanford.edu]


In article <gm0q6p$rpr$1...@smc.vnet.net>,
"David Park" <djm...@comcast.net> wrote:

> Nevertheless, I would still argue that users should be encouraged to do
> derivations completely ACTIVELY using Mathematica. They may think about
the
> principles, strategy and tactics of a derivation when they are away from
> Mathematica. But implementing a derivation or proof actively on
Mathematica
> has many advantages.

I'll back down on my recent assertions on this point. People doing

John Doty

unread,
Feb 3, 2009, 6:32:13 AM2/3/09
to
David Bailey wrote:
> John Doty wrote:
>> David Park wrote:
>>
>>> Nevertheless, even simple rearrangement can be difficult. I sometimes think
>>> of it as doing surgery on expressions. I believe it is generally desirable
>>> to use Mathematica to rearrange an expression and not retype the expression.
>>> Retyping is too error prone.
>> In most cases, any description of how to rearrange an expression to a
>> specific form in a CAS will be more complex than a retyped expression. I
>> believe this is a theorem.
>>
>> Therefore, in most cases, the easiest way will be to retype. It's not
>> error prone if you check it, e.g.:
>>
>> Simplify[ retyped == original ]
>>
> Testing successive transformations in this way is useful, but not all
> transformations are exact. Particularly in physics, it is common to take
> a Taylor expansion of part of an expression,

Plot[ approx - exact ] or FindMaximum[], or whatever it is you do to
check an approximation. Mathematica is an extremely good tool for
finding and evaluating approximations (it's one of my most common
applications). But you can't do that blindly with any tool.

Besides, Mathematica can do things like Taylor expansions, and you can
check that your approximate form is the same as Mathematica's.

> or maybe even change
> notation is some subtle way.

Usually, I find that a human-comprehensible transformation can be easily
expressed in Mathematica in one direction or the other.

But you haven't addressed my point. What you are asking for is, of
mathematical necessity, the hard way to do the job except in special
cases (e.g. Together[]). Wolfram seems to like special cases, so if you
can rigorously define one or two, I'm sure they can be added. But
avoiding the need for "surgery" in general is not a practical goal.

Andrzej Kozlowski

unread,
Feb 3, 2009, 6:32:24 AM2/3/09
to

On 1 Feb 2009, at 10:40, AES wrote:

> In article <gm0q6p$rpr$1...@smc.vnet.net>,
> "David Park" <djm...@comcast.net> wrote:
>

>> Nevertheless, I would still argue that users should be encouraged
>> to do
>> derivations completely ACTIVELY using Mathematica. They may think
>> about the
>> principles, strategy and tactics of a derivation when they are away
>> from
>> Mathematica. But implementing a derivation or proof actively on
>> Mathematica
>> has many advantages.
>

> I'll back down on my recent assertions on this point. People doing
> analyses should do them in whatever way works for them, and both David
> and I can well have different but valid suggestions on this.
>
> What I'm not at all ready to back down on at all-- and what Andrzej
> Kozlowski appears to agree with me on, at least partially -- is the
> broader assertion:
>
> Proposing to do analysis; numerical calculation; graphing and
> animation;
> and preparation of final expositions or presentations (i.e., reports,
> articles, talks, online web sites), using just one massive
> "integrated"
> package (e.g., Mathematica) and/or one single format (e.g.,
> Mathematica
> notebooks), is an absolutely bad, undesirable, misguided, unworkable
> idea.
>
> It may be workable, even convenient, in some limited cases: A simple
> derivation, leading to a simple report or memo, which also functions
> as
> a seminar presentation or class lecture.
>
> But as a general or universal approach, it's a terrible idea, for many
> reasons, not all of these connected specifically with Mathematica, but
> with many of them very well illustrated by Mathematica.
>


Well, I am not sure if I agree or not because I am not sure exactly
what point you are making. In fact, when reflect on how I use
Mathematica, it seems to me that I see a number of different issues
that have been conflated in this thread. One of them is using
Mathematica when (informally) working on mathematics. A different one
concerns preparing a paper for publication (I call this "working
formally"). Yet another one is when one is actually computing
(programming). Yet another one concerns teaching. There is also at
least one other, that I will describe at the end, and probably many
more than I am not aware of.

One issue is how a program like Mathematica should be used when
actually working ("informally") on some mathematics. I don't think
there is any universally valid answer to this because there are so
many different types of mathematics and so many different approaches
to doing it.
I myself wear several mathematical and programing hats and each of
them comes with a somewhat different working style. As an algebraic
topologist I do most of my work in my head, with the help of
pictures, which I prefer to draw on a blackboard or a white board
rather than on paper (the main reason being that whiteboards or
blackboards unlike pieces of paper do not have the habit of
disappearing when one needs them). Writing graphic programs in
Mathematica would not be of much use in this, for this pictures are
symbolic rather than literal. But the new set of simple graphic tools
that became available in Mathematica 6 is actually often quite
sufficient for this purpose and I have found myself using them quite
often for this sort of informal sketching.
The second stage of my work as a topologist is often computational.
Part of this work is algorithmic and I some times use Mathematica for
this (most often PolynomialReduce and GroebnerBasis ) and part
requires human insight. The ability to transform one expression into
another using Mathematica plays almost no role in this.

Most of the work that I do when I wear my (newer) probabilist's hat is
also not suitable for computer based symbolic manipulation since the
concepts are too general. In my probabilistic incarnation I
occasionally use Mathematica for performing certain algorithmic
transformations, for example applying the (multidimensional) Ito
formula to a complicated expression. For this kind of purpose, when
expressions are sufficiently complex, I find using Mathematica more
reliable than my own skills. But most of the time I just use
Mathematica for informal writing of formulas and I rely on typing and
copy and paste, just as I do when I wear my topologists hat. These
are almost never "live" formulas, since they refer to concepts that
are not defined in Mathematica. For example, when you work with an
integral integral with respect to a semi-martingale (e.g. a Wiener
process) you certainly do not want Mathematica to evaluate it as an
ordinary integral.

Finally, there is my third incarnation: when I work on computational
problems in mathematical finance or write a review of a paper on
computational mathematics for Mathematical Reviews I work mainly in
Mathematica (although again the reviews are written in TeX). This work
consists essentially only of programing and does not involve any "step
by step" symbolic manipulation.

All the above concerns informal working on mathematics. Writing for
publication is a different issue.
When I write a research paper or a review I almost always use TeX,
since only TeX is accepted by the journals I publish in.
But, I find Mathematica vastly more convenient than TeX for informal
work. In fact, there is a big difference between the way most people
do "informal mathematics" and the way things are presented for
publication.TeX and Latex are intended for formal mathematical
presentations but are totally unsuitable for informal work. I
certainly do not want to specify environments and all the rest when I
am working informally. On the other hand, Mathematica is very suitable
for informal symbolic manipulation and, if you become used to it and
skilled at it, quite as natural and efficient as pen and paper, with
the added bonus that Mathematica notebooks are harder to mislay and
loose and don't clutter your workspace. In fact I have been using
Mathematica in this way for teaching purposes for a decade, doing
computations "by hand" in Mathematica, displaying them by means of a
projector and making my notebooks available for download for my
students. Its much harder to do that with pen and paper.

Of course other people probably have quite different approaches, which
are better suited to the kind of things they do. But quite generally,
I believe that symbolic algebra programs are best used for symbolic
work that is too hard to do by hand. For example, I don't think it is
an efficient use of computing power and human intelligence to try to
force Mathematica to return an answer that is already well known and
can be easily obtained by hand. Functions, like, for example
TrigToExp, convert expressions to certain standard forms (in this
particular case trigonometric functions are converted to Logs and
Exponentials). Reducing complex expressions to standard forms is a
basic technique not just in computer algebra but in all of
mathematics. (It is because of these standard forms that FullSimplify
can sometimes show that two expressions are equal even if it cannot
reduce on to the other.) The "standard forms" that CAS systems can
handle efficiently are sometimes quite different from forms of
expressions that seem "nice" to human beings. Sometimes, more by
accident than by design, applying a certain permutation of standard
form transformations (perhaps together with Simplify) will lead one to
one of these forms that humans like. Finding such transformations can
be fun but one should keep the importance of such things in proper
perspective. It is not greater than, say, that of sudoku puzzles.

Finally, let me address what seems to be your main objection:

> Proposing to do analysis; numerical calculation; graphing and
> animation;
> and preparation of final expositions or presentations (i.e., reports,
> articles, talks, online web sites), using just one massive
> "integrated"
> package (e.g., Mathematica) and/or one single format (e.g.,
> Mathematica
> notebooks), is an absolutely bad, undesirable, misguided, unworkable
> idea.


I think you are missing the point of what WRI is doing. Nobody is
trying to impose a single format on the world of mathematics, and
nobody is trying to force mathematica users to abandon other programs.
The best proof of that is the large number of export formats that
Mathematica supports. The whole point of Mathematica "integrated
approach" is entirely different. In my opinion it lies in the idea of
"Mathematica Demonstration", as exemplified here:

http://demonstrations.wolfram.com/

I consider the Mathematica demonstration to be a truly remarkable and
revolutionary idea. Why, I will try to explain below. First, I just
want to note that this could not be achieved without a fully
integrated system that Mathematica provides. That's why I don't expect
that Mathematica will see any competition in this area for quite some
time.

Why I think these demonstrations are such a great idea? If you only
glance superficially at the demonstration site you may think that they
are merely cute animations and mathematical toys. Indeed, there are a
few of this kind, but be not deceived. Many demonstrations contain
fully functional code that can be downloaded by the user and after
minor adjustment be used to solve serious real life problems. At the
same time, the Mathematica demonstration provides a remarkably
intuitive and lucid way of conceptualizing what otherwise would be
more or less incomprehensible piece of computational code. Some of the
demonstrations I have contributed are based on papers I reviewed for
Mathematical Reviews. In my opinion, these demonstrations have far
greater explanatory power than any number of words (certainly any
number of words written by me). Some others attempt to elucidate
concepts in Mathematical finance while at the same time providing code
that can be actually useful in real world computations. In the case of
mathematical finance, I think there is an almost universal agreement
that in the past computational techniques were emphasized too much
while conceptual clarity was neglected. Mathematica now offers a
unique way to combine conceptual description of a model with a
mathematical solution through an analytical or numerical process. If
more people contribute demonstrations adopting this approach the
demonstrations site could become a valuable repository of reusable
code accompanied by conceptual visualizations with a very wide area of
applicability.

In my opinion a Mathematica demonstration is much more than a "new
format", it is a completely new form of expressing and communicating
mathematical ideas. As such it justifies everything that WRI has done
to make it possible - which is essentially everything that you are
objecting to in Mathematica. But of course, you are always free to
ignore these new features if they hold no interest for you. You are
also free to use CalcCenter, which may well do everything that you
really wish to use Mathematica for (I can't guarantee that as I do not
really know either how you use Mathematica or what exactly CalcCenter
can do).

Andrzej Kozlowski

David Park

unread,
Feb 4, 2009, 5:39:16 AM2/4/09
to
Demonstrations Project yes. It is the dynamic style one can easily get in a
Mathematica notebook and not in a static document. My objection to the
Demonstrations Project is that the ones I've looked at are just a single
Manipulate statement with very little textual explanation or development.
Much better to have a notebook that contains development, textual discussion
and various kinds of presentations, dynamic and otherwise, and tools to
explain and work with some concept.

For human beings it is just easier to understand an action than it is to
understand a static object. We evolved to respond to actions.

I have a theory about great mathematicians.
1) They have the ability to visualize actions and interactions of abstract
objects in their mind, probably often geometrically.
2) They are very good at calculating without mistakes, perhaps a little like
some autistic people.
3) They can immerse themselves in many specific cases and calculate them out
rather fast and this way they gain a lot of experience.

It is just these things that Mathematica, if used properly, helps with. The
newer dynamics helps with (1). And also remember that step-by-step
derivations with the actual rules or definitions made explicit are a kind of
'action'. The standard CAS facilities help with (2) and because of this we
can do a lot of (3). This opens up real mathematics to a much broader class
of people and that is a worthy goal in itself. This won't make everybody
great creative mathematicians, but it might boost a few who otherwise were
weak in one of the skills.

But it takes an active, interactive, dynamic and discursive style of writing
Mathematica notebooks to get the full benefit. Static documents are the old
technology.

Andrzej Kozlowski

unread,
Feb 4, 2009, 5:35:20 AM2/4/09
to

On 3 Feb 2009, at 15:13, David Park wrote:

> Demonstrations Project yes. It is the dynamic style one can easily
> get in a
> Mathematica notebook and not in a static document. My objection to the
> Demonstrations Project is that the ones I've looked at are just a
> single
> Manipulate statement with very little textual explanation or
> development.
> Much better to have a notebook that contains development, textual
> discussion
> and various kinds of presentations, dynamic and otherwise, and tools
> to
> explain and work with some concept.

The fact that there is only one Manipulate statement per demonstration
is no real restriction since one can make any number of demonstrations
on a single topic (you can easily find examples of this on the
Demonstrations site). The amount of textual information that can be
included in the Details section isn't much less than in a typical
review in Mathematical Reviews or Zentralblatt MATH. My vision of what
a Demonstration is something rather like that of a review: the purpose
is not to replace books, journal articles etc. but rather to provide a
guide to what is available together (in favorable cases) with usable
code. References to books and articles where the user can find more
details are, in my opinion, just as essential in a Demonstration as in
a review.

>
>
> For human beings it is just easier to understand an action than it
> is to
> understand a static object. We evolved to respond to actions.
>
> I have a theory about great mathematicians.
> 1) They have the ability to visualize actions and interactions of
> abstract
> objects in their mind, probably often geometrically.
> 2) They are very good at calculating without mistakes, perhaps a
> little like
> some autistic people.
> 3) They can immerse themselves in many specific cases and calculate
> them out
> rather fast and this way they gain a lot of experience.

Personally I would leave "greatness" out of this, if for no other
reason than the one that it comes in an infinite variety while
representing an infinitesimal market share. However, my own experience
of contact with unquestionably great mathematicians makes me doubt at
least 2 above. I still remember watching as an undergraduate a Fields
medal winner (http://en.wikipedia.org/wiki/Stephen_Smale) struggling
with a system of 2 linear equations with two unknowns. More typical is
the following comment by another really great mathematician (http://en.wikipedia.org/wiki/Vladimir_Arnold
)

"Every working mathematician knows that if one does not control
oneself (best of all by examples), then after some ten pages half of
all the signs in formulae will be wrong and twos will find their way
from denominators into numerators."

Which may, perhaps, be a good reason why even great mathematicians
might benefit from using programs like Mathematica.


Andrzej Kozlowski

>
>
> It is just these things that Mathematica, if used properly, helps
> with. The
> newer dynamics helps with (1). And also remember that step-by-step
> derivations with the actual rules or definitions made explicit are a
> kind of
> 'action'. The standard CAS facilities help with (2) and because of
> this we
> can do a lot of (3). This opens up real mathematics to a much
> broader class
> of people and that is a worthy goal in itself. This won't make
> everybody
> great creative mathematicians, but it might boost a few who
> otherwise were
> weak in one of the skills.
>
> But it takes an active, interactive, dynamic and discursive style of
> writing
> Mathematica notebooks to get the full benefit. Static documents are
> the old
> technology.
>
>

0 new messages