Group Abstract Group Abstract

Message Boards Message Boards

0
|
9.7K Views
|
2 Replies
|
2 Total Likes
View groups...
Share
Share this post:

Define a function with subscript expression?

Posted 6 years ago

Hello, Tried this code but it dosent work.

f[p0_, p1_] := 
  Module[{Subscript[p, 0] = p0, Subscript[p, 1] = p1}, 
   1/(2 bb n (Subscript[p, 0] + (-1 + n) Subscript[p, 1])) 
\!\(\*SubsuperscriptBox[\(p\), \(0\), \(-n\)]\) (-2 (-100 + d2) 
\!\(\*SubsuperscriptBox[\(p\), \(0\), \(2\)]\) + 
      2 bb (d2 + 100 (-1 + n)) 
\!\(\*SubsuperscriptBox[\(p\), \(0\), \(2 + n\)]\) - bb (-1 + n) n 
\!\(\*SubsuperscriptBox[\(p\), \(0\), \(n\)]\) Subscript[p, 
       1] (200 + (-100 + 2 d1 - d2) Subscript[p, 1]) + 2 bb n 
\!\(\*SubsuperscriptBox[\(p\), \(0\), \(1 + 
         n\)]\) (-100 + (-d1 + d2 + 100 (-1 + n)) Subscript[p, 1]))];
POSTED BY: Alex Graham
2 Replies

Using built-in Notation package you can work directly with subscripted variables everywhere, including as arguments to functions.

POSTED BY: Paul Abbott
POSTED BY: Hans Dolhaine
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
Attachments
Remove
or Discard