Re: Subscripted variables and FindRoot?

• To: mathgroup at smc.vnet.net
• Subject: [mg26719] Re: Subscripted variables and FindRoot?
• From: Brian Higgins <bghiggins at ucdavis.edu>
• Date: Thu, 18 Jan 2001 00:57:21 -0500 (EST)
• References: <943eq7\$cpr@smc.vnet.net>
• Sender: owner-wri-mathgroup at wolfram.com

```Mike,
A pattern variable in the definition of a function must be a
Mathematica Symbol. A subscripted variable is a composite box
structure, and so cannot be used as a pattern variable.
Using your notation, the subscripted varible Xx is stored as
Subscript{X,x], and not as asymbol. However, if you load the
Notation package

<<Utilities`Notation`

Then you can use the Symbolize function to turn the Subscript[X,x]
into a Symbol. Thus

Symbolize[Xx]

You can now  use Xx as a pattern variable, but be sure to place a
colon after the symbolize variable in the pattern definition. i.e

myFunc[Xx:_]:=Sin[Xx]

Use the palette to enter Symbolize.

Regards,

Brian

You can use the Notation packageIn article
<943eq7\$cpr at smc.vnet.net>,
Mike Yukish <may106 at psu.edu> wrote:
> Hello,
>
> I love using subscripted variables for readability, but they seem
to
> have their limitations. FindRoot[ ] seems to burp when presented
with a
> function that takes a subscripted variable as input. Also, and
probably
> related, how do you declare a subscripted variable as a pattern
for a
> function? Patterns and subscripts seem to clash.
>
> This is no problem...
>
> foo[x_]:= x^2
>
> This is a problem (read Xy as x-subscripted-y)
>
> foo[Xy_] := Xy^2
>
> Where it does not recognize compute z^2 when presented with
>
> foo[z]
>
> Any hints on how to work with them?
>
>

Sent via Deja.com
http://www.deja.com/

```

• Prev by Date: Re: Switching Output Format Type for a single cell
• Next by Date: Re: 3D-Plots: Coloring edges (simple)
• Previous by thread: Subscripted variables and FindRoot?
• Next by thread: Multiple choice question