Pattern puzzle
- To: mathgroup at smc.vnet.net
- Subject: [mg104941] Pattern puzzle
- From: "Kurt TeKolste" <tekolste at fastmail.us>
- Date: Fri, 13 Nov 2009 06:31:02 -0500 (EST)
- References: <hcr7jn$8nl$1@smc.vnet.net> <200911121059.FAA18388@smc.vnet.net>
All 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 "formula". 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?? Thanks Kurt *** 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 *** Clear[actionQ] 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" Regards, Kurt Tekolste
- References:
- Re: Cylinder cylinder intersection: Design of a starter crank.
- From: dh <dh@metrohm.com>
- Re: Cylinder cylinder intersection: Design of a starter crank.