Skip to main content
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
Source Link

Yet another approach to locating zeros of oscillatory functions is to find extrema via MedianFilter, then to useFindRoot with two adjacent extrema as starting values. I used this method to find roots of RiemannSiegelZ[t] before I learned about Gram points of the zeta function, and before Mathematica V6 came out with ZetaZero[k].

It requires a grid of function values $v$, so the method only works if the function is cheap to calculate. The grid may be linearly spaced, log spaced, or intelligently spaced via Plot as in the current answer from acl and the earlier oneone from J. M.

Next, run MedianFilter[v,1]. The function has a maximum at a point where its value exceeds the median of the three values centred on that point. A minimum occurs where the function value is less than the median. On slopes, the median equals the current, central point. Pick locations where the function value and its median are unequal, these are the extrema.

Finally, pass two adjacent extrema to FindRoot:

Block[{r=Range[2.,550.,5.], v, p, t, b=1, n=1}, v = Transpose[{(v=Hypergeometric1F1[1/4(2-r/b),n+1,b]), MedianFilter[v,1]}]; p = Pick[r, Apply[Unequal, v, 1]]; Map[FindRoot[Hypergeometric1F1[1/4(2-t/b),n+1,b], Flatten[{t,#}]]&, Partition[p,2,1]] ] {{t -> 13.0143}, {t -> 47.552}, {t -> 101.833}, {t -> 175.854}, {t -> 269.615}, {t -> 383.115}, {t -> 516.355}} 

Yet another approach to locating zeros of oscillatory functions is to find extrema via MedianFilter, then to useFindRoot with two adjacent extrema as starting values. I used this method to find roots of RiemannSiegelZ[t] before I learned about Gram points of the zeta function, and before Mathematica V6 came out with ZetaZero[k].

It requires a grid of function values $v$, so the method only works if the function is cheap to calculate. The grid may be linearly spaced, log spaced, or intelligently spaced via Plot as in the current answer from acl and the earlier one from J. M.

Next, run MedianFilter[v,1]. The function has a maximum at a point where its value exceeds the median of the three values centred on that point. A minimum occurs where the function value is less than the median. On slopes, the median equals the current, central point. Pick locations where the function value and its median are unequal, these are the extrema.

Finally, pass two adjacent extrema to FindRoot:

Block[{r=Range[2.,550.,5.], v, p, t, b=1, n=1}, v = Transpose[{(v=Hypergeometric1F1[1/4(2-r/b),n+1,b]), MedianFilter[v,1]}]; p = Pick[r, Apply[Unequal, v, 1]]; Map[FindRoot[Hypergeometric1F1[1/4(2-t/b),n+1,b], Flatten[{t,#}]]&, Partition[p,2,1]] ] {{t -> 13.0143}, {t -> 47.552}, {t -> 101.833}, {t -> 175.854}, {t -> 269.615}, {t -> 383.115}, {t -> 516.355}} 

Yet another approach to locating zeros of oscillatory functions is to find extrema via MedianFilter, then to useFindRoot with two adjacent extrema as starting values. I used this method to find roots of RiemannSiegelZ[t] before I learned about Gram points of the zeta function, and before Mathematica V6 came out with ZetaZero[k].

It requires a grid of function values $v$, so the method only works if the function is cheap to calculate. The grid may be linearly spaced, log spaced, or intelligently spaced via Plot as in the current answer from acl and the earlier one from J. M.

Next, run MedianFilter[v,1]. The function has a maximum at a point where its value exceeds the median of the three values centred on that point. A minimum occurs where the function value is less than the median. On slopes, the median equals the current, central point. Pick locations where the function value and its median are unequal, these are the extrema.

Finally, pass two adjacent extrema to FindRoot:

Block[{r=Range[2.,550.,5.], v, p, t, b=1, n=1}, v = Transpose[{(v=Hypergeometric1F1[1/4(2-r/b),n+1,b]), MedianFilter[v,1]}]; p = Pick[r, Apply[Unequal, v, 1]]; Map[FindRoot[Hypergeometric1F1[1/4(2-t/b),n+1,b], Flatten[{t,#}]]&, Partition[p,2,1]] ] {{t -> 13.0143}, {t -> 47.552}, {t -> 101.833}, {t -> 175.854}, {t -> 269.615}, {t -> 383.115}, {t -> 516.355}} 
added 27 characters in body
Source Link

Yet another approach to locating zeros of oscillatory functions is to find extrema via  MedianFilter, then to useFindRoot with two adjacent extrema as starting values. I used this method to find roots of RiemannSiegelZ[t] before I learned about Gram points of the Zetazeta function, and before Mathematica V6 came out with  ZetaZero[k].

It requires a grid of function values $v$, so the method only works if the function is cheap to calculate. The grid may be linearly spaced, log spaced, or intelligently spaced via Plot as in the current answer from @aclacl and the earlier oneone from @JJ.M M.

Next, run  MedianFilter[v,1]. The function has a maximum at a point where its value exceeds the median of the three values centred on that point. A minimum occurs where the function value is less than the median. On slopes, the median equals the current, central point. Pick locations where the function value and its median are unequal, these are the extrema.

Finally, pass two adjacent extrema to FindRoot.FindRoot:

Block[{r=Range[2.,550.,5.], v, p, t, b=1, n=1},   v = Transpose[{(v=Hypergeometric1F1[1/4(2-r/b),n+1,b]), MedianFilter[v,1]}];   p = Pick[r, Apply[Unequal, v, 1]]; Map[FindRoot[Hypergeometric1F1[1/4(2-t/b),n+1,b], Flatten[{t,#}]]&, Partition[p,2,1]] ] {{t ->13> 13.0143}, {t ->47> 47.552}, {t ->101> 101.833}, {t ->175> 175.854},   {t ->269> 269.615}, {t ->383> 383.115}, {t ->516> 516.355}} 

Yet another approach to locating zeros of oscillatory functions is to find extrema viaMedianFilter, then to useFindRoot with two adjacent extrema as starting values. I used this method to find roots of RiemannSiegelZ[t] before I learned about Gram points of the Zeta function, and before Mathematica V6 came out withZetaZero[k].

It requires a grid of function values $v$, so the method only works if the function is cheap to calculate. The grid may be linearly spaced, log spaced, or intelligently spaced via Plot as in the current answer from @acl and the earlier one from @J.M.

Next, runMedianFilter[v,1]. The function has a maximum at a point where its value exceeds the median of the three values centred on that point. A minimum occurs where the function value is less than the median. On slopes, the median equals the current, central point. Pick locations where the function value and its median are unequal, these are the extrema.

Finally, pass two adjacent extrema to FindRoot.

Block[{r=Range[2.,550.,5.], v, p, t, b=1, n=1}, v = Transpose[{(v=Hypergeometric1F1[1/4(2-r/b),n+1,b]), MedianFilter[v,1]}]; p = Pick[r, Apply[Unequal, v, 1]]; Map[FindRoot[Hypergeometric1F1[1/4(2-t/b),n+1,b], Flatten[{t,#}]]&, Partition[p,2,1]] ] {{t->13.0143}, {t->47.552}, {t->101.833}, {t->175.854}, {t->269.615}, {t->383.115}, {t->516.355}} 

Yet another approach to locating zeros of oscillatory functions is to find extrema via  MedianFilter, then to useFindRoot with two adjacent extrema as starting values. I used this method to find roots of RiemannSiegelZ[t] before I learned about Gram points of the zeta function, and before Mathematica V6 came out with  ZetaZero[k].

It requires a grid of function values $v$, so the method only works if the function is cheap to calculate. The grid may be linearly spaced, log spaced, or intelligently spaced via Plot as in the current answer from acl and the earlier one from J. M.

Next, run  MedianFilter[v,1]. The function has a maximum at a point where its value exceeds the median of the three values centred on that point. A minimum occurs where the function value is less than the median. On slopes, the median equals the current, central point. Pick locations where the function value and its median are unequal, these are the extrema.

Finally, pass two adjacent extrema to FindRoot:

Block[{r=Range[2.,550.,5.], v, p, t, b=1, n=1},   v = Transpose[{(v=Hypergeometric1F1[1/4(2-r/b),n+1,b]), MedianFilter[v,1]}];   p = Pick[r, Apply[Unequal, v, 1]]; Map[FindRoot[Hypergeometric1F1[1/4(2-t/b),n+1,b], Flatten[{t,#}]]&, Partition[p,2,1]] ] {{t -> 13.0143}, {t -> 47.552}, {t -> 101.833}, {t -> 175.854},   {t -> 269.615}, {t -> 383.115}, {t -> 516.355}} 
Source Link
KennyColnago
  • 15.4k
  • 28
  • 63

Yet another approach to locating zeros of oscillatory functions is to find extrema viaMedianFilter, then to useFindRoot with two adjacent extrema as starting values. I used this method to find roots of RiemannSiegelZ[t] before I learned about Gram points of the Zeta function, and before Mathematica V6 came out withZetaZero[k].

It requires a grid of function values $v$, so the method only works if the function is cheap to calculate. The grid may be linearly spaced, log spaced, or intelligently spaced via Plot as in the current answer from @acl and the earlier one from @J.M.

Next, runMedianFilter[v,1]. The function has a maximum at a point where its value exceeds the median of the three values centred on that point. A minimum occurs where the function value is less than the median. On slopes, the median equals the current, central point. Pick locations where the function value and its median are unequal, these are the extrema.

Finally, pass two adjacent extrema to FindRoot.

Block[{r=Range[2.,550.,5.], v, p, t, b=1, n=1}, v = Transpose[{(v=Hypergeometric1F1[1/4(2-r/b),n+1,b]), MedianFilter[v,1]}]; p = Pick[r, Apply[Unequal, v, 1]]; Map[FindRoot[Hypergeometric1F1[1/4(2-t/b),n+1,b], Flatten[{t,#}]]&, Partition[p,2,1]] ] {{t->13.0143}, {t->47.552}, {t->101.833}, {t->175.854}, {t->269.615}, {t->383.115}, {t->516.355}}