Re: Table command strange output when 'i' over 16
- To: mathgroup at smc.vnet.net
- Subject: [mg69824] Re: Table command strange output when 'i' over 16
- From: dimmechan at yahoo.com
- Date: Sat, 23 Sep 2006 23:45:34 -0400 (EDT)
- References: <ef2si4$me0$1@smc.vnet.net>
Hello. In the begining I considered it a weird bug. However, I took a look of it again. In general I am too sceptical about what is and what is not a bug. If you symbolically integrate something (especially if the integrand has branch cuts) there are still occasions that you see that Integrate does not give the correct result. (BTW, even and in these situations you have first the chance to "help" a little Integrate and second to use NIntegrate). But here? Why I say all these? Because I believe Mathematica is to make our "lives" easier but we should do the her "life" easier as well. When you use the command Table[0, {i, 1, 16}, {i, 1, 16}] something does not look good to me. Two different iterators with the same first element? Anyway I continue with the Inputs/Outputs (i.e. the easy thing...). I am too inexperienced user to deal more with theory or/and try to give a deeper explanation (i.e. the difficult thing...). Of course it cans happen to be just a weird bug and my comments to be completely out of place! Voila $Version "5.2 for Microsoft Windows (June 20, 2005)" Quit makeZeros[{n_, m_}] := Table[0, {i, 1, n}, {i, 1, m}] lst = Transpose[{Range[20], Range[20]}] {{1, 1}, {2, 2}, {3, 3}, {4, 4}, {5, 5}, {6, 6}, {7, 7}, {8, 8}, {9, 9}, {10, 10}, {11, 11}, {12, 12}, {13, 13}, {14, 14}, {15, 15}, {16, 16}, {17, 17}, {18, 18}, {19, 19}, {20, 20}} Cases[makeZeros /@ Take[lst, 15], x_ /; x != 0, Infinity] {} Length[Cases[makeZeros /@ Take[lst, {16, 20}], x_ /; x != 0, Infinity]] 855 Take[Sort[Cases[makeZeros /@ Take[lst, {16, 20}], x_ /; x != 0, Infinity]], -20] {909719091, 909719091, 909719091, 926365751, 926431024, 926496307, 926496307, 943141176, 943143222, 943206968, 943206968, 943207993, 959789366, 959853360, 959853360, 959853360, 959853360, 959853360, 959853360, 959853360} Take[Sort[Cases[makeZeros /@ Take[lst, {16, 20}], x_ /; x != 0, Infinity]], 20] {1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1, 1} Not the presence of very large as well small integers... However (and strangely for some of us,...but I keep my distances...) if you use i and j in iterators everything works fine (at least up to where I have verified...) Clear[makeZeros] makeZeros[{n_, m_}] := Table[0, {i, 1, n}, {j, 1, m}] lst = Transpose[{Range[300], Range[300]}]; Timing[Cases[makeZeros /@ lst, x_ /; x != 0, Infinity]] {8.438*Second, {}} Sincerely Dimitris ------------------------------------------- Rush "Freewill" You can choose a ready guide / In some celestial voice. If you choose not to decide / You still have made a choice You can choose from phantom fears / And kindness that can kill; I will choose a path that's clear / I will choose free will