Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2005
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2005

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

Search the Archive

Re: expression formatting inside tables

  • To: mathgroup at smc.vnet.net
  • Subject: [mg54633] Re: [mg54591] expression formatting inside tables
  • From: Trevor Baca <trevorbaca at gmail.com>
  • Date: Thu, 24 Feb 2005 03:21:39 -0500 (EST)
  • References: <200502230812.DAA26710@smc.vnet.net> <76e8f81805022300585aa1025d@mail.gmail.com>
  • Reply-to: Trevor Baca <trevorbaca at gmail.com>
  • Sender: owner-wri-mathgroup at wolfram.com

hi yehuda,

mathematica 5.1 under os x.

there's nothing syntactically (or otherwise) wrong with

  Table[{HoldForm[foo[i]], foo[i]}, {i, 5}] // TableForm

but notice that it outputs

  foo[i]   1
  foo[i]   4
  foo[i]   9
  foo[i]   16
  foo[i]   25

which is not nearly as interesting as printing out foo[1], foo[2],
foo[3], ..., in the left-hand column.

anyway, treating "foo[" and "]" as strings in your second solution
(and dr bob's solution) works perfectly.

trevor.




On Wed, 23 Feb 2005 10:58:59 +0200, yehuda ben-shimol
<bsyehuda at gmail.com> wrote:
> I wonnder which Math. version you are using since
>   Table[{HoldForm[foo[i]], foo[i]}, {i, 5}] // TableForm
> is working perfectly (Math 5.1, Win XP).
> Anyway, if the problem is in the HoldForm use the following code that
> should work
> foo[x_] := x^2;
> foostr[x_] := "foo[" <> ToString[i] <> "]";
> TableForm[Table[{foostr[i], foo[i]}, {i, 5}]]
> yehuda
> 
> On Wed, 23 Feb 2005 03:12:53 -0500 (EST), Trevor Baca
> <trevorbaca at gmail.com> wrote:
> > hi mathgroup folks,
> >
> > let
> >
> >   foo[x_] := x^2
> >
> > then how to easily tableize the following?
> >
> >   foo[1]   1
> >   foo[2]   4
> >   foo[3]   9
> >   foo[4]   16
> >   foo[5]   25
> >
> > because neither
> >
> >   Table[{HoldForm[foo[i]], foo[i]}, {i, 5}] // TableForm
> >
> > nor
> >
> >   Table[{foo[HoldForm[i]], foo[i]}, {i, 5}] // TableForm
> >
> > did what i was expecting.
> >
> > trevor
> >
> >
>


  • Prev by Date: Re: Leading Zeros? (question rephrased)
  • Next by Date: Re: "teach" mathematica an integral
  • Previous by thread: Re: expression formatting inside tables
  • Next by thread: Re: expression formatting inside tables