MathGroup Archive 2004

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

Search the Archive

Re: Controlling function arguments

  • To: mathgroup at smc.vnet.net
  • Subject: [mg48818] Re: [mg48817] Controlling function arguments
  • From: Andrzej Kozlowski <akoz at mimuw.edu.pl>
  • Date: Fri, 18 Jun 2004 02:12:41 -0400 (EDT)
  • References: <200406170807.EAA27782@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

On 17 Jun 2004, at 17:07, Virgil Stokes wrote:

> I found the following Mathematica code:
>
>   NumberVectorQ[x_] := VectorQ[x] && And @@ NumberQ /@ x;
>   functionx[k_Integer?Positive, v_?NumberVectorQ, w_?NumberVectorQ,
> q_?NumberVectorQ] := .....
>
> where, I have left out the body of this function (functionx). What does
> the first line actually accomplish?
>
> --V. Stokes
>

The funny thing is that function defined in the first line NumerVectorQ 
is not needed since Mathematica's built in function VectorQ takes a 
second argument so that


VectorQ[{1,2,3},NumberQ]


True


NumberVectorQ[{1,2,3}]


True

In any case, the purpose of the function NumberVectorQ is to test that 
the argument ssupplied to the fucntion are vectors of number. Actually, 
it is probably better to use NumericQ rather than NumberQ since


NumberVectorQ[{1,2,Sin[2]}]


False


VectorQ[{1,2,Sin[2]},NumericQ]


True



Andrzej Kozlowski
Chiba, Japan
http://www.mimuw.edu.pl/~akoz/


  • Prev by Date: Re: Numerical integration inside numerical integration
  • Next by Date: Re: Question about Hold
  • Previous by thread: Re: Controlling function arguments
  • Next by thread: Re: Controlling function arguments