MathGroup Archive 1999

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

Search the Archive

Re: Where's the Speed?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg19962] Re: Where's the Speed?
  • From: Paul Abbott <paul at physics.uwa.edu.au>
  • Date: Thu, 23 Sep 1999 23:26:16 -0400
  • Organization: University of Western Australia
  • References: <7s1p4h$9n0@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Robert Knapp wrote:

> Timing[U2 = NestWhileList[Crank2, U[[1]], True &, 1, Nt - 1];]
>
> {1.69 Second, Null}
>
> There are two important features of the new code worth mentioning, both
> involving features new to version 4
>
> First, the use of NestWhileList.  If you have a loop which uses Append
> to accumulate a result,  Mathematica has to make an extra copy of the
> whole result each time through the loop. If you loop many times, this
> can have a big effect on your overall timing.

Surely NestWhileList is not needed here. You can just use NestList in
this example:

    U2 = NestList[Crank2, U[[1]], Nt - 1];

Also to Kevin, Crank-Nicholson should be Crank-Nicolson.  Numerical
Recipes amongst many others gets this wrong.

The reference is (in BibTeX format)

  @ARTICLE{crank-nicol,
    AUTHOR="Crank, J. and Nicolson, P.",
    YEAR="1947",
    TITLE="A Practical Method for Numerical Evaluation of "
    # "Solutions of Partial Differential Equations of the "
    # "Heat-Conduction Type",
    JOURNAL="Proceedings of the Cambridge Philosophical Society",
    VOLUME="43",
    PAGES="50-67"
    }

The misunderstanding over the spelling probably arose because in the
original journal the spelling on the contents page differs from that at
the top of the paper.

Cheers,
    Paul
____________________________________________________________________
Paul Abbott                                   Phone: +61-8-9380-2734
Department of Physics                           Fax: +61-8-9380-1014
The University of Western Australia
Nedlands WA  6907                     mailto:paul at physics.uwa.edu.au
AUSTRALIA                            http://physics.uwa.edu.au/~paul

            God IS a weakly left-handed dice player
____________________________________________________________________




  • Prev by Date: Re: Plotting questions
  • Next by Date: Out[1]=((5-Sqrt[5])/20 + (5+Sqrt[5])/20 ) == 1/2 ???
  • Previous by thread: Re: Where's the Speed?
  • Next by thread: Subject: Re: RE: Finding a relative prime