

WKB():=(
Q:READ("ENTER Q(X) IN THE EQUATION E^2 Y'' = Q(X) Y"),
N:READ("ENTER DEGREE OF TRUNCATION FOR WKB METHOD"),
Y:%E^((1/E)*SUM(CONCAT("S",M)(X)*E^M,M,0,N)),
EQ:EXPAND(E^2*DIFF(Y,X,2)/Y=Q),
TEMP1:TAYLOR(EQ,E,0,N),
FOR I:0 THRU N DO EQN[I]:COEFF(TEMP1,E,I),
TEMPLIST:[],
FOR I:0 THRU N DO
  (EQUA[I]:EV(EQN[I],TEMPLIST,DIFF),
   TEMP2:SOLVE(EQUA[I],DIFF(CONCAT("S",I)(X),X)),
   TEMP3:PART(TEMP2,1),
   S[I]:INTEGRATE(TEMP3,X),
   TEMPLIST:MAKELIST(S[J],J,0,I)),
FOR I:0 THRU N DO
   PRINT(S[I]));
 
