Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.soft-sys.math.mathematica > #2590 > unrolled thread

Defining Formatting and Notation

Started byStefan Salanski <wutchamacallit27@gmail.com>
First post2011-05-22 10:54 +0000
Last post2011-05-25 23:34 +0000
Articles 3 — 3 participants

Back to article view | Back to comp.soft-sys.math.mathematica


Contents

  Defining Formatting and Notation Stefan Salanski <wutchamacallit27@gmail.com> - 2011-05-22 10:54 +0000
    Re: Defining Formatting and Notation David Bailey <dave@removedbailey.co.uk> - 2011-05-25 09:55 +0000
      Re: Defining Formatting and Notation Peter Breitfeld <phbrf@t-online.de> - 2011-05-25 23:34 +0000

#2590 — Defining Formatting and Notation

FromStefan Salanski <wutchamacallit27@gmail.com>
Date2011-05-22 10:54 +0000
SubjectDefining Formatting and Notation
Message-ID<iraq0r$lm0$1@smc.vnet.net>
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

[toc] | [next] | [standalone]


#2689

FromDavid Bailey <dave@removedbailey.co.uk>
Date2011-05-25 09:55 +0000
Message-ID<irijmf$qc9$1@smc.vnet.net>
In reply to#2590
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

[toc] | [prev] | [next] | [standalone]


#2720

FromPeter Breitfeld <phbrf@t-online.de>
Date2011-05-25 23:34 +0000
Message-ID<irk3lv$7bi$1@smc.vnet.net>
In reply to#2689
<a|b> seems to be BraKet[{a},{b}]
but I too found no possibility to get <a|H|b> displayed.

//Peter

David Bailey wrote:

> 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
>
>

-- 
_________________________________________________________________
Peter Breitfeld, Bad Saulgau, Germany -- http://www.pBreitfeld.de

[toc] | [prev] | [standalone]


Back to top | Article view | comp.soft-sys.math.mathematica


csiph-web