I wondering if anyone can provide advice on the best combination of algorithms to find the roots (or any one root) of a function which is "dense" in that it has many local maxima and minima for example consider $\sin\left (x^{2} \right ) + \sin^{2}\left (x \right )$. I have been trying to distinguish between the best methods for this type of function but I can't seem to find any references to functions that behave like that. For the purposes of the answer, I do however have a range in which at least one root is known to lie. Many thanks.
2026-04-06 04:17:41.1775449061
Root Finding for Functions with many maxima and minima
1.3k Views Asked by Bumbble Comm https://math.techqa.club/user/bumbble-comm/detail At
1
There are 1 best solutions below
Related Questions in NUMERICAL-METHODS
- The Runge-Kutta method for a system of equations
- How to solve the exponential equation $e^{a+bx}+e^{c+dx}=1$?
- Is the calculated solution, if it exists, unique?
- Modified conjugate gradient method to minimise quadratic functional restricted to positive solutions
- Minimum of the 2-norm
- Is method of exhaustion the same as numerical integration?
- Prove that Newton's Method is invariant under invertible linear transformations
- Initial Value Problem into Euler and Runge-Kutta scheme
- What are the possible ways to write an equation in $x=\phi(x)$ form for Iteration method?
- Numerical solution for a two dimensional third order nonlinear differential equation
Related Questions in ROOTS
- How to solve the exponential equation $e^{a+bx}+e^{c+dx}=1$?
- Roots of a complex equation
- Do Irrational Conjugates always come in pairs?
- For $f \in \mathbb{Z}[x]$ , $\deg(\gcd_{\mathbb{Z}_q}(f, x^p - 1)) \geq \deg(\gcd_{\mathbb{Q}}(f, x^p - 1))$
- The Heegner Polynomials
- Roots of a polynomial : finding the sum of the squares of the product of two roots
- Looking for references about a graphical representation of the set of roots of polynomials depending on a parameter
- Approximating the first +ve root of $\tan(\lambda)= \frac{a\lambda+b}{\lambda^2-ab}$, $\lambda\in(0,\pi/2)$
- Find suitable scaling exponent for characteristic polynomial and its largest root
- Form an equation whose roots are $(a-b)^2,(b-c)^2,(c-a)^2.$
Trending Questions
- Induction on the number of equations
- How to convince a math teacher of this simple and obvious fact?
- Find $E[XY|Y+Z=1 ]$
- Refuting the Anti-Cantor Cranks
- What are imaginary numbers?
- Determine the adjoint of $\tilde Q(x)$ for $\tilde Q(x)u:=(Qu)(x)$ where $Q:U→L^2(Ω,ℝ^d$ is a Hilbert-Schmidt operator and $U$ is a Hilbert space
- Why does this innovative method of subtraction from a third grader always work?
- How do we know that the number $1$ is not equal to the number $-1$?
- What are the Implications of having VΩ as a model for a theory?
- Defining a Galois Field based on primitive element versus polynomial?
- Can't find the relationship between two columns of numbers. Please Help
- Is computer science a branch of mathematics?
- Is there a bijection of $\mathbb{R}^n$ with itself such that the forward map is connected but the inverse is not?
- Identification of a quadrilateral as a trapezoid, rectangle, or square
- Generator of inertia group in function field extension
Popular # Hahtags
second-order-logic
numerical-methods
puzzle
logic
probability
number-theory
winding-number
real-analysis
integration
calculus
complex-analysis
sequences-and-series
proof-writing
set-theory
functions
homotopy-theory
elementary-number-theory
ordinary-differential-equations
circles
derivatives
game-theory
definite-integrals
elementary-set-theory
limits
multivariable-calculus
geometry
algebraic-number-theory
proof-verification
partial-derivative
algebra-precalculus
Popular Questions
- What is the integral of 1/x?
- How many squares actually ARE in this picture? Is this a trick question with no right answer?
- Is a matrix multiplied with its transpose something special?
- What is the difference between independent and mutually exclusive events?
- Visually stunning math concepts which are easy to explain
- taylor series of $\ln(1+x)$?
- How to tell if a set of vectors spans a space?
- Calculus question taking derivative to find horizontal tangent line
- How to determine if a function is one-to-one?
- Determine if vectors are linearly independent
- What does it mean to have a determinant equal to zero?
- Is this Batman equation for real?
- How to find perpendicular vector to another vector?
- How to find mean and median from histogram
- How many sides does a circle have?
Let's take a look at a graph of the function $f(x)=\sin(x^2)+\sin^2(x)$, which has the salient characteristics of lots of roots and "many local maxima and minima". Here it is over the interval $[0,10]$:
I produced this image with Mathematica, after finding the roots with
NSolve, which is quite good at this sort of thing:Looks like there are 31 roots lying strictly between 1 and 10. In fact, the technique used by Mathematica is outlined very roughly in this Wolfram blog post, which makes the point that determination of the number of the roots in a region is a key step in the process. As outlined in the post, this can be done quite efficiently using numerical integration in the complex plane. Specifically, the argument principle states that for a simple, closed, contractible curve $\gamma$ that doesn't pass through a pole or zero of a function $f$, we have
$$\frac{1}{2\pi i} \int_{\gamma} \frac{f'(z)}{f(z)} \, dz = Z-P,$$
where $Z$ and $P$ are the number of zeros and poles of $f$ inside $\gamma$ counted according to multiplicity.
For example, if we want to determine the number of roots of our example function $f(z)=\sin(z^2)+\sin(z)^2$ in the interval $(0,10)$, we might let $$\gamma(t) = 5+4.99\cos(t) + i\sin(t)/5.$$ (Note that $f$ has no poles.) If we plot this in the complex plane together with a contour plot of $|f(z)|$, we get something like so:
The integral along $\gamma$ can be evaluated numerically and result rounded, since we're expecting an integer. In Mathematica, you'd do
Thus, the interval has 31 roots, as expected. In practice, this process is performed recursively so that we can isolate the roots and then use an iterative process like Newton's method on the isolated portions.
It should be mentioned that the integral for a function like this can be highly oscillatory. Mathematica does very well on this because it implements the Levin technique for oscillatory integrals. The same integral in scipy doesn't go so well.
There's also a long warning issued by scipy. The convergence can be improved by breaking the integral in two parts, but that needs to be done by the user.
A completely different approach is taken by the Matlab routine
FindRealRoots. It's quite simple - we first approximate the function with a Chebyshev polynomial and then we find the roots of the polynomial. We can apply it to our sample problem like so:The procedure finds all the roots (including the double root at zero). They are not as accurate as the Mathematica version, though, and you've got to experiment with the third parameter (namely, the order of the Chebyshev polynomial) to see if you've got all the roots or not. It's very simple and quite quick, however.