Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #5040

Re: output forms

From "David Park" <djmpark@comcast.net>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: output forms
Date 2011-09-18 08:10 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <j5491c$64q$1@smc.vnet.net> (permalink)
References <2973956.142355.1316252805735.JavaMail.root@m06>

Show all headers | View raw


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@comcast.net
http://home.comcast.net/~djmpark/  



From: klkj fukyfl [mailto:kitas11@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?

Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread


Thread

Re: output forms "David Park" <djmpark@comcast.net> - 2011-09-18 08:10 +0000

csiph-web