Mathematica 9 is now available
Services & Resources / Wolfram Forums
-----
 /
MathGroup Archive
2006
*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 2006

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

Search the Archive

Re: Plus Behavior Inside a Notation Box?

  • To: mathgroup at smc.vnet.net
  • Subject: [mg64924] Re: Plus Behavior Inside a Notation Box?
  • From: "Josh" <josh at gocougs.wsu.edu>
  • Date: Wed, 8 Mar 2006 00:59:35 -0500 (EST)
  • References: <duh39s$5ui$1@smc.vnet.net><dujrvf$92e$1@smc.vnet.net>
  • Sender: owner-wri-mathgroup at wolfram.com

Paul,

Thanks, that was the insight I was looking for.  I did find that a
single underscore worked better than the double and triple underscore.
Not sure I understand why, the double or triple underscore should work
better.  For example, here's what I found...

ClearNotations[]
Notation[a + n_  <=>  Plus[b, c, n_]  ]
b + c + d
b + c + d + e

a + d
a + (d + e)


ClearNotations[]
Notation[a + n__  <=>  Plus[b, c, n__]  ]
b + c + d
b + c + d + e

a + d
a + d, e


ClearNotations[]
Notation[a + n__  <=>  Plus[b, c, n___]  ]
b + c + d
b + c + d + e

a + d
a + d,e

The motivation for this was to map the built in BesselJ[n,z] and
BesselK[n,z] functions to J_n[z] and Y_n[z].  This works quite nicely,
with the subscript properly denoting the order of the Bessel function
after differentiation and all the rules for simplification and such are
still implemented.  The subscripts tend to come out backwards, -1+n
instead of n-1, but I can live with that.

Notation[ J_n_ [z_] <=> BesselJ[n_, z_] ]
Notation[ Y_n_ [z_] <=> BesselY[n_, z_] ]

One alternative was to create the symbols J_n and Y_n, but I lose a lot
of the built-in functionality that way.  The other possibility was
creating a function J_n_[z_] := BesselJ[n,z], which preserves all the
built-in functions, but the output is in the BesselJ[n,z] format.

I started running into trouble when I tried implementing the Hankel
functions in a similiar manner.  My understanding is that there is no
built-in function for them yet, so I tried the following.

Notation[H_n_ ^(1) [z_] <=> Plus[ J_n[z_], Complex[0,1] Y_n[z_] ] ]
Notation[H_n_ ^(2) [z_] <=> Plus[ J_n[z_], Complex[0,-1] Y_n[z_] ] ]

Again, this was working reasonably well.  The symbols for H_n ^(1) and
H_n ^(2) rendered properly and I was getting good results.  Until I
tried adding another number in, prompting my first post.

I've made some progress on this, but there are considerably more cases
that need to be defined.  If you want I'll post what I have so far
(what's the best way of doing so?) for you to look at.

Thanks,

Josh


  • Prev by Date: Re: Listable functions with two brackets f[][] (SubValues)
  • Next by Date: Re: Listable functions with two brackets f[][] (SubValues)
  • Previous by thread: Re: Plus Behavior Inside a Notation Box?
  • Next by thread: Re: Plus Behavior Inside a Notation Box?