https://mooseframework.inl.gov
BrentsMethod.h
Go to the documentation of this file.
1 //* This file is part of the MOOSE framework
2 //* https://mooseframework.inl.gov
3 //*
4 //* All rights reserved, see COPYRIGHT for full restrictions
5 //* https://github.com/idaholab/moose/blob/master/COPYRIGHT
6 //*
7 //* Licensed under LGPL 2.1, please see LICENSE for details
8 //* https://www.gnu.org/licenses/lgpl-2.1.html
9 
10 #pragma once
11 
12 // MOOSE includes
13 #include "Moose.h"
14 #include "MooseTypes.h"
15 
16 // C++ includes
17 #include <functional>
18 
26 namespace BrentsMethod
27 {
36 void bracket(std::function<Real(Real)> const & f, Real & x1, Real & x2);
37 
47 Real root(std::function<Real(Real)> const & f, Real x1, Real x2, Real tol = 1.0e-12);
48 }
const double tol
Real f(Real x)
Test function for Brents method.
Real root(std::function< Real(Real)> const &f, Real x1, Real x2, Real tol=1.0e-12)
Finds the root of a function using Brent&#39;s method.
Definition: BrentsMethod.C:66
DIE A HORRIBLE DEATH HERE typedef LIBMESH_DEFAULT_SCALAR_TYPE Real
Brent&#39;s method is used to find the root of a function f(x), i.e., find x such that f(x) = 0...
Definition: BrentsMethod.h:26
void bracket(std::function< Real(Real)> const &f, Real &x1, Real &x2)
Function to bracket a root of a given function.
Definition: BrentsMethod.C:17