1 #ifndef __JMATH__JLEGENDRE__
2 #define __JMATH__JLEGENDRE__
18 namespace JPP {
using namespace JMATH; }
25 template<
class JOrdinate_t>
70 virtual JOrdinate_t
getValue(
const double x)
const = 0;
113 double getX(
const double x)
const
124 for (
iterator i = this->begin(); i != this->end(); ++i) {
157 this->
xmin = std::numeric_limits<double>::max();
158 this->
xmax = std::numeric_limits<double>::lowest();
160 for (
T i = __begin; i != __end; ++i) {
161 if (i->first < this->xmin) { this->
xmin = i->first; }
162 if (i->first > this->xmax) { this->
xmax = i->first; }
178 for (JOrdinate_t x; in >> x; ) {
212 template<
class JOrdinate_t,
size_t N = (size_t) -1>
219 template<
class JOrdinate_t>
239 this->set(xmin, xmax);
249 virtual JOrdinate_t
getValue(
const double x)
const override
251 const double z = this->getX(x);
252 JOrdinate_t y =
zero;
254 for (
size_t n = 0;
n != this->size(); ++
n) {
266 template<
class JOrdinate_t,
size_t N>
292 this->set(xmin, xmax);
311 this->set(__begin, __end);
332 for (
size_t n = 0;
n !=
N + 1; ++
n) {
334 JOrdinate_t V =
zero;
337 for (
T i = __begin; i != __end; ++i) {
339 const double x = i->first;
340 const JOrdinate_t& y = i->second;
341 const double z = this->getX(x);
344 V += w * (y - (*this)(x));
362 for (
typename JLegendre::iterator i =
object.begin(); i !=
object.end(); ++i) {
void set(const double xmin, const double xmax)
Set abscissa values.
JLegendre(const double xmin, const double xmax)
Constructor.
virtual ~JLegendre_t()
Virtual destructor.
JLegendre()
Default constructor.
Auxiliary methods for mathematics.
JLegendre()
Default constructor.
JLegendre_t()
Default constructor.
JLegendre(const double xmin, const double xmax)
Constructor.
static const JZero zero
Function object to assign zero value.
Definition of zero value for any class.
double getXmin() const
Get minimal abscissa value.
double xmax
maximal abscissa
JLegendre(T __begin, T __end)
Constructor.
friend std::ostream & operator<<(std::ostream &out, const JLegendre_t &object)
Write Legendre polynome to output.
friend std::istream & operator>>(std::istream &in, JLegendre_t &object)
Read Legendre polynome from input.
double getXmax() const
Get maximal abscissa value.
std::vector< JOrdinate_t >::const_reverse_iterator const_reverse_iterator
do set_variable OUTPUT_DIRECTORY $WORKDIR T
Template definition for function evaluation of Legendre polynome.
void set(T __begin, T __end)
Set abscissa values.
std::vector< JOrdinate_t >::iterator iterator
friend std::istream & operator>>(std::istream &in, JLegendre &object)
Read Legendre polynome from input.
double legendre(const unsigned int n, const double x)
Legendre polynome.
JOrdinate_t operator()(const double x) const
Function value.
double xmin
minimal abscissa
alias put_queue eval echo n
std::vector< JOrdinate_t >::reverse_iterator reverse_iterator
void set(T __begin, T __end)
Set Legendre polynome.
double getX(const double x) const
Get normalised abscissa value.
then fatal Wrong number of arguments fi set_variable DETECTOR $argv[1] set_variable INPUT_FILE $argv[2] eval JPrintDetector a $DETECTOR O IDENTIFIER eval JPrintDetector a $DETECTOR O SUMMARY source JAcoustics sh $DETECTOR_ID typeset A TRIPODS get_tripods $WORKDIR tripod txt TRIPODS for EMITTER in
Base class for Legendre polynome.
then usage $script[input file[working directory[option]]] nWhere option can be N
JLegendre_t(const double xmin, const double xmax)
Constructor.
std::vector< JOrdinate_t >::const_iterator const_iterator
virtual JOrdinate_t getValue(const double x) const override
Function value.
virtual JOrdinate_t getValue(const double x) const =0
Function value.