% ekstraøving2-a:       90-percent radii for hydrogenlike atom
% find radius of psi_100 orbital (with 90 percent inside), using formula from exercise 6
fr = inline( '(2*r^2+2*r+1)*exp(-2*r)-0.1' ); % pratab p 94
x90_100 = fzero(fr,0.26);                     %   - " -
fprintf(' x90_100 = %3.5f\n',x90_100);
% test
F = inline('x.^2');
I = quad(F,0,1)
I;
% find radius of psi_600 orbital (with 90 percent inside), by varying the upper integration limit x. 
%The function psisq is the square of the orbital
psisq = inline('(6/324)*x.^2.*exp(-x./3).*(1-5*x./6+5.*x.^2/27-5*x.^3/(12*27)+x.^4/(24*81)-x.^5/(720*243)).^2');
%psisq = inline('(6/324)*x^2*exp(-x/3)*(1-5*x/6+5*x^2/27-5*x^3/(12*27)+x^4/(24*81)-x^5/(720*243))^2');
%psisq = inline('(6/324)*r^2*exp(-r/3)*(1-5*r/6+5*r^2/27-5*r^3/(12*27)+r^4/(24*81)-r^5/(720*243))^2');
b=73.64; 
I = quad(psisq,0,b);
fprintf(' probability inside x = %4.4f a   is %2.9f for psi_600 orbital\n',b,I);
