Mathematica 9 is now available
Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2012

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

Search the Archive

Re: reverses order of terms producing the string: 1.2 x=

  • To: mathgroup at smc.vnet.net
  • Subject: [mg125953] Re: reverses order of terms producing the string: 1.2 x=
  • From: Bob Hanlon <hanlonr357 at gmail.com>
  • Date: Mon, 9 Apr 2012 05:34:18 -0400 (EDT)
  • Delivered-to: l-mathgroup@mail-archive0.wolfram.com

In many circumstances, Mathematica automatically puts expressions in
canonical order. In your example the argument to Text is put in
canonical order prior to Text causing display. Once you make the
argument a single string, order is no longer an issue.

x=1.2;

Ordering[{"x = ",x}]

{2,1}

Text["x = "x]

1.2 x =

Text["x = " <> ToString[x]]

x = 1.2

You can also use StringForm

StringForm["x = ``",x]

x = 1.2`


Bob Hanlon

On Sun, Apr 8, 2012 at 4:14 AM, Daniel <daniel.bentsur at gmail.com> wrote:
> I don't yet understand the subtleties of evaluation order, but this seems unintuitive.
>
> I've managed to get the representation I want with Text[StringJoin["x= ", ToString[x]]],
> but would prefer both to understand what's happening and reduce verbosity.
>
> thanks.
>



  • Prev by Date: Re: Varying a constant in an ODE to Manipulate solution set
  • Next by Date: Re: Varying a constant in an ODE to Manipulate solution
  • Previous by thread: Re: Plotting vectors on a linear function
  • Next by thread: Clear variable on Locator point change