Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #4745 > unrolled thread

Re: Pascal's triangle spacing is off. Need DigitCount?

Started byMurray Eisenberg <murray@math.umass.edu>
First post2011-09-04 22:07 +0000
Last post2011-09-06 07:58 +0000
Articles 3 — 2 participants

Back to article view | Back to comp.soft-sys.math.mathematica

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  Re: Pascal's triangle spacing is off. Need DigitCount? Murray Eisenberg <murray@math.umass.edu> - 2011-09-04 22:07 +0000
    Re: Pascal's triangle spacing is off. Need DigitCount? Helen Read <readhpr@gmail.com> - 2011-09-05 11:06 +0000
    Re: Pascal's triangle spacing is off. Need DigitCount? Murray Eisenberg <murray@math.umass.edu> - 2011-09-06 07:58 +0000

#4745 — Re: Pascal's triangle spacing is off. Need DigitCount?

FromMurray Eisenberg <murray@math.umass.edu>
Date2011-09-04 22:07 +0000
SubjectRe: Pascal's triangle spacing is off. Need DigitCount?
Message-ID<j40srf$l1e$1@smc.vnet.net>
Why should Pascal's triangle be arranged so that it has symmetry around 
a vertical line, and with its vertex at the center horizontally?

Why not pad just to the right, so that each row starts flush left?

The latter seems in a way more "natural" (if I may dare to use that 
term), since each element of a row is then in its correct position 
(indexing from 0 instead of 1, of course).

On 9/4/11 4:12 AM, Heike Gramberg wrote:
> You could use Grid  in combination with ItemSize instead of Row to give
> all the entries the same width, e.g.
>
> pascalTrngl2[n_] :=
>   Module[{max, sp}, max = Max[Table[Binomial[n, j], {j, 0, n}]];
>    sp = Round[N[Log[10, max], 5]];
>    Column[Table[Grid[{Table[Binomial[i, j], {j, 0, i}]},
>       ItemSize ->  sp], {i, 0, n}], Center]]
>
> pascalTrngl2[10]
>
> Heike
>
> On 3 Sep 2011, at 14:04, Christopher O. Young wrote:
>
>> I'm trying to get the same spacing between the _center points_ of each of
>> the numbers in the Pascal triangle, so that each entry in a row is centered
>> properly underneath the corresponding two entries in the row above. Instead,
>> all the spacing options for Row[ ] seem to just apply to the spacings
>> between numbers.
>>
>> It looks like I would have to calculate the length (i.e., number of digits)
>> of each entry as I go through the table. Is DigitCount the best function to
>> use here? I.e., won't slow things down too much? Or is there a faster way?
>>
>> Thanks for any help.
>>
>> Chris Young
>> cy56@comcast.net
>>
>> pascalTrngl2[n_] :=
>> Module[
>>   {max, sp},
>>
>>   max = Max[Table[Binomial[n, j], {j, 0, n}]];
>>   sp = Round[N[Log[10, max], 5]];
>>
>>   Column[
>>    Table[
>>     Row[
>>      Table[Binomial[i, j], {j, 0, i}],
>>      Invisible[sp]
>>      ],
>>     {i, 0, n}
>>     ],
>>    Center
>>   ]
>> ]
>>
>>
>>
>
>

-- 
Murray Eisenberg                     murray@math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305

[toc] | [next] | [standalone]


#4752

FromHelen Read <readhpr@gmail.com>
Date2011-09-05 11:06 +0000
Message-ID<j42afe$rml$1@smc.vnet.net>
In reply to#4745
There's certainly a case for that, but it's pretty with the symmetry 
about a vertical line, with the 1's going down the sides, and the 
interior entries being the sum of the two neighbors in the row above.

HPR

On 9/4/2011 6:07 PM, Murray Eisenberg wrote:
> Why should Pascal's triangle be arranged so that it has symmetry around
> a vertical line, and with its vertex at the center horizontally?
>
> Why not pad just to the right, so that each row starts flush left?
>
> The latter seems in a way more "natural" (if I may dare to use that
> term), since each element of a row is then in its correct position
> (indexing from 0 instead of 1, of course).
>
> On 9/4/11 4:12 AM, Heike Gramberg wrote:
>> You could use Grid  in combination with ItemSize instead of Row to give
>> all the entries the same width, e.g.
>>
>> pascalTrngl2[n_] :=
>>    Module[{max, sp}, max = Max[Table[Binomial[n, j], {j, 0, n}]];
>>     sp = Round[N[Log[10, max], 5]];
>>     Column[Table[Grid[{Table[Binomial[i, j], {j, 0, i}]},
>>        ItemSize ->   sp], {i, 0, n}], Center]]
>>
>> pascalTrngl2[10]
>>
>> Heike
>>
>> On 3 Sep 2011, at 14:04, Christopher O. Young wrote:
>>
>>> I'm trying to get the same spacing between the _center points_ of each of
>>> the numbers in the Pascal triangle, so that each entry in a row is centered
>>> properly underneath the corresponding two entries in the row above. Instead,
>>> all the spacing options for Row[ ] seem to just apply to the spacings
>>> between numbers.
>>>
>>> It looks like I would have to calculate the length (i.e., number of digits)
>>> of each entry as I go through the table. Is DigitCount the best function to
>>> use here? I.e., won't slow things down too much? Or is there a faster way?
>>>
>>> Thanks for any help.
>>>
>>> Chris Young
>>> cy56@comcast.net
>>>
>>> pascalTrngl2[n_] :=
>>> Module[
>>>    {max, sp},
>>>
>>>    max = Max[Table[Binomial[n, j], {j, 0, n}]];
>>>    sp = Round[N[Log[10, max], 5]];
>>>
>>>    Column[
>>>     Table[
>>>      Row[
>>>       Table[Binomial[i, j], {j, 0, i}],
>>>       Invisible[sp]
>>>       ],
>>>      {i, 0, n}
>>>      ],
>>>     Center
>>>    ]
>>> ]
>>>
>>>
>>>
>>
>>
>


[toc] | [prev] | [next] | [standalone]


#4773

FromMurray Eisenberg <murray@math.umass.edu>
Date2011-09-06 07:58 +0000
Message-ID<j44jrh$90k$1@smc.vnet.net>
In reply to#4745
I don't see what's more pretty with the vertex-in-center version, just 
that it's more familiar.

For actual manipulation of Pascal's triangle by computer or in formulas, 
the flush-left rows seems better suited. See, for example, the page:

   http://www.jsoftware.com/jwiki/Essays/Pascal's%20Triangle

That is based upon the insight of Ken Iverson many years ago.

On 9/5/11 7:05 AM, Helen Read wrote:
> There's certainly a case for that, but it's pretty with the symmetry
> about a vertical line, with the 1's going down the sides, and the
> interior entries being the sum of the two neighbors in the row above.
>
> HPR
>
> On 9/4/2011 6:07 PM, Murray Eisenberg wrote:
>> Why should Pascal's triangle be arranged so that it has symmetry around
>> a vertical line, and with its vertex at the center horizontally?
>>
>> Why not pad just to the right, so that each row starts flush left?
>>
>> The latter seems in a way more "natural" (if I may dare to use that
>> term), since each element of a row is then in its correct position
>> (indexing from 0 instead of 1, of course).
>>
>> On 9/4/11 4:12 AM, Heike Gramberg wrote:
>>> You could use Grid  in combination with ItemSize instead of Row to give
>>> all the entries the same width, e.g.
>>>
>>> pascalTrngl2[n_] :=
>>>     Module[{max, sp}, max = Max[Table[Binomial[n, j], {j, 0, n}]];
>>>      sp = Round[N[Log[10, max], 5]];
>>>      Column[Table[Grid[{Table[Binomial[i, j], {j, 0, i}]},
>>>         ItemSize ->    sp], {i, 0, n}], Center]]
>>>
>>> pascalTrngl2[10]
>>>
>>> Heike
>>>
>>> On 3 Sep 2011, at 14:04, Christopher O. Young wrote:
>>>
>>>> I'm trying to get the same spacing between the _center points_ of each of
>>>> the numbers in the Pascal triangle, so that each entry in a row is centered
>>>> properly underneath the corresponding two entries in the row above. Instead,
>>>> all the spacing options for Row[ ] seem to just apply to the spacings
>>>> between numbers.
>>>>
>>>> It looks like I would have to calculate the length (i.e., number of digits)
>>>> of each entry as I go through the table. Is DigitCount the best function to
>>>> use here? I.e., won't slow things down too much? Or is there a faster way?
>>>>
>>>> Thanks for any help.
>>>>
>>>> Chris Young
>>>> cy56@comcast.net
>>>>
>>>> pascalTrngl2[n_] :=
>>>> Module[
>>>>     {max, sp},
>>>>
>>>>     max = Max[Table[Binomial[n, j], {j, 0, n}]];
>>>>     sp = Round[N[Log[10, max], 5]];
>>>>
>>>>     Column[
>>>>      Table[
>>>>       Row[
>>>>        Table[Binomial[i, j], {j, 0, i}],
>>>>        Invisible[sp]
>>>>        ],
>>>>       {i, 0, n}
>>>>       ],
>>>>      Center
>>>>     ]
>>>> ]
>>>>
>>>>
>>>>
>>>
>>>
>>
>
>
>

-- 
Murray Eisenberg                     murray@math.umass.edu
Mathematics & Statistics Dept.
Lederle Graduate Research Tower      phone 413 549-1020 (H)
University of Massachusetts                413 545-2859 (W)
710 North Pleasant Street            fax   413 545-1801
Amherst, MA 01003-9305

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web