# Are there some functions that cannot be optimized using calculus?

I've been working on a project to maximize a functions output using a genetic algorithm. However, from the limited calculus I know I thought there were methods to find the maximum of a mathematical function using calculus? I'd assume the reason genetic algorithms are sometimes used to maximize functions is because there are functions where the mathematical methods don't work. If I'm correct, what are those conditions? I'd guess that maybe it's because the function is not continuous or differentiable?

• Not related too much to the question, but I think you might find it interesting. en.wikipedia.org/wiki/No_free_lunch_in_search_and_optimization – AnotherUser Aug 4 '14 at 19:20
• Many times you want to minimize a nondifferentiable function. Even if your objective function is differentiable, there may be many local minima. When you set the derivative equal to $0$, there may not be an analytical formula that tells you all the solutions. So it's not as if you can just set the derivative equal to $0$ and solve for $x$.You need to use some strategy like gradient descent, which typically leads you to a local minimum. – littleO Aug 4 '14 at 20:39
• @littleO So you can't use formula to get a global maximum from a nondifferentiable function? You need to use a search strategy such as a genetic algorithm? I recall formulas that could maximize some functions with local optimums. Also, gradient descent would require the function to be differentiable. – user11406 Aug 4 '14 at 21:02
• If you are trying to minimize a function which is nondifferentiable but which is convex, then there's a good chance that numerical methods from convex optimization would allow you to compute a global minimizer efficiently. But rarely is there an actual formula for the solution to an optimization problem that arises in practice. – littleO Aug 4 '14 at 21:20
• I haven't seen a lot of interest in genetic algorithms to solve single-variable functions. Mostly it's functions of many variables. Local optimums of such functions can be a lot harder to find. – David K Aug 4 '14 at 21:21