36G4int G4SimpleIntegration::fMaxDepth = 100 ;
40 : fFunction(pFunction),
47 : fFunction(pFunction),
48 fTolerance(pTolerance)
62 G4int iterationNumber )
64 G4double Step = (xFinal - xInitial)/iterationNumber ;
65 G4double mean = (fFunction(xInitial) + fFunction(xFinal))*0.5 ;
67 for(
G4int i=1;i<iterationNumber;i++)
70 mean += fFunction(x) ;
78 G4int iterationNumber )
80 G4double Step = (xFinal - xInitial)/iterationNumber ;
83 for(
G4int i=1;i<iterationNumber;i++)
86 mean += fFunction(x) ;
94 G4int iterationNumber )
97 static G4double root = 1.0/std::sqrt(3.0) ;
98 G4double Step = (xFinal - xInitial)/(2.0*iterationNumber) ;
101 for(
G4int i=0;i<iterationNumber;i++)
104 mean += (fFunction(x+delta) + fFunction(x-delta)) ;
112 G4int iterationNumber )
114 G4double Step = (xFinal - xInitial)/iterationNumber ;
116 G4double xPlus = xInitial + 0.5*Step ;
117 G4double mean = (fFunction(xInitial) + fFunction(xFinal))*0.5 ;
119 for(
G4int i=1;i<iterationNumber;i++)
123 mean += fFunction(x) ;
124 sum += fFunction(xPlus) ;
127 return mean*Step/3.0 ;
149 static G4double root = 1.0/std::sqrt(3.0) ;
151 G4double xMean = (xInitial + xFinal)/2.0 ;
152 G4double Step = (xFinal - xInitial)/2.0 ;
154 G4double sum = (fFunction(xMean + delta) + fFunction(xMean - delta)) ;
168 G4Exception(
"G4SimpleIntegration::AdaptGauss()",
"Error",
171 G4double xMean = (xInitial + xFinal)/2.0 ;
175 if(std::fabs(leftHalf+rightHalf-full) < fTolerance)
G4double(* function)(G4double)
G4double AdaptGaussIntegration(G4double xInitial, G4double xFinal)
G4double Gauss(G4double xInitial, G4double xFinal, G4int iterationNumber)
G4SimpleIntegration(function pFunction)
G4double Trapezoidal(G4double xInitial, G4double xFinal, G4int iterationNumber)
G4double Simpson(G4double xInitial, G4double xFinal, G4int iterationNumber)
void AdaptGauss(G4double xInitial, G4double xFinal, G4double &sum, G4int &depth)
G4double MidPoint(G4double xInitial, G4double xFinal, G4int iterationNumber)
void G4Exception(const char *originOfException, const char *exceptionCode, G4ExceptionSeverity severity, const char *comments)