This uses the methods from phy1520/ps8/harmonicOscillatorRaiseAndLoweringOperators.nb
Evaluate the first part of that notebook prior to this one.

This is a test of the calculations of pg 320 myself to three orders of energy shift (the text does two orders).  I wanted to make sure the procedure that I outlined for myself in my ‘useful formulas section’ was correct.

Verify (1/2) m (ω^2)(x^2) ϵ pertubation from the text.

ClearAll[delta1]
reducex0 = {x0 -> Sqrt[hbar/m/omega] } ;
vOp = normalize[# // xOp // xOp, m omega^2/2] & ;
delta1 = innerProd[ketZero, ketZero // vOp] /. reducex0 ;
delta1 /. display

n1 = {{-Sqrt[2]/8, 2}} ;
n1 // formatKetList


vOpn1 = n1// vOp ;
vOpn1// formatKetList

delta2 = innerProd[ ketZero,vOpn1 ] /. reducex0 ;
delta2 /. display
minusDeltaN1 = normalize[ n1, -delta1 ] ;
minusDeltaN1 // formatKetList
vOpMinusDeltaN1 = Flatten[{vOpn1, minusDeltaN1}, 1] // normalize ;
vOpMinusDeltaN1 // formatKetList
vOpMinusDeltaN1

(* manually produced from vOpMinusDeltaN1 by removing |0> term and scaling each ket v|k> -> v|k>/k> *)
n2= normalize[{{-(1/8) (Sqrt[(3/2)]) m (omega^2) (x0^2)/4,4},{(((hbar omega)/(16 (Sqrt[2])))-((5 m (omega^2) (x0^2))/(16 (Sqrt[2]))))/2,2}},-1/(hbar omega)] /.  reducex0  ;
n2 // formatKetList
vOpN2 = n2 // vOp ;
vOpN2 // formatKetList
innerProd[ ketZero, vOpN2 ] /.  reducex0 /. display

Series[(Sqrt[1+x]),{x, 0, 5}]