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


Groups > comp.soft-sys.math.mathematica > #5042 > unrolled thread

Re: output forms

Started byBill Rowe <readnews@sbcglobal.net>
First post2011-09-18 08:15 +0000
Last post2011-09-18 08:15 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: output forms Bill Rowe <readnews@sbcglobal.net> - 2011-09-18 08:15 +0000

#5042 — Re: output forms

FromBill Rowe <readnews@sbcglobal.net>
Date2011-09-18 08:15 +0000
SubjectRe: output forms
Message-ID<j549av$6an$1@smc.vnet.net>
On 9/17/11 at 6:26 AM, kitas11@yahoo.com (klkj fukyfl) wrote:

>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?

Yes, but not easily or conveniently. Mathematic by default
evaluates expressions immediately when using Set (=). So, by
default, a+b*c will evaluate to 7 which will be assigned to d.
And the output will be 7. To get the output you are looking for
you could convert a,b,c to strings and do something like:

In[5]:= {a, b, c} = Range[3];
StringJoin@Riffle[{"d=", "+", "*"}, ToString /@ {a, b, c}]

Out[6]= d=1+2*3

There are certain to be other ways to do this within
Mathematica. But since you are trying to leave things partially
evaluated, you are working at cross purposes to the default way
Mathematica operates. Consequently, any method is going to look
something like a hack rather than natural input.

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web