Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2001
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 2001

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

Search the Archive

Re: Re: FindRoot question

  • To: mathgroup at smc.vnet.net
  • Subject: [mg29933] Re: [mg29906] Re: FindRoot question
  • From: Mianlai Zhou <lailai at nikhef.nl>
  • Date: Thu, 19 Jul 2001 03:56:58 -0400 (EDT)
  • Sender: owner-wri-mathgroup at wolfram.com

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