MathGroup Archive 2007

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

Search the Archive

Re: About TableForm


On 3/19/07 at 5:51 AM, origine26 at yahoo.com.tw (Evanescence) wrote:

>Hello Dear all: My questions are as follows: First I definition a
>function is f[x_,y_]:=2x+3y Then I use the Table so:
>Table[f[x,y],{x,0,3,1},{y,0,4,2}] Then we can get the answers
>:{{0,6,12},{2,8,14},{4,10,16},{6,12,18}} But I want to get the form
>as follows:

>x   y   f[x,y]
>0   0     0
>...

Use Outer with TableForm. For example,

TableForm[Flatten[{#, f@@#}]&/@
    Join @@ Outer[List, Range[0, 3], Range[0, 4, 2]],
   TableHeadings -> {None, {"x", "y", "f[x,y]"}}]
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: Slots & Ampersands
  • Next by Date: Re: Help to use colors with graphics in Mathematica
  • Previous by thread: Re: About TableForm
  • Next by thread: Re: About TableForm