Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.soft-sys.math.mathematica > #10914
| From | Richard Fateman <fateman@cs.berkeley.edu> |
|---|---|
| Newsgroups | comp.soft-sys.math.mathematica |
| Subject | Re: Algorithm Analysis Course: Should I use Mathematica for projects? //oops, typos |
| Date | 2012-07-14 05:31 +0000 |
| Message-ID | <jtr06t$bcq$1@smc.vnet.net> (permalink) |
| Organization | Time-Warner Telecom |
On 7/12/2012 11:57 PM, Richard Fateman wrote:
Sorry, some errors crept into my demo examples as I tried
to simplify them for inclusion in the email...
>
> An example.
>
> Create 3 arrays.
>
> A=Table[i,{i,0,100}];
> B=Table[i,{i,0,1000}];
> Q=Table[i,{i,0,10000}];
>
> Try updating the 50th element of each of these items, which look like
> arrays in Mathematica.
>
> Timing [A[[50]],{i,0,100000}]
Should be Timing[Do[A[[50]]++, {i, 0, 100000}]]. My computer reports
0.281 sec
>
> Timing [B[[50]],{i,0,100000}]
Should be B[[5]]=j; Timing[Do[B[[50]]++, {i, 0, 100000}]]. My computer
reports 1.266 sec
>
> Timing [Q[[50]],{i,0,100000}]
Should be Timing[Do[Q[[50]]++, {i, 0, 100000}]]. My computer reports
0.421 sec
>
Apologies for sowing confusion unnecessarily.
RJF
Back to comp.soft-sys.math.mathematica | Previous | Next | Find similar | Unroll thread
Re: Algorithm Analysis Course: Should I use Mathematica for projects? //oops, typos Richard Fateman <fateman@cs.berkeley.edu> - 2012-07-14 05:31 +0000
csiph-web