Re: holding boxes verbatim

• To: mathgroup at smc.vnet.net
• Subject: [mg56258] Re: holding boxes verbatim
• From: Chris Chiasson <chris.chiasson at gmail.com>
• Date: Wed, 20 Apr 2005 05:31:54 -0400 (EDT)
• References: <00aa01c544e3\$6db4af30\$6400a8c0@Main>
• Reply-to: Chris Chiasson <chris.chiasson at gmail.com>
• Sender: owner-wri-mathgroup at wolfram.com

```As a follow up to those who requested clairification:

Consider the simple examples:

HoldAllComplete[b*(a + s*m)] (*notice the order of the vairables
inside the inner Times is rearranged on output*)
HoldAllComplete[(x)^(1/2)] (*notice the reformatting of an expression
to the power 1/2 is reformatted to the square root of the expression*)
HoldAllComplete[(x/y)(h/g)] (*notice the elimination of the parenthesis*)

The reason these things happen is that the boxes are parsed into
Mathematica input such as Times[b,Plus[a,Times[s,m]]].

I need a way to work directly with the boxes, but still at least do
some variable substitution.

Thank you again for your time.

On 4/19/05, Carl K. Woll <carlw at u.washington.edu> wrote:
> "Chris Chiasson" <chris.chiasson at gmail.com> wrote in message
> news:d42l18\$3gf\$1 at smc.vnet.net...
> > Dear Math Group gurus,
> >
> > Mathematica is annoying me. I would like some way to type in a two
> > dimensional box form (representing an arbitrary expression) and assign
> > it to a symbol. I would then like to be able to operate on the
> > expression by, for instance:
> > 1 printing it
> > 2 printing it with some variables' values substitued into it
> > 3 and finally evaluating it
> >
> > Hold and its variants do not do the job because they prevent
> > expression evaluation, but I need something that will keep its box
> > form exactly as I have typed it.
> >
> > Please, how does one do this?
> >
> > A method for doing this is very useful to me because my professors
> > like to see the variables substitued into the original (not
> > Mathematica reparsed original, but verbatim original) equations.
> >
> > Thank you for your very valuable time,
>
> An example of the desired behavior would be helpful. At any rate, have you
> tried using HoldForm? For example:
>
> expr = HoldForm[2^(x+1)];
> expr
> expr /. x->2
> ReleaseHold[ expr /. x->2 ]
>
>  x + 1
> 2
>  2 + 1
> 2
> 8
>
> I used InputForm instead of a 2D box form for expr for legibility, but using
> a 2D box form for expr won't cause any problems.
>
> If the above is not helpful, please give an example of the behavior you
> desire.
>
> Carl Woll
>
>

--
Chris Chiasson
Kettering University
Mechanical Engineering