Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2007
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2007

[Date Index] [Thread Index] [Author Index]

Search the Archive

Re: Tr[list] vs Plus@@list

  • To: mathgroup at smc.vnet.net
  • Subject: [mg73706] Re: [mg73718] Tr[list] vs Plus@@list
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Mon, 26 Feb 2007 06:07:49 -0500 (EST)
  • References: <200702250941.EAA08405@smc.vnet.net>

You can find the answer in my 2005 post:

http://forums.wolfram.com/mathgroup/archive/2005/May/msg00600.html

Andrzej Kozlowski


On 25 Feb 2007, at 10:41, dimitris wrote:

> Can somebody explain me the difference in timing performances
> between the settings Tr[list] and Plus@@list?
>
> Thanks a lot!
>
> In[1]:=
> lst[i_] := Table[Random[], {i}]
>
> In[2]:=
> {Timing[Tr[lst[10^4]]; ], Timing[Tr[lst[10^5]]; ],
> Timing[Tr[lst[10^6]]; ], Timing[Tr[lst[10^7]]; ]}
>
> Out[2]=
> {{0.*Second, Null}, {0.030999999999999972*Second, Null},
> {0.15600000000000003*Second, Null}, {2.0469999999999997*Second, Null}}
>
> In[3]:=
> {Timing[Plus @@ lst[10^4]; ], Timing[Plus @@ lst[10^5]; ], Timing[Plus
> @@ lst[10^6]; ], Timing[Plus @@ lst[10^7]; ]}
>
> Out[3]=
> {{0.*Second, Null}, {0.04700000000000015*Second, Null}, {0.484*Second,
> Null}, {4.922000000000001*Second, Null}}
>
>



  • Prev by Date: Pen, Tablet Input for Mathematica? (Some findings)
  • Next by Date: Re: Why Doesn't Mathematica Recognize System Dates?
  • Previous by thread: Tr[list] vs Plus@@list
  • Next by thread: Re: Tr[list] vs Plus@@list