10
1
mirror of https://gitlab.com/scemama/QCaml.git synced 2024-11-07 14:43:41 +01:00
QCaml/Utils/Spin.ml

48 lines
693 B
OCaml
Raw Normal View History

2019-02-18 12:41:54 +01:00
(** Electron spin *)
2019-02-22 19:19:11 +01:00
type t = (* m_s *)
| Alfa (* {% $m_s = +1/2$ %} *)
| Beta (* {% $m_s = -1/2$ %} *)
2019-02-18 12:41:54 +01:00
2019-02-22 19:19:11 +01:00
let other = function
| Alfa -> Beta
| Beta -> Alfa
2019-02-18 12:41:54 +01:00
2019-02-22 19:19:11 +01:00
(*
let half = 1. /. 2.
2019-02-18 12:41:54 +01:00
2019-02-22 19:19:11 +01:00
(** {% $\alpha(m_s)$ %} *)
let alfa = function
| n, Alfa -> n
| _, Beta -> 0.
(** {% $\beta(m_s)$ %} *)
let beta = function
| _, Alfa -> 0.
| n, Beta -> n
(** {% $S_z(m_s)$ %} *)
let s_z = function
| n, Alfa -> half *. n, Alfa
| n, Beta -> -. half *. n, Beta
let s_plus = function
| n, Beta -> n , Alfa
| _, Alfa -> 0., Alfa
let s_minus = function
| n, Alfa -> n , Beta
| _, Beta -> 0., Beta
let ( ++ ) (n, t) (m,t) =
(m. +n.)
let s2 s =
s_minus @@ s_plus s +.
s_z s +.
s_z @@ s_z s
*)