@@ -217,6 +217,73 @@ namespace ql
217217 res[2 ] = this ->_czero ;
218218 }
219219
220+ /* !
221+ * Computes the Bubble derivative.
222+ * Implementation of the formulae from Eq. (4.25) of A. Denner, arXiv:0709.1075.
223+ *
224+ * \param res output object res[0,1,2] the coefficients in the Laurent series
225+ * \param mu2 is the squre of the scale mu
226+ * \param m are the squares of the masses of the internal lines
227+ * \param p are the four-momentum squared of the external lines
228+ */
229+ template <typename TOutput, typename TMass, typename TScale>
230+ void Bubble<TOutput,TMass,TScale>::derivative(vector<TOutput> &res,
231+ const TScale& mu2,
232+ vector<TMass> const & m,
233+ vector<TScale> const & p)
234+ {
235+ if (mu2 < 0 )
236+ throw RangeError (" Bubble::derivative" ," mu2 is negative!" );
237+
238+ if ((Real (m[0 ]) < 0 || Real (m[1 ]) < 0 ) || (Imag (m[0 ]) > 0 || Imag (m[1 ]) > 0 ))
239+ throw RangeError (" Bubble::derivative" ," Real masses must be positive, imag. negative" );
240+
241+ if (res.size () != 3 ) { res.reserve (3 ); }
242+ std::fill (res.begin (), res.end (), this ->_czero );
243+
244+ if (this ->iszero (p[0 ]))
245+ {
246+ if (this ->iszero (Abs (m[0 ])) && this ->iszero (Abs (m[1 ])))
247+ return ;
248+ if (this ->iszero (Abs (m[0 ])-Abs (m[1 ])))
249+ res[0 ] = this ->_cone / (6.0 * m[0 ]);
250+ }
251+ else
252+ {
253+ if (this ->iszero (Abs (m[0 ])) && this ->iszero (Abs (m[1 ])))
254+ res[0 ] = - this ->_cone / p[0 ];
255+ else if (this ->iszero (Min (m[0 ], m[1 ])))
256+ {
257+ TMass msq;
258+ if (Abs (m[0 ]) >= Abs (m[1 ])) msq = m[0 ];
259+ else msq = m[1 ];
260+
261+ if (this ->iszero (Abs (p[0 ] - msq)))
262+ {
263+ res[1 ] = - this ->_chalf / msq;
264+ res[0 ] = - this ->_chalf / msq * this ->Lnrat (mu2, msq) - this ->_cone / msq;
265+ }
266+ else
267+ res[0 ] = - (this ->_cone + msq / p[0 ] * this ->Lnrat (msq - p[0 ], msq)) / p[0 ];
268+ }
269+ else
270+ {
271+ const TMass a = Sqrt (m[0 ] * m[1 ]);
272+ const TMass c = a;
273+ const TOutput b = m[0 ] + m[1 ] - TMass (p[0 ]) - this ->_ieps ;
274+ const TOutput root = Sqrt (Pow (b, 2 ) - this ->_cfour *a*c);
275+ const TOutput sgn = TOutput (Sign (Real ( Conjg (b) * root)));
276+ const TOutput q = this ->_chalf * (b + sgn*root);
277+ const TOutput rm = q / a;
278+ const TOutput r = rm;
279+ res[0 ] = - this ->_chalf * (m[0 ] - m[1 ]) / Pow (p[0 ], 2 ) * Log (m[1 ]/m[0 ]) +
280+ Sqrt (m[0 ] * m[1 ]) / Pow (p[0 ], 2 ) * (this ->_cone / r - r) * Log (r)
281+ - (1.0 + (Pow (r, 2 ) + this ->_cone ) / (Pow (r, 2 ) - this ->_cone ) * Log (r)) / p[0 ];
282+ }
283+ }
284+ return ;
285+ }
286+
220287 // explicity tyoename declaration
221288 template class Bubble <complex ,double ,double >;
222289 template class Bubble <complex ,complex ,double >;
0 commit comments