MathGroup Archive 2001

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

Search the Archive

Re: Re: FindRoot question


On Wed, 18 Jul 2001, Chris Klausmeier wrote:

> ListOfNumbersQ[list_]:=Module[{n,ret},
> If[ListQ[list]==False,ret=False,
> n=Length[list];
> ret=True;
> Do[
> If[NumberQ[list[[i]]]==False,ret=False]
> ,{i,1,n}];];

Hi, I am sorry but I have to say, this version of ListOfNumbersQ is too
bad. It is totally not functional and rule-based programming, which is an
important feature of Mathematica. In fact, you can simply use:

  xopts:{___?NumberQ}

to replace the

  xopts_?ListOfNumbersQ

in your code.

If you really want to define such a function, it may be implemented as

  ListOfNumbersQ[list_List] := And @@ NumberQ /@ list

Good luck!

Mianlai Zhou
Theory Group, NIKHEF
Amsterdam, The Netherlands






  • Prev by Date: ListPlot3D; very small numbers
  • Next by Date: Re: Re: about ConstrainedMin (for correction)
  • Previous by thread: Re: FindRoot question
  • Next by thread: Re: Re: FindRoot question