RE: About Table
- To: mathgroup at smc.vnet.net
- Subject: [mg74992] RE: [mg74954] About Table
- From: "David Annetts" <davidannetts at aapt.net.au>
- Date: Fri, 13 Apr 2007 02:13:11 -0400 (EDT)
- References: <200704120856.EAA25776@smc.vnet.net>
Hi,
> My questions are as follows:
> First I have a list is{3,6,9,4.4,6.7,5,3,6.2,3.7,5.2,6.3,9,10,12,13.2}
> Then I want to have tableform is as follows:
> 0 0 3
> 0 0.5 6
> 0 1 9
> 0 1.5 4.4
> 0 2 6.7
> 0.5 0 5
> 0.5 0.5 3
> 0.5 1 6.2
> 0.5 1.5 3.7
> 0.5 2 5.2
> 1 0 6.3
> 1 0.5 9
> 1 1 10
> 1 1.5 12
> 1 2 13.2
One approach uses Outer[]
Given
lst3 = {3, 6, 9, 4.4, 6.7, 5, 3, 6.2, 3.7, 5.2, 6.3, 9, 10, 12,
13.2};
lst2 = Range[0, 2, .5];
lst1 = Range[0, 1, .5];
We form
lst12 = Outer[List, lst1, lst2]
We can combine this new list with your original list using
lst123 = Transpose[{Flatten[lst12, 1], lst3}]
Finally, we need to Map[] Flatten[] at the proper level
lst123 = Map[Flatten, lst123, 1]
We display this using
TableForm[last123]
Regards,
Dave.
- References:
- About Table
- From: "Evanescence" <origine26@yahoo.com.tw>
- About Table