4

I'd like to use Subscript[ϕ, 1] as a function name:

Subscript[ϕ, 1][x_] = C1 + C2*x + C3*Exp[α*x] + C4*Exp[-α*x]

But as I use

?Subscript[ϕ, 1]

I get the error meassage

Information::ssym: Subscript[ϕ, 1] is not a symbol or a valid string pattern. >>

How can I define Subscript[ϕ, 1] as a symbol so that I get an output?

rm -rf
  • 88,781
  • 21
  • 293
  • 472
Daniel
  • 41
  • 2

2 Answers2

3

Best to use the Notations package and the function Symbolize which you will find discussed elsewhere on this site (and here).

enter image description here

Note that I am using screen grabs rather than cut and paste because cut and paste is rather screwy for symbolized subscripts.

Mike Honeychurch
  • 37,541
  • 3
  • 85
  • 158
0

Please read: Can we use letter with a subscript as a variable in Mathematica?

A few points:

1: You probably want to use SetDelayed rather than Set: Subscript[ϕ, 1][x_] := . . .

2: The definition is made but it is attached to Subscript:

Subscript[ϕ, 1][x_] := C1 + C2*x + C3*Exp[α*x] + C4*Exp[-α*x]

?? Subscript
Attributes[Subscript] = {NHoldRest}

Subscript[ϕ, 1][x_] := C1 + C2 x + C3 Exp[α x] + C4 Exp[-α x]

3: The definition works as expected:

Subscript[ϕ, 1][7]
C1 + 7 C2 + C4 E^(-7 α) + C3 E^(7 α)

4: If you were not also using a SubValues pattern you could use TagSet/TagSetDelayed to attach the definition to the Symbol ϕ:

ϕ /: Subscript[ϕ, 2] := "stuff"

? ϕ
ϕ /: Subscript[ϕ, 2] := stuff
Mr.Wizard
  • 271,378
  • 34
  • 587
  • 1,371