Re: NestWhile
- To: mathgroup at smc.vnet.net
- Subject: [mg23109] Re: NestWhile
- From: Jens-Peer Kuska <kuska at informatik.uni-leipzig.de>
- Date: Wed, 19 Apr 2000 02:30:43 -0400 (EDT)
- Organization: Universitaet Leipzig
- References: <8d3r3l$oer@smc.vnet.net>
- Sender: owner-wri-mathgroup at wolfram.com
Hi, If[$VersionNumber < 4., NestWhile[fun_, expr_, test_, n_Integer, max_Integer] := Module[{iter = expr, i = 0}, While[test[iter] || i < n, iter = fun[iter]; If[i > max, Break[]]; i++ ]; iter ]; NestWhile[fun_, expr_, test_] := NestWhile[fun, expr, test, 0, $IterationLimit]; NestWhile[fun_, expr_, test_, n_Integer] := NestWhile[fun, expr, test, $IterationLimit] ] Hope that helps Jens > So the question is how can a Mathematica 3 version of NestWhile be > substituted into the above code? > > Alan Hopper > > awhopper at hermes.net.au