MathGroup Archive 2009

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

Search the Archive

Re: subscripts in function definitions

  • To: mathgroup at smc.vnet.net
  • Subject: [mg105046] Re: subscripts in function definitions
  • From: "Sjoerd C. de Vries" <sjoerd.c.devries at gmail.com>
  • Date: Thu, 19 Nov 2009 05:22:23 -0500 (EST)
  • References: <he0nki$48t$1@smc.vnet.net>

You can do this using the Notation package. The function you need is
Symbolize. Look it up in Notation/tutorial/
NotationSymbolizeAndInfixNotation. Please note the last paragraph
about the use of the colon (:) notation.

Cheers -- Sjoerd

On Nov 18, 2:00 pm, Murat Tasan <mmu... at gmail.com> wrote:
> 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: Sound Functions Crash Kernel
  • Next by Date: Re: How to instruct Math to take a certain (e.g. real)
  • Previous by thread: Re: subscripts in function definitions
  • Next by thread: Permanent Computation Efficiency