MathGroup Archive 2011

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

Search the Archive

Re: Recognize multiple outputs

  • To: mathgroup at smc.vnet.net
  • Subject: [mg118053] Re: Recognize multiple outputs
  • From: David Bailey <dave at removedbailey.co.uk>
  • Date: Sat, 9 Apr 2011 18:00:59 -0400 (EDT)
  • References: <inpesa$8t8$1@smc.vnet.net>

On 09/04/2011 12:11, mailcwc at 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.
>
>
Well you could define a function to do this, but it would be a bit clumsy:

In[627]:= SetAttributes[specialDisplay,HoldAll];
specialDisplay[a_=b_]:=SequenceForm[HoldForm[a],"=",a=b];

In[629]:= specialDisplay[a=10^2]

Out[629]= a=100

You could also achieve something neater using $Pre, but using $Pre can 
be awfully confusing, because it interferes with the normal operation of 
Mathematica.

However, I would strongly recommend that you think again about the way 
you work. Input cells containing multiple calculations, are probably 
best split into separate cells. You can do this very easily by putting 
the cursor at the right place, and selecting the menu item Call/Divide Cell.

Very large expressions are often the result of a number of previous 
steps, and it may be better to re-execute those steps to re-derive the 
large expressions unless this is too time consuming. It is horribly easy 
for a mistake to lurk in a large expression - particularly if it has 
been entered by hand!

Another general tip, is to keep a calculation symbolic as long as 
possible, so that it is easy to read and understand what is going on. 
Numbers can usually be injected at the last possible step.

David Bailey
http://www.dbaileyconsultancy.co.uk





  • Prev by Date: Re: Something that FullSimplify knows but Reduce does not ?
  • Next by Date: Re: Managing your notebooks
  • Previous by thread: Re: Recognize multiple outputs
  • Next by thread: Re: Recognize multiple outputs