MathGroup Archive 2003

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

Search the Archive

RE: Don't want similar symbols to match pattern

  • To: mathgroup at smc.vnet.net
  • Subject: [mg43152] RE: [mg43111] Don't want similar symbols to match pattern
  • From: "Joe Sloan" <joe.sloan at ul.ie>
  • Date: Thu, 14 Aug 2003 07:06:37 -0400 (EDT)
  • Reply-to: <joe.sloan at ul.ie>
  • Sender: owner-wri-mathgroup at wolfram.com

Thanks again David, works fine and notebook a lot easier to read with the
simpler symbols.

Joe

-----Original Message-----
From: David Park [mailto:djmp at earthlink.net]
To: mathgroup at smc.vnet.net
Subject: [mg43152] RE: [mg43111] Don't want similar symbols to match pattern


Joe,

You could use the Notation package. But I always find that extremely
difficult to use. However, Ted Ersek has written a package,
SubscriptSymbols, that can be downloaded from MathSource. It allows you to
treat subscripted symbols as variables. It handles all the messy Notation
package work for you. The package should be put in
AddOns\ExtraPackages\Utilities. Then...

Needs["Utilities`SubscriptSymbols`"]

SubscriptSymbols[x, On]

\!\(f[x_] = x - x\_1\)

f[2]
\!\(2 - x\_1\)

or

\!\(Clear[f]\[IndentingNewLine]
  f[x_, \(x\_1\) : _] := x - x\_1\)

f[2, 3]
-1

I had to use the built-up box form here. In InputForm the second definition
actually looks like

f[x_, x\[UnderBracket]Subscript\[UnderBracket]1_] := x -
x\[UnderBracket]Subscript\[UnderBracket]1

but you usually won't see that.

David Park
djmp at earthlink.net
http://home.earthlink.net/~djmp/

From: Joe Sloan [mailto:jsloan at ieee.org]
To: mathgroup at smc.vnet.net

Hi,

I have two symbols, x and x with a subscript.

Is there any way I can define the function f[x_] (a function of x and
subscripted x) but not pattern match on the subscripted x? Example
below.

(Renaming my variables would probably be a painful experience, as I
intend to use the output in a document requiring the subscripted
versions.)

thanks

Joe

e.g.

Cell[BoxData[
    RowBox[{
      RowBox[{"f", "[", "x_", "]"}], "=",
      RowBox[{"x", "-",
        SubscriptBox["x", "1"]}]}]], "Input"]




  • Prev by Date: Re: Nonlinear fit for a non-differentiable function
  • Next by Date: Re: von Neumann entropy
  • Previous by thread: Don't want similar symbols to match pattern
  • Next by thread: von Neumann entropy