# PDF with complex numbers

Hello, Rooters!

I have a problem and the web wasn’t able to help me. I need to implement some kind of relativistic Breit-Wigner PDF, but I’m not able to handle the way to define it. The formula goes something like this:

where i stands for sqrt(-1). Every other number is a RooRealVar or RooFormulaVar already defined, but I don’t know how to add the imaginary constant to the RooGenericPdf.

Any idea that could help me?

Hello oxio,

as this is a probability distribution function, it doesn’t really have an imaginary part - it’s strictly real and non-negative. So one way to solve your problem would be rewriting the PDF to a form without an imaginary part. It’s quite simple actually:

You have a formula of the type

``abs(a/(b + i*c) + d)^2``

now you can expand the present fraction by (b - i*c) thus gaining

``abs(a*(b - i*c)/(b^2 + c^2) + d)^2``

which can be rewritten as

``abs(a*b/(b^2 + c^2) + d - i*a*c/(b^2 + c^2))^2``

it can now be readily seen that we have separated the real and imaginary part; thus we have

``abs(x + i*y)^2 = (x + i*y)(x - i*y) = x^2 + y^2``

where, for the sake of clarity, I’ve substituted x for the real part and y for the imaginary. All that is left to do now is replacing a,b,c,d resp. x,y with your constants/variables and voila, you are good to go.

Cheers,
Daniel

hello!
Thanks a lot, I’ve tried this, but I think my derivation wasn’t all that good, my algebra was perhaps wrong. I will try your version

thanks!
cheers