Services & Resources / Wolfram Forums
MathGroup Archive
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

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

Search the Archive

Re: Where's the Speed?

  • To: mathgroup at
  • Subject: [mg19962] Re: Where's the Speed?
  • From: Paul Abbott <paul at>
  • Date: Thu, 23 Sep 1999 23:26:16 -0400
  • Organization: University of Western Australia
  • References: <7s1p4h$>
  • Sender: owner-wri-mathgroup at

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)

    AUTHOR="Crank, J. and Nicolson, P.",
    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",

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.

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

            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