% randvs, bandmatrismetoden, y"+ay'sqrt(x)=(6-y)x;  y(0)=1; y(4)=-1
% med parametern a i intervallet -3 till 5
  clear, clf
  xslut=4; y0=1; yslut=-1;
  disp('     a       ntot        ymin      ymax ')
  for a=-3:5        
    ntot=20;
    for nr=1:3
      h=xslut/ntot; 
      n=ntot-1; x=h*(1:n)'; 
      dia=-(2-h^2*x);  
      sup=1+h*a/2*sqrt(x(1:n-1));
      sub=1-h*a/2*sqrt(x(2:n));  
      b=6*h^2*x;  
      b(1)=b(1)-(1-h*a/2*sqrt(x(1)))*y0;  
      b(n)=b(n)-(1+h*a/2*sqrt(x(n)))*yslut;  
      y=tridia(dia,sup,sub,b); 
      X=[0;  x; xslut];
      Y=[y0; y; yslut];  
      subplot(3,3,a+4), plot(X,Y)
      title(['a=' num2str(a)]), hold on 
      disp([a  ntot  min(y)  max(y)])
      ntot=2*ntot;
    end, drawnow
  end
