/* Example programs from the book Scientific and Engineering Programming in C++: An Introduction with Advanced Techniques and Examples, Addison-Wesley, 1994. (c) COPYRIGHT INTERNATIONAL BUSINESS MACHINES CORPORATION 1994. ALL RIGHTS RESERVED. See README file for further details. */ template void RigidRallEquations::evaluateAt(const Array1d& vars){ FormedArray1d > np(nvars); for (int in = 0; in < nvars; in++) np(in) = RigidRall1d(in, vars(in)); FormedArray1d > op(nvars); for (int i = 0; i < nvars; i++){ op(i) = ( (*this)(i) )(np); // evaluate i_th equation with derivatives. j[i] = op(i).gradient(); // Unpack. v(i) = op(i)(); } } template Boolean RigidRallEquations::converged_to(const T& limit) const { // Compare norm to limit, stop when we know answer. T norm(0.); for( int i = 0; i < nvars; i++ ){ norm += v(i)*v(i); } return sqrt(norm) <= limit; }