|
[Date Index]
[Thread Index]
[Author Index]
Re: How to require integer subscripts to match a simple pattern
- To: mathgroup at smc.vnet.net
- Subject: [mg111544] Re: How to require integer subscripts to match a simple pattern
- From: Peter Pein <petsie at dordos.net>
- Date: Wed, 4 Aug 2010 07:39:48 -0400 (EDT)
- References: <i3bd4l$pg1$1@smc.vnet.net>
Am Wed, 4 Aug 2010 09:50:13 +0000 (UTC)
schrieb Tom D <tomdickens at att.net>:
> I am trying to create an indexed function that would be of the form
>
> M_(j,,j+1) [a,b] := func(j,a,b) ,
>
> where M has the two subscripts j and j+1, i. e. I need the 2nd
> subscript to match only when it is 1 more than the first.
>
> I know how to do this if I made the argument 'j' a normal argument,
> that is, not a subscript. (Use the /; operator.)
>
> How can I do this for the subscripts?
>
> (These are propagator matrices that either go one level up, or one
> down, so I'll have two M's, a (j, j+1) and a (j,,j-1) version.)
>
> Thanks,
>
> Tom
>
Hi Tom,
this works similar to the definition of a function:
In[7]:= Clear[M]
Subscript[M, j_, j_ + 1][a_, b_] := func[j, a, b]
In[9]:= Subscript[M, 5, 6][x, y]
Out[9]= func[j, x, y]
In[10]:= Subscript[M, 6, 5][p, q]
Out[10]= Subscript[M, 6, 5][p, q]
hth,
Peter
Prev by Date:
Re: Plotting a parametric equation
Next by Date:
Re: Silly question on Matrices
Previous by thread:
How to require integer subscripts to match a simple pattern
Next by thread:
Can't get Mathematica to evaluate correctly a difficult expression
|