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


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

Re: Recognize multiple outputs

From ADL <alberto.dilullo@tiscali.it>
Newsgroups comp.soft-sys.math.mathematica
Subject Re: Recognize multiple outputs
Date 2011-04-11 11:05 +0000
Organization Steven M. Christensen and Associates, Inc and MathTensor, Inc.
Message-ID <inunam$2bi$1@smc.vnet.net> (permalink)
References <inpesa$8t8$1@smc.vnet.net> <inqkvf$e95$1@smc.vnet.net>

Show all headers | View raw


On 10 Apr, 00:01, Helen Read <read...@gmail.com> wrote:
> On 4/9/2011 7:11 AM, mail...@gmail.com wrote:
>
> > Is it possible to show the name of the variables in the output cell?
> > For example, currently I have
> > [In1] a=10^2
> > [Out1] 100
>
> > I want it to be
> > [Out1] a=100
>
> > The reason for this is when we have multiple lines of calculation in
> > an input cell,
> > sometimes it is hard to recognize which number is which,
> > especially when the input cell has several pages and the calculations
> > are scattered in the cell.
>
> Use Row to mix strings with expressions.
>
> a = 10^2;
> Print[Row[{"a = ", a}]];
> g[x_] := x^3;
> Print[Row[{"g(x) = ", g[x]}]];
> Print[Row[{"g'(x) = ", g'[x]}]];
> Print[Row[{"g'(a) = ", g'[a]}]];
>
> --
> Helen Read
> University of Vermont


Another possibility is this:

ClearAll[xPrint];
Attributes[xPrint]={HoldAll,Listable};
xPrint[x_]:=(Print[HoldForm[x]," =",Tab,x]; x);
xPrint[x__]:=sPrint/@Unevaluated[x];

(* a ha no value *)
xPrint[a];
a =	a

a=100

xPrint[a];
a =	100


ADL

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


Thread

Recognize multiple outputs "mailcwc@gmail.com" <mailcwc@gmail.com> - 2011-04-09 11:11 +0000
  Re: Recognize multiple outputs David Bailey <dave@removedbailey.co.uk> - 2011-04-09 22:01 +0000
    Re: Recognize multiple outputs "mailcwc@gmail.com" <mailcwc@gmail.com> - 2011-04-11 11:06 +0000
      Re: Recognize multiple outputs David Bailey <dave@removedbailey.co.uk> - 2011-04-12 09:54 +0000
  Re: Recognize multiple outputs Helen Read <readhpr@gmail.com> - 2011-04-09 22:01 +0000
    Re: Recognize multiple outputs ADL <alberto.dilullo@tiscali.it> - 2011-04-11 11:05 +0000

csiph-web