MathGroup Archive 2011

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

Search the Archive

Re: output forms

  • To: mathgroup at smc.vnet.net
  • Subject: [mg121502] Re: output forms
  • From: "David Park" <djmpark at comcast.net>
  • Date: Sun, 18 Sep 2011 04:08:45 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com
  • References: <2973956.142355.1316252805735.JavaMail.root@m06>

Your ultimate objective is not clear here. In any case, Mathematica always
evaluates everything, applying all definitions until there are no more that
can be applied.

I probably wouldn't define values for a, b and c but use Rules instead to
substitute their values (or a With statement). This preserves their use as
symbols.

To prevent automatic evaluation you have to use HoldForm. Then you can get
evaluation by using ReleaseHold. But suppose you want to do selective
evaluation of a held expression? The Presentations package has an
EvaluateAtPattern command that allows you to do selective evaluations.

If you are new to Mathematica % refers to the previous output.

<< Presentations` 

HoldForm[a + b c]
% /. {a -> 1, b -> 2, c -> 3}
% // EvaluateAtPattern[_Times]
% // EvaluateAtPattern[_Plus] 

This gives the successive outputs:

a + b c
1 + 2 x 3
1 + 6
7

Mathematica is not, out of the box, very good at teaching or illustrating
elementary or basic math, but with a little effort, using HoldForm, or
bypassing the more powerful automatic routines such as Integrate and Solve,
it is certainly possible to do a very good job at this.


David Park
djmpark at comcast.net
http://home.comcast.net/~djmpark/  



From: klkj fukyfl [mailto:kitas11 at yahoo.com] 


Hello, I need Matheamtica to do the following:

in:

a=1;
b=2;
c=3;
d=a+b*c

out: 

d=1+2*3
and so on...

previously I was using another system, but I found that this kind of stuff
is impossible

Can this be performed on Mathematica?





  • Prev by Date: Re: String Deletion
  • Next by Date: Re: Aligning Typeset Math on Equal Signs
  • Previous by thread: Re: output forms
  • Next by thread: Re: output forms