CLHEP VERSION Reference Documentation
   
CLHEP Home Page     CLHEP Documentation     CLHEP Bug Reports

AssociatedLaguerre.cc
Go to the documentation of this file.
1 // -*- C++ -*-
2 // $Id: AssociatedLaguerre.cc,v 1.3 2003/09/06 14:04:14 boudreau Exp $
6 
7 namespace Genfun {
8 FUNCTION_OBJECT_IMP(AssociatedLaguerre)
9 
10 // This is the product n (n-2) (n-4)...
11 inline double factorial (int n) {
12  if (n<=1) return 1.0;
13  else return n*factorial(n-1);
14 }
15 
16 AssociatedLaguerre::AssociatedLaguerre(unsigned int xn, unsigned int xk):
17  _n(xn),
18  _k(xk)
19 {
20  create();
21 }
22 
24  delete _function;
25 }
26 
28 AbsFunction(right),
29 _n(right._n),
30 _k(right._k)
31 {
32  create();
33 }
34 
35 double AssociatedLaguerre::operator() (double x) const {
36  return (*_function)(x);
37 }
38 
39 unsigned int AssociatedLaguerre::n() const {
40  return _n;
41 }
42 
43 unsigned int AssociatedLaguerre::k() const {
44  return _k;
45 }
46 
47 
48 void AssociatedLaguerre::create() {
49  Variable x;
50  if (_n==0) {
51  _function = FixedConstant(1.0).clone();
52  }
53  else if (_n==1) {
54  _function = (-x + _k + 1).clone();
55  }
56  else {
57  _function = ((1.0/_n)*((2*_n -1 +_k -x)*AssociatedLaguerre(_n-1,_k)
58  - (_n+_k-1)*AssociatedLaguerre(_n-2,_k))).clone();
59  }
60 }
61 } // namespace Genfun
Genfun::AbsFunction
Definition: CLHEP/GenericFunctions/AbsFunction.hh:48
Genfun::Variable
Definition: CLHEP/GenericFunctions/Variable.hh:19
AssociatedLaguerre.hh
Genfun::AssociatedLaguerre::n
unsigned int n() const
Definition: AssociatedLaguerre.cc:39
CLHEP::detail::n
n
Definition: Ranlux64Engine.cc:85
Genfun::AssociatedLaguerre::operator()
virtual double operator()(double argument) const
Definition: AssociatedLaguerre.cc:35
Genfun::AssociatedLaguerre
Definition: CLHEP/GenericFunctions/AssociatedLaguerre.hh:23
Variable.hh
Genfun::AbsFunction::clone
virtual AbsFunction * clone() const =0
Genfun::factorial
double factorial(int n)
Definition: AssociatedLaguerre.cc:11
FixedConstant.hh
Genfun::AssociatedLaguerre::~AssociatedLaguerre
virtual ~AssociatedLaguerre()
Definition: AssociatedLaguerre.cc:23
Genfun::FixedConstant
Definition: CLHEP/GenericFunctions/FixedConstant.hh:23
x
any side effects of that construction would occur twice The semantics of throw x
Definition: whyZMthrowRethrows.txt:37
Genfun::AssociatedLaguerre::AssociatedLaguerre
AssociatedLaguerre(unsigned int n, unsigned int k)
Definition: AssociatedLaguerre.cc:16
FUNCTION_OBJECT_IMP
#define FUNCTION_OBJECT_IMP(classname)
Definition: CLHEP/GenericFunctions/AbsFunction.hh:156
Genfun::AssociatedLaguerre::k
unsigned int k() const
Definition: AssociatedLaguerre.cc:43
Genfun
Definition: CLHEP/GenericFunctions/Abs.hh:14