MathGroup Archive 2011

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

Search the Archive

Re: output forms

  • To: mathgroup at
  • Subject: [mg121512] Re: output forms
  • From: Bill Rowe <readnews at>
  • Date: Sun, 18 Sep 2011 04:10:33 -0400 (EDT)
  • Delivered-to:

On 9/17/11 at 6:26 AM, kitas11 at (klkj fukyfl) wrote:

>Hello, I need Matheamtica to do the following:

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

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

  • Prev by Date: Re: String Deletion
  • Next by Date: 2 parameter bifurcation diagrams
  • Previous by thread: Re: output forms
  • Next by thread: Re: output forms