Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #12200 > unrolled thread

Re: Subscript in parameter names

Started byBill Rowe <readnews@sbcglobal.net>
First post2012-10-28 06:00 +0000
Last post2012-10-28 06:00 +0000
Articles 1 — 1 participant

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Re: Subscript in parameter names Bill Rowe <readnews@sbcglobal.net> - 2012-10-28 06:00 +0000

#12200 — Re: Subscript in parameter names

FromBill Rowe <readnews@sbcglobal.net>
Date2012-10-28 06:00 +0000
SubjectRe: Subscript in parameter names
Message-ID<k6ihmc$cjk$1@smc.vnet.net>
On 10/26/12 at 11:47 PM, per@RQNNE.invalid (Per R=C3=B8nne) wrote:

>You define functions in Mathematica like this:

>c[a_, b_]:= ^2a^6+b^6

>Giving Sqrt[a^2+b^2]

>But how will you define a function with a parameter with a
>subscript, like

>L[L^_0^ _,v]:=L^_0*^21-^/v^6 c^6

>Giving L[L0,v]:= L0*Sqrt[1-v^2/c^2]

>Except that L0 should be with a real subscript.

>In this example, c is 299,792,458 m/s, L0 the proper length in the
>velocity direction of an object with speed v relative to the
>observed lenght L from an intertial system with speed 0.

It is possible to use subscripted variables in Mathematica. To
do so, load the Notation package and make use of the function
Symbolize, But subscripts simply are not allowed in parameter
names. To partially get the result you seem to want, you can do:

In[1]:= << Notation`

In[1]:= Symbolize[Subscript[L, 0]];
L[x_, v_] := x*Sqrt[1 - v^2/c^2]

In[3]:= L[Subscript[L, 0], v]

Out[3]= Subscript[L, 0]*Sqrt[1 - v^2/c^2]

Note, Symbolize was entered using the palette that appears when
the Notation package is loaded and I've converted cells to input
form for email purposes. Frankly, I do not see using subscripted
variables as worth the required effort in Mathematica.

[toc] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web