Re: About TableForm
- To: mathgroup at smc.vnet.net
- Subject: [mg74414] Re: About TableForm
- From: Bill Rowe <readnewsciv at sbcglobal.net>
- Date: Tue, 20 Mar 2007 05:54:15 -0500 (EST)
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