MathGroup Archive 2005

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

Search the Archive

Re: expression formatting inside tables

  • To: mathgroup at smc.vnet.net
  • Subject: [mg54601] Re: [mg54591] expression formatting inside tables
  • From: DrBob <drbob at bigfoot.com>
  • Date: Thu, 24 Feb 2005 03:21:05 -0500 (EST)
  • References: <200502230812.DAA26710@smc.vnet.net>
  • Reply-to: drbob at bigfoot.com
  • Sender: owner-wri-mathgroup at wolfram.com

This does it:

Clear[foo]
foo[x_Integer] := x^2
TableForm[Table[
    {foo[ToString[i]], foo[i]},
    {i, 5}]]

Just make sure foo has no value for strings, and you're in.

Bobby

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



-- 
DrBob at bigfoot.com
www.eclecticdreams.net


  • Prev by Date: Re: expression formatting inside tables
  • Next by Date: Re: Why does Inverse[M] hesitate?
  • Previous by thread: expression formatting inside tables
  • Next by thread: Re: expression formatting inside tables