Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

Re: printing symbols at as a table

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

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 
embellishment:

   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 math.umass.edu
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