MathGroup Archive 2007

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

Search the Archive

Re: Plot, Epilog, and Text

  • To: mathgroup at smc.vnet.net
  • Subject: [mg80859] Re: Plot, Epilog, and Text
  • From: Szabolcs <szhorvat at gmail.com>
  • Date: Tue, 4 Sep 2007 03:48:53 -0400 (EDT)
  • Organization: University of Bergen
  • References: <200709020652.CAA25864@smc.twtelecom.net> <fbgn89$9qe$1@smc.vnet.net>

bsyehuda at gmail.com wrote:
> 3. define g as g[X_String,w_?NumberQ,f_]:=...

I have seen people use NumberQ before in situations like this, so I 
would like to point out that the more reliable solution is to use 
NumericQ.  For example, NumberQ[Sqrt[2]] is False, NumberQ[Pi] is False, 
etc.

The necessity to use _?NumericQ usually comes up when passing a function 
to NIntegrate (or other similar function).  NIntegrate evaluates its 
argument with plain numbers, so using NumberQ will not lead to problems, 
but the function provided by the OP seems more likely to be evaluated 
(by the user) with numeric quantities that are not "Number"s.

Szabolcs


  • Prev by Date: using units and plotting
  • Next by Date: reducing the size of a Manipulate slider control, problem when using ImageSize
  • Previous by thread: Re: Plot, Epilog, and Text
  • Next by thread: Re: Plot, Epilog, and Text