MathGroup Archive 2007

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

Search the Archive

Re: pattern


On 12/19/07 at 4:14 AM, orelang at gmail.com wrote:

>I want to define a function that accepts only one argument - a 2x2
>matrix and not any more.

>Is it possible?

Yes. For example

f[x_]:=Total[x]/;Dimensions[x]=={2,2}

will return a list of two elements if x is a 2 x 2 matrix and
will return f[x] unevaluated if x is not a 2 x 2 matrix.
--
To reply via email subtract one hundred and four


  • Prev by Date: Re: express a quadratic, in the form (x+a)^2 + b
  • Next by Date: Re: express a quadratic, in the form (x+a)^2 + b
  • Previous by thread: Re: pattern
  • Next by thread: Re: pattern