% This script file runs ten rootfinding examples involving various
% functions, most of which are discussed in "Handbook of Mathematical
% Functions" by Milton Abramowitz and Irene Stegun.
% Howard Wilson, August, 2009
clear all, close all
clc
disp(' ')
disp('THIS SCRIPT FILE RUNS TEN EXAMPLE PROBLEMS. OUTPUT ')
disp('FROM THESE EXAMPLES APPEARS IN FILE examplesout.txt')
disp(' ')
disp('The program:'),disp(' ')
disp('[rts,frts,rtsm,frtsm,func]=interact(func,xlim,ylim)')
disp(' ')
disp('can be run using interactive prompts, or with data')
disp('passed through the call list. The script file now being')
disp('run uses the second mode. Whenever the program output is')
disp('not to be returned to the workspace, be sure to only')
disp('type interact followed by ;'), disp(' ')
%home
disp('EXAMPLE 1')
disp('A polynomial of degree 6 having obvious roots')
disp('interact(@(z) z.*(z.^3+1).*(z.^2-4i),[-2,2],[-2,2]);')
[r1,f1,r1m,f1m,fun1]=interact(@(z) z.*(z.^3+1).*(z.^2-4i),[-2,2],[-2,2]);
disp('EXAMPLE 2')
disp('A function periodic in the y direction')
disp('interact(@(z) sin(cosh(z)/2), [-3.5,3.5],[-3.5,3.5]);')
[r2,f2,r2m,f2m,fun2]=interact(@(z) sin(cosh(z)/2), [-3.5,3.5],[-3.5,3.5]);
disp('EXAMPLE 3: A function periodic in the directions of the lines')
disp(' y = x and y = -x')
disp('interact(@(z) cos(pi*z)-cosh(pi*z),[-4.5,4.5],[-4.5,4.5]);')
[r3,f3,r3m,f3m,fun3]=...
interact(@(z) cos(pi*z)-cosh(pi*z),[-4.5,4.5],[-4.5,4.5]);
disp('EXAMPLE 4: The error function of complex argument has')
disp(' an unusual distribution of zeros')
disp('interact(@(z) erfs(z), [0,4.5],[0,4.5]);')
[r4,f4,r4m,f4m,fun4]=interact(@(z) erfs(z), [0,4.5],[0,4.5]);
disp('EXAMPLE 5: The Fresnel sine integral has zeros symmetric')
disp(' about both the x and the y axes')
disp('interact(@(z) fresnels(z),[-3,3],[-3,3]);')
[r5,f5,r5m,f5m,fun5]=interact(@(z) fresnels(z),[-3,3],[-3,3]);
disp('EXAMPLE 6: Bessely(0,z) has real roots on the positive x axis')
disp(' and complex zeros near the negative x axis')
disp('interact(@(z) bessely(0,z),[-8,8],[-3,3]);')
[r6,f6,r6m,f6m,fun6]=interact(@(z) bessely(0,z),[-8,8],[-3,3]);
% A modified Bessel function which has zeros near the negative real
% axis, zeros on the oval described in HMF, and real zeros on the
% positive real axis.
disp('EXAMPLE 7: Bessely(5,z) has complex zeros near the negative')
disp(' x axis, along an oval around the origin, and real')
disp(' zeros on the positive x axis')
disp('interact(@(z) bessely(5,z),[-10,10],[-10,10]);')
[r7,f7,r7m,f7m,fun7]=interact(@(z) bessely(5,z),[-10,10],[-10,10]);
disp('EXAMPLE 8 : Besselh(3,1,z) has a branch cut along the negative')
disp(' x axis. It has zeros just below the negative x axis,')
disp(' and on an oval below the origin.')
disp('interact(@(z) besselh(3,1,z),[-10,10],[-3,3]);')
[r8,f8,r8m,f8m,fun8]=interact(@(z) besselh(3,1,z),[-10,10],[-3,3]);
disp('EXAMPLE 9 : Airy functions solve the differential equation')
disp(' u''(z) + z*u(z) = 0. The Airy function of the')
disp(' second kind has zeros on the negative x axis and')
disp(' complex zeros symmetric about the positive x axis')
disp('interact(@(z) airy(2,z),[-5,5],[-5,5]);')
[r9,f9,r9m,f9m,fun9]=interact(@(z) airy(2,z),[-5,5],[-5,5]);
disp('EXAMPLE 10: The Riemann zeta function has real zeros at negative')
disp(' even integers and complex zeros on the line x = 1/2')
[r10,f10,r10m,f10m,fun10]=interact(@(z) zetac(z),[-2,2],[-2,30]);
disp('interact(@(z) zetac(z),[-2,2],[-2,30]);')
disp('ALL DONE')
diary off