bisection.m#
This is a bisection method, specifically designed to determine when rays intersect a contour such that \(\omega|g(z)-g(\xi)|=C\), where \(g\) is the phase function, \(\omega\) is the frequency parameter and \(\xi\) is a stationary point.
The function to minimise is therefore
and we’re seeking \(f(r)=0\) for some \(r\in[a,b]\) (here \(a\) and \(b\) are not the original integration endpoints.)
This function will only be called when the main rootfinding algorithm (which uses a companion matrix approach) fails.
[r, numIterations] = bisection(f, a, b, tol)
Inputs#
fis the function \(f\) defined aboveaandbcorrespond to the search range \([a,b]\)tolis the parameter which determines when the bisection method will halt, specifically when \(|f(c)|<\)tol.
Outputs#
cis the zero of \(f\), as defined above.numIterationsis the number of iterations that the bisection method ran for.