booksee
booksee

Reputation: 401

How to compute the maximum of a function?

How to compute the maximum of a smooth function defined on [a,b] in Fortran ? For simplicity, a polynomial function.

The background is that almost all numerical flux(a concept in numerical PDE) involves computing the maximum of certain function over an interval [a,b].

Upvotes: 1

Views: 1333

Answers (1)

sfstewman
sfstewman

Reputation: 5677

For a 1-D problem with smooth and readily-computed derivatives, use Newton-Raphson to find zeros of the first derivative.

For multiple dimensions, and readily-computed derivatives, you're better off using a method that approximates the Hessian. There are several methods of this type, but I've found the L-BFGS method to be reliable and efficient. There a convenient, BSD-licensed package provided by a group at Northwestern University. There's also quite a bit of well-tested code at http://www.netlib.org/

Upvotes: 1

Related Questions