MathGroup Archive 2004

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

Search the Archive

Re: Controlling function arguments


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