Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
1999
*January
*February
*March
*April
*May
*June
*July
*August
*September
*October
*November
*December
*Archive Index
*Ask about this page
*Print this page
*Give us feedback
*Sign up for the Wolfram Insider

MathGroup Archive 1999

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

Search the Archive

Re: function arguments as subscripts

  • To: mathgroup at smc.vnet.net
  • Subject: [mg19151] Re: function arguments as subscripts
  • From: Bruno Daniel <bruno.daniel at hadiko.de>
  • Date: Thu, 5 Aug 1999 23:58:52 -0400
  • Organization: University of Karlsruhe
  • References: <7obcis$3tc@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Hi Henrik

> In[16]:=
>    \!\(foo\_\(k_, l_\) = k l\)

The FullForm of this is:
Set[Subscript[foo,Pattern[k,Blank[]],Pattern[l,Blank[]]],kl]

(You can get this by wrapping the expression with
 FullForm[Hold[..]])

Now it's apparent that you should define an upvalue for foo rather
than a downvalue for Subscript. So in order to define it in a
package, just insert a ^ in front of  "=" or ":=" or  put   "foo /:" in front of
the definition:

\!\(foo\_\(k_, l_\) ^= kl\)
or
\!\(foo\  /: \ \ foo\_\(k_, l_\) = kl\)

You can then check the definition by issuing ??foo:

??foo

"Global`foo"             (* or whatever package you choose *)
Subscript[foo, k_, l_] ^= kl


You can then set the usage string of foo:
foo::usage = "xxx"

??foo

xxx
Subscript[foo, k_, l_] ^= kl


Yours sincerely
  Bruno


  • Prev by Date: Re: How can I do this?
  • Next by Date: Re: Can someone explain this?
  • Previous by thread: function arguments as subscripts
  • Next by thread: Can someone explain this?