Home Libraries People FAQ More

#### 不使用導數查找根(Root Finding Without Derivatives)

##### 概要

```#include <boost/math/tools/roots.hpp>
```

```namespace boost{ namespace math{ namespace tools{

template <class F, class T, class Tol>
std::pair<T, T>
bisect(
F f,
T min,
T max,
Tol tol,
boost::uintmax_t& max_iter);

template <class F, class T, class Tol>
std::pair<T, T>
bisect(
F f,
T min,
T max,
Tol tol);

template <class F, class T, class Tol, class Policy>
std::pair<T, T>
bisect(
F f,
T min,
T max,
Tol tol,
boost::uintmax_t& max_iter,
const Policy&);

template <class F, class T, class Tol>
std::pair<T, T>
bracket_and_solve_root(
F f,
const T& guess,
const T& factor,
bool rising,
Tol tol,
boost::uintmax_t& max_iter);

template <class F, class T, class Tol, class Policy>
std::pair<T, T>
bracket_and_solve_root(
F f,
const T& guess,
const T& factor,
bool rising,
Tol tol,
boost::uintmax_t& max_iter,
const Policy&);

template <class F, class T, class Tol>
std::pair<T, T>
toms748_solve(
F f,
const T& a,
const T& b,
Tol tol,
boost::uintmax_t& max_iter);

template <class F, class T, class Tol, class Policy>
std::pair<T, T>
toms748_solve(
F f,
const T& a,
const T& b,
Tol tol,
boost::uintmax_t& max_iter,
const Policy&);

template <class F, class T, class Tol>
std::pair<T, T>
toms748_solve(
F f,
const T& a,
const T& b,
const T& fa,
const T& fb,
Tol tol,
boost::uintmax_t& max_iter);

template <class F, class T, class Tol, class Policy>
std::pair<T, T>
toms748_solve(
F f,
const T& a,
const T& b,
const T& fa,
const T& fb,
Tol tol,
boost::uintmax_t& max_iter,
const Policy&);

// 結束條件:
template <class T>
struct eps_tolerance;

struct equal_floor;
struct equal_ceil;
struct equal_nearest_integer;

}}} // namespaces
```
##### 描述

```template <class F, class T, class Tol>
std::pair<T, T>
bisect(
F f,
T min,
T max,
Tol tol,
boost::uintmax_t& max_iter);

template <class F, class T, class Tol>
std::pair<T, T>
bisect(
F f,
T min,
T max,
Tol tol);

template <class F, class T, class Tol, class Policy>
std::pair<T, T>
bisect(
F f,
T min,
T max,
Tol tol,
boost::uintmax_t& max_iter,
const Policy&);
```

f

min

max

tol

max_iter

```f(r.first) * f(r.second) <= 0
```

```tol(r.first, r.second) == true
```

```max_iter >= m
```

```template <class F, class T, class Tol>
std::pair<T, T>
bracket_and_solve_root(
F f,
const T& guess,
const T& factor,
bool rising,
Tol tol,
boost::uintmax_t& max_iter);

template <class F, class T, class Tol, class Policy>
std::pair<T, T>
bracket_and_solve_root(
F f,
const T& guess,
const T& factor,
bool rising,
Tol tol,
boost::uintmax_t& max_iter,
const Policy&);
```

f

guess

factor

rising

tol

max_iter

```f(r.first) * f(r.second) <= 0
```

```tol(r.first, r.second) == true
```

```max_iter >= m
```

```template <class F, class T, class Tol>
std::pair<T, T>
toms748_solve(
F f,
const T& a,
const T& b,
Tol tol,
boost::uintmax_t& max_iter);

template <class F, class T, class Tol, class Policy>
std::pair<T, T>
toms748_solve(
F f,
const T& a,
const T& b,
Tol tol,
boost::uintmax_t& max_iter,
const Policy&);

template <class F, class T, class Tol>
std::pair<T, T>
toms748_solve(
F f,
const T& a,
const T& b,
const T& fa,
const T& fb,
Tol tol,
boost::uintmax_t& max_iter);

template <class F, class T, class Tol, class Policy>
std::pair<T, T>
toms748_solve(
F f,
const T& a,
const T& b,
const T& fa,
const T& fb,
Tol tol,
boost::uintmax_t& max_iter,
const Policy&);
```

f

a

b

fa

fb

tol

max_iter

```f(r.first) * f(r.second) <= 0
```

```tol(r.first, r.second) == true
```

```max_iter >= m
```

```template <class T>
struct eps_tolerance
{
eps_tolerance(int bits);
bool operator()(const T& a, const T& b)const;
};
```

```struct equal_floor
{
equal_floor();
template <class T> bool operator()(const T& a, const T& b)const;
};
```

```struct equal_ceil
{
equal_ceil();
template <class T> bool operator()(const T& a, const T& b)const;
};
```

```struct equal_nearest_integer
{
equal_nearest_integer();
template <class T> bool operator()(const T& a, const T& b)const;
};
```

##### 實現

Algorithm 748: Enclosing Zeros of Continuous Functions, G. E. Alefeld, F. A. Potra and Yixun Shi, ACM Transactions on Mathematica1 Software, Vol. 21. No. 3. September 1995. Pages 327-344.