27 f[ 0 ] =
z[ 0 ] *
z[ 0 ] *
z[ 0 ] - 3 *
z[ 0 ] *
z[ 1 ] *
z[ 1 ] - 1.;
28 f[ 1 ] = 3 *
z[ 0 ] *
z[ 0 ] *
z[ 1 ] -
z[ 1 ] *
z[ 1 ] *
z[ 1 ];
41 cout <<
"=== Newton: vector residual root test ==============\n";
58 catch (
const std::runtime_error &error )
60 cout <<
" \033[1;31;48m * FAILED THROUGH EXCEPTION BEING RAISED \033[0m\n";
64 const double tol = 1.e-7;
65 if ( ( abs( guess[ 0 ] + 0.5 ) > tol ) ||
66 ( abs( guess[ 1 ] - sqrt( 3. ) / 2. ) > tol ) )
68 cout <<
"\033[1;31;48m * FAILED \033[0m\n";
70 cout << abs( guess[ 1 ] - sqrt( 3. ) / 2. ) <<
"\n";
71 cout << abs( guess[ 0 ] + 0.5 ) <<
"\n";
74 cout <<
"\033[1;32;48m * PASSED \033[0m\n";
A shorter bundled include file for Newton iteration problems.
An DenseVector class – a dense vector object.
void dump() const
Dump to std::cout.
Defines the problem: here z^3 -1 = 0, in vector form using real and imaginary parts.
void residual_fn(const DenseVector< double > &z, DenseVector< double > &f) const
The residual function.
A vector NEWTON iteration class.
void iterate(DenseVector< _Type > &x)
The Newton iteration method.
A base class to be inherited by objects that define residuals.
A collection of OO numerical routines aimed at simple (typical) applied problems in continuum mechani...