
#	This procedure obtains the "ghost" state which represents 
#	another solution to the homogeneous equation.
#
#	by T.C. Scott, G.J. Fee and M.B. Monagan (1988)

Ghost1:=proc(y1)
local dum;
	dum:=1/(y1*t)^2;
	dum:=expand(dum);
	dum:=fix(y1*IInt(dum,t));
dum:
end;
Ghost2:=proc(y1)
local start,s,n2,dum,Lnl2,res,Wron;
#
#  Construct lower solution n = l + 1
#
n2:=l+1;
if n=n2 then
	res:=Ghost1(y1)
else
	Lnl2:=0;
	for s from 0 to (n2-l-1) do
		dum:=((n2+l)!^2)/((n2-l-1-s)!*(2*l+1+s)!*(s!));
		Lnl2:=Lnl2 + ((-1)^s)*dum*t^s;
	od;
	start:=1/exp(t)^(1/2)*(t^l)*Lnl2;
	res:=Ghost1(start);
#
#  Ladder up
#
	for s from n2 to (n-1) do
		res:=( ((t/2) - s )*(t*res) - t*diff(t*res,t) )/t;
	od;
	res:=fix(res);
	Wron:=y1*diff(res,t) - res*diff(y1,t);
	Wron:=fix(Wron);
	Wron:=simplify(factor(Wron));
	if has(Wron*t^2,t) then
		lprint(`trouble`);	# Wronskian*t^2 should be constant
	fi;
	res:=1/(Wron*t^2)*res:
fi;
fix(res):
end;
