MathGroup Archive 2009

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

Search the Archive

Re: printing symbols at as a table

  • To: mathgroup at
  • Subject: [mg95254] Re: [mg95218] printing symbols at as a table
  • From: Murray Eisenberg <murray at>
  • Date: Mon, 12 Jan 2009 06:26:22 -0500 (EST)
  • Organization: Mathematics & Statistics, Univ. of Mass./Amherst
  • References: <>
  • Reply-to: murray at

Perhaps something like this to set up things:

   varNames = {"r", "g", "s", "somethingElse"};
   vars = ToExpression /@ varNames;

Next, calculate the values; here I just assign them:

   vars = {20, 2.34, m^2 + D, "Hello, world!"};

Finally, create your table. Here are two ways, the second with an 

   Transpose[{varNames, vars}] // TableForm
   Grid[Transpose[{varNames, vars}], Frame -> All]

If you prefer to start with the symbols for the variables instead of the 
names, then just reverse, essentially, the first two lines of code:

   Clear[r, g, s, somethingElse]
   vars = {r, g, s, somethingElse};
   varNames = ToString /@ vars;

Magician wrote:
> HiI have done a long calculation. But now I want to print some
> variables and their values. eg:
> r  20
> g  2.34
> s  m^2 + D
> and so on ....
> as a summary. The In /Out makes me crazy. I want to create a table of
> all values. with the symbol on the left ath value on the right. some
> are numeric ei i have assigned a r. Now i want to get the symbol
> 'r'. I hope i am not confusing here.

Murray Eisenberg                     murray at
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305

  • Prev by Date: Re: The use of Piecewise function
  • Next by Date: Re: Need to calculate daily risk free rate from Fed data
  • Previous by thread: Re: The use of Piecewise function
  • Next by thread: Re: printing symbols at as a table