% this is a script file to demonstrate functions
Exa = 1;  % choose the example to run

switch Exa
  case 1                 % built in functions
    r1 = cos(pi)
    r2 = acos(-1)
    r3 = cos(i)
    r4 = asin(-1.01)     % no real angle possible
    r5 = asin(-1.01+i*1e-15)
  case 2                 % tan() and tan2() for polar coordinates
    x1 = 3; y1 = 2;
    x2 = -x1; y2 = -y1;
    resultAtan  = [atan(y1/x1) ,atan(y2/x2)]
    resultAtan2 = [atan2(y1,x1),atan2(y2,x2)]
  case 3                 % exponential functions
    al = 0.2;
    [exp(i*al), cos(al), sin(al)]
  case 4                 % generate random numbers
    r = rand(1,5)        % uniform distribution
    N = 1000;
    x = 2 + 0.5*randn(N,1);  % normal distribution
    hist(x)
  case 5                 % special functions
    x = 0:0.01:14;
    plot(x, besselj(0,x),  x,-besselj(1,x))
   legend(BesselJ0' ,'derivative')
end%switch
