I have a function that I am trying to find the minimum of. I know how to solve for the minimum of a quadratic function as well as a square root function. I don't know how to solve for the minimum of a function that has both of those elements. I have simplified the function as much as I can and it has come to this.
$$y = \sqrt{-3x^2-10x+225-40\sqrt{25-x^2}}$$
What is the procedure I must do to find the minimum?
Here is a general formula. I am trying to find the value of $x$ that minimises $y$.
$$y=\sqrt{(x-a)^2+(\frac{h}{w}\sqrt{w^2-x^2}-b)^2}$$
To minimize $y^2=(x-a)^2+(\tfrac{h}{w}\sqrt{w^2-x^2}-b)^2$ algebraically requires finding its turning points by solving $\frac{dy^2}{dx}=0$. This reduces to solving a quartic equation. Although quartics admit a solution in radicals, it's rarely worth using. It's probably best to use numerical minimization instead; it's not as expensive as you might think. Here's a Python solution:
For me, this took 1 millisecond to solve the special case you mentioned originally. You should be able to adapt it to C++ using Boost, which will be even faster.