116{
117
118
120
122 b31 = 3.0/40.0 , b32 = 9.0/40.0 ,
123 b41 = 0.3 , b42 = -0.9 , b43 = 1.2 ,
124
125 b51 = -11.0/54.0 , b52 = 2.5 , b53 = -70.0/27.0 ,
126 b54 = 35.0/27.0 ,
127
128 b61 = 1631.0/55296.0 , b62 = 175.0/512.0 ,
129 b63 = 575.0/13824.0 , b64 = 44275.0/110592.0 ,
130 b65 = 253.0/4096.0 ,
131
132 c1 = 37.0/378.0 , c3 = 250.0/621.0 , c4 = 125.0/594.0 ,
133 c6 = 512.0/1771.0 ,
134 dc5 = -277.0/14336.0 ;
135
136 const G4double dc1 = c1 - 2825.0/27648.0 , dc3 = c3 - 18575.0/48384.0 ,
137 dc4 = c4 - 13525.0/55296.0 , dc6 = c6 - 0.25 ;
138
139
140
141
142 yOut[7] = yTemp[7] = yIn[7];
143
145
146
147
148
149 for(i=0;i<numberOfVariables;i++)
150 {
151 yIn[i]=yInput[i];
152 }
153
154
155 for(i=0;i<numberOfVariables;i++)
156 {
157 yTemp[i] = yIn[i] + b21*Step*dydx[i] ;
158 }
160
161 for(i=0;i<numberOfVariables;i++)
162 {
163 yTemp[i] = yIn[i] + Step*(b31*dydx[i] + b32*ak2[i]) ;
164 }
166
167 for(i=0;i<numberOfVariables;i++)
168 {
169 yTemp[i] = yIn[i] + Step*(b41*dydx[i] + b42*ak2[i] + b43*ak3[i]) ;
170 }
172
173 for(i=0;i<numberOfVariables;i++)
174 {
175 yTemp[i] = yIn[i] + Step*(b51*dydx[i] + b52*ak2[i] + b53*ak3[i] +
176 b54*ak4[i]) ;
177 }
179
180 for(i=0;i<numberOfVariables;i++)
181 {
182 yTemp[i] = yIn[i] + Step*(b61*dydx[i] + b62*ak2[i] + b63*ak3[i] +
183 b64*ak4[i] + b65*ak5[i]) ;
184 }
186
187 for(i=0;i<numberOfVariables;i++)
188 {
189
190
191 yOut[i] = yIn[i] + Step*(c1*dydx[i] + c3*ak3[i] + c4*ak4[i] + c6*ak6[i]) ;
192
193
194
195
196 yErr[i] = Step*(dc1*dydx[i] + dc3*ak3[i] + dc4*ak4[i] +
197 dc5*ak5[i] + dc6*ak6[i]) ;
198
199
200 fLastInitialVector[i] = yIn[i] ;
201 fLastFinalVector[i] = yOut[i];
202 fLastDyDx[i] = dydx[i];
203 }
204
205
206 fLastStepLength =Step;
207
208 return ;
209}
G4int GetNumberOfVariables() const
void RightHandSide(const double y[], double dydx[])