If \((c_i)_{0\le i\le n-1}\) denotes the coefficients of the polynomial by decreasing power order, and \((m_i)_{0\le i\le n-2}\) the nodes, the Newton scheme evaluates the polynom \(p\) at \(x\) using the following formula :
\(\qquad\displaystyle p(x) = (((c_0(x-m_0)+c_1)(x-m_1)+ ... )(x-m_{n-2}) + c_{n-1})\)
{
eve::nodes auto ni) noexcept;
}
Specifies that a type is a Conditional Expression.
Definition conditional.hpp:28
The concept floating_value<T> is satisfied if and only if T satisfies eve::value and the element type...
Definition value.hpp:116
The concept logical_value<T> is satisfied if and only if T satisfies eve::value and the element type ...
Definition value.hpp:134
constexpr auto pedantic
Follows the corner cases of the corresponding standard function.
Definition core.hpp:91
constexpr auto newton
Implement the Newton scheme to evaluate polynomials.
Definition newton.hpp:116
EVE Main Namespace.
Definition abi.hpp:19
#include <eve/module/math.hpp>
#include <iostream>
#include <iomanip>
int main()
{
std::cout << std::setprecision(10);
std::cout << "<- wf = " << wf << "\n";
std::cout << "<- wtc = " << wtc << "\n";
std::cout << "<- wtn = " << wtn << "\n";
std::cout <<
"-> newton(wf,wf,2*wf,3*wf,4*wf,5*wf) = " <<
eve::newton(wf,wf,2*wf,3*wf,4*wf,5*wf) <<
"\n";
std::cout <<
"-> newton(wf,coefficients(wtc),coefficients(wtn)) = " <<
eve::newton(wf, eve::coefficients(wtc),eve::nodes(wtn)) <<
"\n";
std::cout <<
"-> newton[pedantic](wf,wf,2*wf,3*wf,4*wf, 5*wf)= " <<
eve::newton[
eve::pedantic](wf,wf,2*wf,3*wf,4*wf, 5*wf) <<
"\n";
}
constexpr auto eps
Computes a constant to the machine epsilon.
Definition eps.hpp:74
Lightweight type-wrapper.
Definition as.hpp:29
Wrapper for SIMD registers.
Definition wide.hpp:94