# Volume beneath a two-dimensional polynomial

1. Apr 24, 2013

### Billy70

Hello

Firstly apologies for what seems like an extremely fundamental question, it's been a while since I've done any calculus!

I'm currently using a program to fit data with a two dimensional 3 degree polynomial curve( which outputs the fit in the following format) with the aim of calculating the volume between the curve and the baseline:
z = a + bx + cy + d(x^2) + exy + f(y^2) + g(x^3) + h(x^2y) + i(xy^2) + j(y^3)

However I'm struggling to integrate this w.r.t. dydx within the fit range, having previously only calculated areas in this way.

An ideal solution would be to calculate the volume by inputting the constants into a script,as is possible with two dimensional Gaussians. Since there are >200 curves to analyse per dataset so integrating each fit manually will be extremely labour intensive!

Thanks in advance for any replies,
Billy

2. Apr 25, 2013

### haruspex

Do you mean that you want the volume between the surface and z=0? If so, how are the bounds of the integration defined? Are there specific ranges of x and y? Can the surface go below z=0 anywhere in the range? If so, how do you want to treat that?

3. Apr 25, 2013

### Billy70

Hi haruspex,

Yes I want the volume between the surface and z=0. The bounds of the integration are manually defined e.g. 0 and 20 in x and y. Assuming a good fit, no, the surface should not go below z=0 within the range as this is below the parameters of the dataset, however if this occurs then I would only want to count the volume above z=0.

Thanks
Billy

4. Apr 25, 2013

### HallsofIvy

If I understand this correctly you want the volume beneath $z = a + bx + cy + d(x^2) + exy + f(y^2) + g(x^3) + h(x^2y) + i(xy^2) + j(y^3)$, above the xy-plane, z= 0, and bounded on the sides by the planes x= 0, x= 20, y= 0, and y= 20. That is, of course,
$$\int_{x=0}^{20}\int_{y= 0}^{20}(a+ bx+ cy+ dx^2+ exy+ fy^2+ gx^3+ hx^2y+ jy^3)dx$$
$$= \left[ax+ bx^2/2+ cy^2/2+ dx^3/3+ ex^2y/2+ exy^2/2+ fy^3/3+ gx^4/4+ yx^3y/3+ hx^2y^2/2+ jy^4/4\right]_{x=0, y=0}^{x=20, y=20}$$.

Last edited by a moderator: Apr 25, 2013
5. Apr 25, 2013

### haruspex

To cover that eventuality, you will need to find whereabouts z<0 and remove those areas from the integral. Finding those areas is messy (solving a cubic) and skirting around them in the integral could get very difficult. Maybe you could check for whether it's likely to happen just by evaluating z across a grid of points.