Geant4  10.03
G4ChebyshevApproximation.hh
Go to the documentation of this file.
1 //
2 // ********************************************************************
3 // * License and Disclaimer *
4 // * *
5 // * The Geant4 software is copyright of the Copyright Holders of *
6 // * the Geant4 Collaboration. It is provided under the terms and *
7 // * conditions of the Geant4 Software License, included in the file *
8 // * LICENSE and available at http://cern.ch/geant4/license . These *
9 // * include a list of copyright holders. *
10 // * *
11 // * Neither the authors of this software system, nor their employing *
12 // * institutes,nor the agencies providing financial support for this *
13 // * work make any representation or warranty, express or implied, *
14 // * regarding this software system or assume any liability for its *
15 // * use. Please see the license in the file LICENSE and URL above *
16 // * for the full disclaimer and the limitation of liability. *
17 // * *
18 // * This code implementation is the result of the scientific and *
19 // * technical work of the GEANT4 collaboration. *
20 // * By using, copying, modifying or distributing the software (or *
21 // * any work based on the software) you agree to acknowledge its *
22 // * use in resulting scientific publications, and indicate your *
23 // * acceptance of all terms of the Geant4 Software license. *
24 // ********************************************************************
25 //
26 //
27 // $Id: G4ChebyshevApproximation.hh 67970 2013-03-13 10:10:06Z gcosmo $
28 //
29 // Class description:
30 //
31 // Class creating the Chebyshev approximation for a function pointed by fFunction
32 // data member. The Chebyshev polinom approximation provides an efficient evaluation
33 // of minimax polynomial, which (among all polynomials of the same degree) has the
34 // smallest maximum deviation from the true function.
35 // The methods based mainly on recommendations given in the book : An introduction to
36 // NUMERICAL METHODS IN C++, B.H. Flowers, Claredon Press, Oxford, 1995
37 //
38 // ------------------------- MEMBER DATA ------------------------------------
39 //
40 // function fFunction - pointer to a function considered
41 // G4int fNumber - number of Chebyshev coefficients
42 // G4double* fChebyshevCof - array of Chebyshev coefficients
43 // G4double fMean = (a+b)/2 - mean point of interval
44 // G4double fDiff = (b-a)/2 - half of the interval value
45 //
46 // ------------------------ CONSTRUCTORS ----------------------------------
47 //
48 // Constructor for initialisation of the class data members. It creates the array
49 // fChebyshevCof[0,...,fNumber-1], fNumber = n ; which consists of Chebyshev
50 // coefficients describing the function pointed by pFunction. The values a and b
51 // fixe the interval of validity of Chebyshev approximation.
52 //
53 // G4ChebyshevApproximation( function pFunction,
54 // G4int n,
55 // G4double a,
56 // G4double b )
57 //
58 // --------------------------------------------------------------------
59 //
60 // Constructor for creation of Chebyshev coefficients for m-derivative
61 // from pFunction. The value of m ! MUST BE ! < n , because the result
62 // array of fChebyshevCof will be of (n-m) size. There is a definite dependence
63 // between the proper selection of n, m, a and b values to get better accuracy
64 // of the derivative value.
65 //
66 // G4ChebyshevApproximation( function pFunction,
67 // G4int n,
68 // G4int m,
69 // G4double a,
70 // G4double b )
71 //
72 // ------------------------------------------------------
73 //
74 // Constructor for creation of Chebyshev coefficients for integral
75 // from pFunction.
76 //
77 // G4ChebyshevApproximation( function pFunction,
78 // G4double a,
79 // G4double b,
80 // G4int n )
81 //
82 // ---------------------------------------------------------------
83 //
84 // Destructor deletes the array of Chebyshev coefficients
85 //
86 // ~G4ChebyshevApproximation()
87 //
88 // ----------------------------- METHODS ----------------------------------
89 //
90 // Access function for Chebyshev coefficients
91 //
92 // G4double GetChebyshevCof(G4int number) const
93 //
94 // --------------------------------------------------------------
95 //
96 // Evaluate the value of fFunction at the point x via the Chebyshev coefficients
97 // fChebyshevCof[0,...,fNumber-1]
98 //
99 // G4double ChebyshevEvaluation(G4double x) const
100 //
101 // ------------------------------------------------------------------
102 //
103 // Returns the array derCof[0,...,fNumber-2], the Chebyshev coefficients of the
104 // derivative of the function whose coefficients are fChebyshevCof
105 //
106 // void DerivativeChebyshevCof(G4double derCof[]) const
107 //
108 // ------------------------------------------------------------------------
109 //
110 // This function produces the array integralCof[0,...,fNumber-1] , the Chebyshev
111 // coefficients of the integral of the function whose coefficients are
112 // fChebyshevCof. The constant of integration is set so that the integral vanishes
113 // at the point (fMean - fDiff)
114 //
115 // void IntegralChebyshevCof(G4double integralCof[]) const
116 
117 // --------------------------- HISTORY --------------------------------------
118 //
119 // 24.04.97 V.Grichine ( Vladimir.Grichine@cern.ch )
120 
121 #ifndef G4CHEBYSHEVAPPROXIMATION_HH
122 #define G4CHEBYSHEVAPPROXIMATION_HH
123 
124 #include "globals.hh"
125 
126 typedef G4double (*function)(G4double) ;
127 
129 {
130  public: // with description
131 
132  G4ChebyshevApproximation( function pFunction,
133  G4int n,
134  G4double a,
135  G4double b ) ;
136  //
137  // Constructor for creation of Chebyshev coefficients for m-derivative
138  // from pFunction. The value of m ! MUST BE ! < n , because the result
139  // array of fChebyshevCof will be of (n-m) size.
140 
141  G4ChebyshevApproximation( function pFunction,
142  G4int n,
143  G4int m,
144  G4double a,
145  G4double b ) ;
146  //
147  // Constructor for creation of Chebyshev coefficients for integral
148  // from pFunction.
149 
150  G4ChebyshevApproximation( function pFunction,
151  G4double a,
152  G4double b,
153  G4int n ) ;
154 
156 
157  // Access functions
158 
159  G4double GetChebyshevCof(G4int number) const ;
160 
161  // Methods
162 
164  void DerivativeChebyshevCof(G4double derCof[]) const ;
165  void IntegralChebyshevCof(G4double integralCof[]) const ;
166 
167  private:
168 
171 
172  private:
173 
174  function fFunction ;
179 };
180 
181 #endif
std::vector< ExP01TrackerHit * > a
Definition: ExP01Classes.hh:33
G4double GetChebyshevCof(G4int number) const
int G4int
Definition: G4Types.hh:78
static constexpr double m
Definition: G4SIunits.hh:129
G4ChebyshevApproximation(function pFunction, G4int n, G4double a, G4double b)
G4double ChebyshevEvaluation(G4double x) const
const G4int n
void DerivativeChebyshevCof(G4double derCof[]) const
G4ChebyshevApproximation & operator=(const G4ChebyshevApproximation &)
double G4double
Definition: G4Types.hh:76
void IntegralChebyshevCof(G4double integralCof[]) const