# Write a function areaPerimeter[f,g,x] [closed]

Write a function areaPerimeter[f,g,x] which takes as input two polynomials f and g depending on the variable x, and does the following.

• If the curves y=f(x) and y=g(x) intersect at exactly two points, compute the area and perimeter of the region enclosed by these curves. Produce a plot showing the two curves with a black dot at each intersection point. Choose a scale on the x-axis so that the enclosed region in clearly visible, with a suitable amount of space on either side. Give the plot a title (use the PlotLabel option) which is the list {area, perimeter}.
• If the curves do not intersect at exactly two points, produce a plot of the two curves on the interval [-5,5] and set the title of the plot to be "Curves do not have exactly two intersections."
• Once your function is complete, test it by running the following commands.

You must include the output of these commands in your solution.

## closed as off-topic by Henrik Schumacher, MarcoB, m_goldberg, b3m2a1, bbgodfreyMar 29 at 0:57

This question appears to be off-topic. The users who voted to close gave this specific reason:

• "This question arises due to a simple mistake such as a trivial syntax error, incorrect capitalization, spelling mistake, or other typographical error and is unlikely to help any future visitors, or else it is easily found in the documentation." – Henrik Schumacher, MarcoB
If this question can be reworded to fit the rules in the help center, please edit the question.

• Kenny, this is the third homework question you post this afternoon, without showing what you have tried so far. Show us what you've tried. Otherwise I'm afraid that this will just be downvoted and closed. – MarcoB Mar 28 at 23:06
• I'm voting to close this question as off-topic because this is clearly a homework question without any put towards coming up with a solution – b3m2a1 Mar 29 at 0:01

area[f_, g_, x_] := NIntegrate[g - f, {x, x1, x2}] // N;