# Finding an invertable non-negative PDF from a biquadratic function

1. May 25, 2012

### renderdan

Hi,
I would be very grateful for any help with the following problem.
I am using this equation in one context, together with some fitted coefficient data:
$$a_0x^2+a_1y^2+a_2xy+a_3x+a_4y+a_5$$

where -1<=x<=+1 and -1<=y<=+1
Although actually the data I care about will have the constraint that $x^2+y^2<=1$. So what we are doing is discarding any data outside of the unit disk, and treating it as if it were zero.

What I would like to do is to choose random samples from this data such that their density is distributed according to its shape, as if it were a cdf generated from a pdf. The problem is that my starting function can evaluate to less than zero, even within the unit disk. This doesn't present a problem when evaluating it directly, as we simply test for the negative case and discard the result. However I gather this makes it un-invertable as a pdf, since pdfs must always be non-negative.

I tried to normalize my function by finding the following definite integral

$$\int_{-1}^{1} \int_{-1}^{1} a_0x^2+a_1y^2+a_2xy+a_3x+a_4y+a_5 dx dy$$

and then dividing my original function by that to get a normalized pdf... which would have had the simple answer of $4/3 (a_0+a_1+3 a_5)$ were it not invalid due to the graph having negative area in some places

So my question is - how do I go about finding the definite integral of Max[0,f(x)] or [Sqrt[f(x)^2] + f(x)] / 2 or some other way to remove the negative values from my function ? Is it even possible ? And if so, can it then be inverted ? Should I treat it as two seperable joint pdfs, or a single bivariate pdf ? Do I need to find the roots and integrate using them as my domain ?

Any / all help appreciated.
Thanks