Services & Resources / Wolfram Forums / MathGroup Archive
-----

MathGroup Archive 2009

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

Search the Archive

subscripts in function definitions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg105028] subscripts in function definitions
  • From: Murat Tasan <mmuurr at gmail.com>
  • Date: Wed, 18 Nov 2009 06:59:33 -0500 (EST)

hi, folks - i'm not very savvy with Mathematica, so i apologize in
advance if this is a silly question, but:

i'd like to define a function, say f, that takes the symbol Subscript
[x,L]_.

it's hard to replicate what i'm typing here, without the ability to
subscript, but basically i want an x with a subscript of L as the
entire variable. something like xL (only with the L sub-scripted).

when i try to enter this as a pattern in the function definition by
adding the trailing underscore, it attaches only to the L (in the
subscript), not to the whole x_L variable (thus making the pattern
only match "L").  if i move out of the subscript box and try to add
the trailing underscore at the "x" level, it becomes detached from the
whole expression.  so i tried creating the pattern explicitly, as so:

f[Subscript[x,L]_] := myfun

but also in this case the trailing underscore becomes non-associated
with the Subscript expression.

is there any way i can make x with a subscript of L the entire pattern
for a variable?

(hopefully this made some sense... hard to make clear what i'm
searching for in plain text!)


  • Prev by Date: Re: Text on a curve, revisited and modified
  • Next by Date: Permanent Computation Efficiency
  • Previous by thread: Re: Define a function as a graphics directive?
  • Next by thread: Re: subscripts in function definitions