Re: TableHeadings
- To: mathgroup at smc.vnet.net
- Subject: [mg15089] Re: [mg15046] TableHeadings
- From: BobHanlon at aol.com
- Date: Thu, 10 Dec 1998 03:13:18 -0500
- Sender: owner-wri-mathgroup at wolfram.com
In a message dated 12/9/98 7:41:28 AM, rmason at sparky2.esd.mun.ca writes: >I wish to tabulate the values returned by a function of two variables, >with the columns and rows labelled using the TableHeadings option to >TableForm. The code I am using is given below. > >s[n_,c_]:=If[n<c^2,"n < c^2",If[n>c, "n > c",(n-c^2)/(c-c^2)]] (* >function definition *) > >TableForm[Table[s[n,c], {c, 0.1, 1, 0.1}, {n, 0.1, 1, 0.1}], >TableHeadings->{{c},{n}}] > >This, of course just labels the first row and first column with c and n, >respecitvely. What I want is to have the appropriate numerical values >of c and n, as used in the function s[c_,n_], as labels. can it be done >using TableHeadings? I not, what is the best way to accomplish what I >want? > Roger, Try something like: TableForm[Table[s[n, c], {c, 0.1, 1, 0.1}, {n, 0.1, 1, 0.1}], TableHeadings->{ Join[{"c=0.1"}, Table[PaddedForm[c, {3, 1}], {c, 0.2, 1, 0.1}]], Join[{" n=0.1"}, Table[PaddedForm[n, {2, 1}], {n, 0.2, 1, 0.1}]]}] Bob Hanlon