# Writing a function to find ehe volume under$|f(x,y)|$ over an area [closed]

I need to write a function to find the volume under a surface $$|f(x, y)|$$ and over an certain area. The output of the function is going to be the volume and a plot.

For example:

Given $$|f(x,y)|=|3+x^2 - 2y|$$ and the area specified by $$0

the output should be

### Edit

I tried the formulas for integration and plotting, but my code failed. The result that I got was:

try[solid_, x1_ && y1_] :=
Module[{volume1, plot1},
volume1 = Integrate[Abs[solid], x1, y1];
plot1 = Plot3D[Abs[solid], x1, y1];
Print[volume1];
Print[plot1]]

try[x^2 + y^2 + 2, -1 <= x <= 1 && 0 <= y <= 1]


Integrate::ilim: Invalid integration variable or limit(s) in -1<=x<=1.
Plot3D::pllim: Range specification -1<=x<=1 is not of the form {x, xmin, xmax}.

(*
Integrate[Abs[2 + x^2 + y^2], -1 <= x <= 1, 0 <= y <= 1]
Plot3D[Abs[2 + x^2 + y^2], -1 <= x <=1, 0 <= y <= 1]
*)


Here is how it looks in my notebook.

What should I change to make the function work?

• This can be easily found in documentation. – yarchik Jun 24 at 11:31
• @yarchik excuse me, but what documentation are you talking about? and where can i find it? thank you. – loki Jun 24 at 11:39
• @loki right here for Integrate wolfram.com/xid/0mrb9e-k30pof – flinty Jun 24 at 12:04

Is this what you are after?

Integrate[
Abs[x^2 - 2 y + 3]
, {x, y} ∈ ImplicitRegion[-x <= y < x, {{x, 0, 1}, y}]
]


7/2

Plot3D[
Abs[x^2 - 2 y + 3]
, {x, y} ∈ ImplicitRegion[-x <= y < x, {{x, 0, 1}, y}]
, Filling -> Axis
]

• Unfortunately no. I must use the Module function to complete it. – loki Jun 24 at 6:53
• @loki how about you lookup docs for Module and just wrap this solution with it? – Kuba Jun 24 at 7:30