MathGroup Archive 2009

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

Search the Archive

Pattern puzzle

  • To: mathgroup at
  • Subject: [mg104941] Pattern puzzle
  • From: "Kurt TeKolste" <tekolste at>
  • Date: Fri, 13 Nov 2009 06:31:02 -0500 (EST)
  • References: <hcr7jn$8nl$> <>


I am trying to write a routine that checks an 'action' (i.e. a function
of coordinates X, metric gamma, mass, and optional extra coordinates) to
see that it is Poincare invariant.  I am having a problem getting my
routine to accept the action as the pattern that I think is appropriate.

The pattern that I would like to have accepted is the following:
   formula_[coordinate_[\[Tau]_, \[Sigma]___], 
 metric_[\[Tau]_, \[Sigma]___], mass_, coords___]

I would like for this pattern to be accepted when I use a "pretty" alias
(Subscript[S, PP]) for function defined in a package (pointAction) as

What I find is that I can get the results I expect using Subscript[S,
PP] except for the one variant that I want immediately (no extra
coordinates in the coords___ slot).  I do not get the results that I
want using either the print name, Subscript[S, PP], or the long name,
pointAction -- but if I substitue an undefined symbol for the function
name it works.

What am I missing??



*** details ***

(I tried this with and without Symbolize[Subscript[S, PP]])

Subscript[S, PP][a_, b_, c_] := pointAction[a, b, c]

pointAction is defined, but any definition will do, say

pointAction[a_,b_,c_] := 5

*** code ***
actionQ[formula_[coordinate_[\[Tau]_, \[Sigma]___], 
   metric_[\[Tau]_, \[Sigma]___]]] := "true without extra coordinates"
actionQ[formula_[coordinate_[\[Tau]_, \[Sigma]___], 
   metric_[\[Tau]_, \[Sigma]___], 
   mass_]] := "true with one extra coordinate"
actionQ[formula_[coordinate_[\[Tau]_, \[Sigma]___], 
   metric_[\[Tau]_, \[Sigma]___], 
   coords___]] := "true with extra coordinates"
actionQ[formula_[coordinate_[\[Tau]_, \[Sigma]___], 
   metric_[\[Tau]_, \[Sigma]___], mass_, 
   coords___]] := "true with extra coordinates and required mass"
actionQ[x_] := false

actionQ[Subscript[S, PP][X[\[Tau]], \[Gamma][\[Tau]]]]
actionQ[Subscript[S, PP][X[\[Tau]], \[Gamma][\[Tau]], m, k]]
actionQ[Subscript[S, PP][
  X[\[Tau], \[Sigma]], \[Gamma][\[Tau], \[Sigma]], m, k]]
actionQ[Subscript[S, PP][X[\[Tau]], \[Gamma][\[Tau]], m]]
actionQ[pointAction[X[\[Tau]], \[Gamma][\[Tau]], m]]
actionQ[f[X[\[Tau]], \[Gamma][\[Tau]], m]]
actionQ[f[X[\[Tau]], \[Gamma][\[Tau]], m, k]]

** my results **
I would like to have the two "false" cases work.

Out[333]= "true without extra coordinates"

Out[334]= "true with extra coordinates and required mass"

Out[335]= "true with extra coordinates and required mass"

Out[336]= false

Out[337]= false

Out[338]= "true with one extra coordinate"

Out[339]= "true with extra coordinates and required mass"
Kurt Tekolste

  • Prev by Date: Re: Re: Mathematica skill level snippet(s)
  • Next by Date: Re: Re: Cumulative probability that random walk variable
  • Previous by thread: Re: Cylinder cylinder intersection: Design of a starter crank.
  • Next by thread: easy way to represent polynomials (v 7.0)