MathGroup Archive 2007

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

Search the Archive

Re: pattern

  • To: mathgroup at
  • Subject: [mg84379] Re: pattern
  • From: "Steve Luttrell" <steve at>
  • Date: Thu, 20 Dec 2007 00:17:48 -0500 (EST)
  • References: <> <fkanuj$dlh$>

This is an example:

f[x : {{_?NumericQ, _?NumericQ}, {_?NumericQ, _?NumericQ}}] := x

The pattern object {{_?NumericQ, _?NumericQ}, {_?NumericQ, _?NumericQ}} 
matches a numerical 2x2 matrix, and the x: preceding it is the name that I 
have assigned to this pattern object for use inside the function definition.

If you want to match other types of matrix element then change the tests as 

Stephen Luttrell
West Malvern, UK

<orelang at> wrote in message news:fkanuj$dlh$1 at
>I want to define a function that accepts only one argument - a 2x2
> matrix and not any more.
> Is it possible?
> orelang 

  • Prev by Date: Re: FileNameSetter button return state
  • Next by Date: Re: Trouble with double factorial and an infinite product
  • Previous by thread: Re: Re: pattern
  • Next by thread: Re: pattern