Re: Defining Formatting and Notation
- To: mathgroup at smc.vnet.net
- Subject: [mg119202] Re: Defining Formatting and Notation
- From: David Bailey <dave at removedbailey.co.uk>
- Date: Wed, 25 May 2011 05:54:34 -0400 (EDT)
- References: <iraq0r$lm0$1@smc.vnet.net>
On 22/05/2011 11:54, Stefan Salanski wrote: > Hello, > I've been working on compiling what I've learned about quantum > mechanics into a Mathematica notebook, and was wondering if anyone > could help with creating definitions for certain symbols. > An example of something which I have working is: > Subscript[\[Psi], n_\[InvisibleComma]l_\[InvisibleComma]m_][ > r_, \[Theta]_, \[Phi]_] := > Sqrt[(2/(n a))^3 (n - l - > 1)!/(2 n ((n + l)!)^3)] Exp[-r/(n a)] (2 r/(n a))^l LaguerreL[ > n - l - 1, 2 l + 1, 2 r/(n a)]*(n + l)! SphericalHarmonicY[l, > m, \[Theta], \[Phi]] > This looks just like one would write the hydrogen wavefunctions, and > evaluates as desired as well. > > What I am having difficulty with, is defining the Bra and Ket > notation, specifically defining the notation to be as when using them > as linear operators (http://en.wikipedia.org/wiki/Bra- > ket_notation#Linear_operators). > I would like to define what looks like this (after evaluation) : > "\!\(\*TemplateBox[{\"state1\"},\n\"Bra\"]\)observable\!\ > (\*TemplateBox[{\"state2\"},\n\"Ket\"]\)" > to be some function of [state1,state2,observable], but I always run > into the problem where it simply recognizes > Bra[state1] observable Ket[state2] > as observable*Bra[state1]*Ket[state2], the product of 3 individual and > separate terms, which is definitely not what I'm looking for. > I've looked through tutorial/Operators and tutorial/SpecialCharacters- > MathematicalAndOtherNotation, to no avail. Any suggestions? > -Stefan S > At 8.0.1, Bra[1] and Ket[1] do display in the normal quantum mechanical notation, without actually evaluating. This is, of course, exactly what you need, because you provide the definition as required. However, although there is also a System` symbol called BraKet, I can't find a way to use it to expressions like: <a|b> or <a|H|b> David Bailey http://www.dbaileyconsultancy.co.uk