Sequence of Bisect implementations
|
#include <cassert>
#include <cmath>
#include <functional>
#include <iostream>
#include <vector>
Go to the source code of this file.
Functions | |
double | f (const double x) |
Calculates function \( f(x) = \sin(x) - \frac{x}{2} \). More... | |
double | g (const double x) |
Calculates function \( f(x) = -(x-1.234567)*(x+0.987654) \). More... | |
double | Bisect3 (const std::function< double(double)> &func, const double a, const double b, const double eps=1e-6) |
Returns one solution for the equation \( func(x) = 0 \) with \( x \in [a,b] \). More... | |
double | eval (vector< double > const &a, double x) |
Evaluates the polynom \( p(x) := a_n x^n + a_{n-1} x^{n-1} + \ldots a_1 x^1 + a_0 \) at point x . More... | |
int | main () |
double Bisect3 | ( | const std::function< double(double)> & | func, |
const double | a, | ||
const double | b, | ||
const double | eps = 1e-6 |
||
) |
Returns one solution for the equation \( func(x) = 0 \) with \( x \in [a,b] \).
The solution is determined by bisection.
[in] | func | function with one double input parameter that returns a double value |
[in] | a | interval begin |
[in] | b | interval end |
[in] | eps | accuracy \( \varepsilon \) |
Definition at line 105 of file Bisect3_lambda.cpp.
double eval | ( | vector< double > const & | a, |
double | x | ||
) |
Evaluates the polynom \( p(x) := a_n x^n + a_{n-1} x^{n-1} + \ldots a_1 x^1 + a_0 \) at point x
.
[in] | a | coefficients of polynom |
[in] | x | evaluatuon point |
Definition at line 127 of file Bisect3_lambda.cpp.
double f | ( | const double | x | ) |
Calculates function \( f(x) = \sin(x) - \frac{x}{2} \).
[in] | x | position for funtion evaluation |
Definition at line 21 of file Bisect3_lambda.cpp.
double g | ( | const double | x | ) |
Calculates function \( f(x) = -(x-1.234567)*(x+0.987654) \).
[in] | x | position for funtion evaluation |
Definition at line 32 of file Bisect3_lambda.cpp.
int main | ( | ) |