Jpp  19.1.0
the software that should make you happy
Public Member Functions | Protected Attributes | Friends | List of all members
JMATH::JPower Class Reference

Power law function object. More...

#include <JPower.hh>

Public Member Functions

 JPower (const double alpha, const double factor=1.0)
 Constructor. More...
 
double getValue (const double x) const
 Function value. More...
 
double getDerivative (const double x) const
 Derivative value. More...
 
double getIntegral (const double x) const
 Integral value. More...
 
double operator() (const double x) const
 Function value. More...
 

Protected Attributes

double alpha
 
double factor
 

Friends

std::istream & operator>> (std::istream &in, JPower &object)
 Read power from input. More...
 
std::ostream & operator<< (std::ostream &out, const JPower &object)
 Write power to output. More...
 

Detailed Description

Power law function object.

Evaluation of function, derivative and integral values.

Definition at line 23 of file JPower.hh.

Constructor & Destructor Documentation

◆ JPower()

JMATH::JPower::JPower ( const double  alpha,
const double  factor = 1.0 
)
inline

Constructor.

Parameters
alphaspectral index
factormultiplication factor

Definition at line 31 of file JPower.hh.

33  {
34  this->alpha = alpha;
35  this->factor = factor;
36  }
double factor
Definition: JPower.hh:119
double alpha
Definition: JPower.hh:118

Member Function Documentation

◆ getValue()

double JMATH::JPower::getValue ( const double  x) const
inline

Function value.

Parameters
xabscissa value
Returns
function value

Definition at line 45 of file JPower.hh.

46  {
47  return factor * pow(x, alpha);
48  }
T pow(const T &x, const double y)
Power .
Definition: JMath.hh:97

◆ getDerivative()

double JMATH::JPower::getDerivative ( const double  x) const
inline

Derivative value.

Parameters
xabscissa value
Returns
derivative value

Definition at line 57 of file JPower.hh.

58  {
59  return factor * alpha * pow(x, alpha - 1);
60  }

◆ getIntegral()

double JMATH::JPower::getIntegral ( const double  x) const
inline

Integral value.

Parameters
xabscissa value
Returns
integral value

Definition at line 69 of file JPower.hh.

70  {
71  if (alpha != -1.0)
72  return factor * pow(x, alpha + 1) / (alpha + 1);
73  else
74  return factor * log(x);
75  }

◆ operator()()

double JMATH::JPower::operator() ( const double  x) const
inline

Function value.

Parameters
xabscissa value
Returns
function value

Definition at line 84 of file JPower.hh.

85  {
86  return getValue(x);
87  }
double getValue(const double x) const
Function value.
Definition: JPower.hh:45

Friends And Related Function Documentation

◆ operator>>

std::istream& operator>> ( std::istream &  in,
JPower object 
)
friend

Read power from input.

Parameters
ininput stream
objectpower
Returns
input stream

Definition at line 97 of file JPower.hh.

98  {
99  in >> object.alpha >> object.factor;
100 
101  return in;
102  }

◆ operator<<

std::ostream& operator<< ( std::ostream &  out,
const JPower object 
)
friend

Write power to output.

Parameters
outoutput stream
objecttrigonometric
Returns
output stream

Definition at line 112 of file JPower.hh.

113  {
114  return out << object.alpha << ' ' << object.factor;
115  }

Member Data Documentation

◆ alpha

double JMATH::JPower::alpha
protected

Definition at line 118 of file JPower.hh.

◆ factor

double JMATH::JPower::factor
protected

Definition at line 119 of file JPower.hh.


The documentation for this class was generated from the following file: