I'm trying to create a numerical root finder in C, to find the zeros of Bessel Functions. Mathematical functions, F(x), can be deflated, by dividing the function by (x-x0), where x0 is a known root. The resulting function G(x) = F(x)/(x-x0), has all roots that F(x) had except at x0. This is useful as it prevents the same root being found twice by the solver.
When I find a root using my solver it is written to the array Roots[]
.
The Bessel Function is defined in math.h
as double j0(double x)
.
I want to iteratively modify double j0(double x)
so that I can have:
double my_j0(double x) = j0(x)/(x-Roots[n]);
I can then call this new, deflated function in my solver.
The above syntax doesn't make sense, but I don't know how to represent it.
I attempted to use a function pointer and defined
double (*my_j0)(double);
my_j0 = &j0;
But now I don't know how to iteratively modify the function, each time dividing by the root I found with my solving algorithm.
Thanks for the help!