MathGroup Archive 2001

[Date Index] [Thread Index] [Author Index]

Search the Archive

Palette to Highlight and Substitute Same Subexpressions?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg26692] Palette to Highlight and Substitute Same Subexpressions?
  • From: Adalbert Hanssen <hanssen at zeiss.de>
  • Date: Wed, 17 Jan 2001 00:47:39 -0500 (EST)
  • Sender: owner-wri-mathgroup at wolfram.com

Hi, MathGroup,

when (manually) simplifying complicated expressions, one frequently
encounters the situation, that one recognizes subexpressions 
appearing over and over again.

In this situation, first simplifying these subexperssions (and 
probably substituting new symbols for them), might turn down the 
complexity of the formula dramatically. The feasible order of 
substitutions depends however among others on the number of 
ocucurences of the subexpression in view.

I am looking for something like this:

First, in an OutputCell (most likely in InputForm, to make things
simpler), I would select one of the repeating subexpressions (probably
using Control-Shift-B to select parenthesized parts and later extend
them as desired).

Then I would press a button "count" of the looked-for palette and it 
would show me the number of occurrences of the selected subexpression
within the OutputCell, in which the selection is (perhaps, the display 
might go to the status line of the notebook).

If the count is high enough, I would like to press a button "color",
which colors all occurences of the selected subexpression (in place,
in the cell, in which I am working or, if this is easier to do, in
a copy of this cell). 

Next I would like a button "substitute", which asks me for a substi-
tution for the highlighted subexpression and all its siblings.
The substitution should be performed, also the substitutions
should accumulate in a buffer (list of rules).

Finally I am looking for another button "paste", which pastes
all the substitutions after "/." to the end of the cell, which
generated the output cell and resets the substitution buffer.
Thus, re-evaluating the cell with the appended substitutions
would yield the result, which has been accumulated by using
the palette (re-evaluating the cell might be less effective,
as the result to be streamlined might have taken long to 
compute).

If the looked for palette would be perfectly done, it would
memorize the cell, on which the first substitution is done
and complain, if it is applied to another cell with the
substitution buffer not empty.

Has any member of this group set up something similar?
Has anybody ideas, how to create such a palette function?

kind regards

Dipl.-Math. Adalbert Hanszen


  • Prev by Date: Re: horizontal cylinder
  • Next by Date: Re: Infinite loop while generating gcc.1
  • Previous by thread: MathSource Package Corrected
  • Next by thread: Re: Infinite loop while generating gcc.1