Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1998
*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 1998

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

Search the Archive

Re: strange behaviour



At 4:42 AM -0500 1/26/98, Jean-Marie THOMAS wrote:
>MatrixQ has a strange behaviour:
>
>?MatrixQ
>"MatrixQ[expr] gives True if expr is a list of lists that can represent
>a \ matrix, and gives False otherwise. MatrixQ[expr, test] gives True
>only if \ test yields True when applied to each of the matrix elements
>in expr."
>
>MatrixQ[{{},{}}] gives True because its argument is a list of lists of
>equal length. No problem.
>
>Now:
>NumberQ[{}] gives False because {} is not a number. I can understand
>that.
>
>But:
>MatrixQ[{{},{}},NumberQ] gives True, and this seems to me in
>contradiction with the definition of MatrixQ[expr, test]
>
>Can somebody explain this to my stupid mind?
>
>-----------------------------------------------
>
>Jean-Marie THOMAS
>Conseil et Audit en Ingenierie de Calcul jmthomas@cybercable.tm.fr
>+33 (0)3 88 32 93 64
>www.cybercable.tm.fr/~jmthomas
>=======================
This is quite simple, I think. As there are no arguments to pass to your
test Mathematica just ignores it. Your test then just becaomes
MatrixQ[{{},{}}], which is True. You can do this with any test whatever, e.
g.
MatrixQ[{{},{}},#>3&]
gives True.




  • Prev by Date: Re: Is there a 3.01 student version?
  • Next by Date: [Q] How to compute in the background?
  • Prev by thread: strange behaviour
  • Next by thread: Re: strange behaviour