Does anyone have the willingness and ability to write the function f(x,y,50000) in a way that is the fastest possible (or at least a speed improvement factor of (let's say to be conservative) 3 or better.
f(x,Energy,terms):=
block
([c,p,n,hbar,m,mu],
c[-4]:0,c[-3]:0,c[-2]:0,c[-1]:0,c[0]:1,c[1]:0,mu:1,
for n: 2 thru terms do (c[n]:(mu * c[n-6] - c[n-2] * Energy)/(n * (n - 1) * hbar^2/(2*m))),
p:c[0],
for n: 1 thru terms do (p:p + c[n]*x^n),
p
)$
f(10,Allowed_Energy_Level_10,50000);
FYI It is the solution to Shrodinger for mu*x^4 potential.
Thanks,
Rich