6
$\begingroup$

use mathematica

Hence, calculate the exact area enclosed by these curves using Mathematica. $f(x)=x^3$ and $g(x)=x^5 - 2 x^3 - 3 x$

i have got the graph...now I'm stuck with finding the area

$\endgroup$
  • $\begingroup$ the interval is not given... $\endgroup$ – Ashneel Sep 1 '14 at 0:54
  • $\begingroup$ im also unable to figure out from the graph $\endgroup$ – Ashneel Sep 1 '14 at 0:55
12
$\begingroup$

Here is a different approach based on the awesome new Region functions:

f[x_] := x^3
g[x_] := x^5 - 2 x^3 - 3 x

We solve for the intersections:

sol = x /. NSolve[f[x] == g[x], x, Reals]

{-1.94712297, 0, 1.94712297}

Edit

Here are the regions of interest:

r1 = ImplicitRegion[g[x] > y && f[x] < y, {{x, -1.94712297, 0}, y}];
r2 = ImplicitRegion[g[x] < y && f[x] > y, {{x, 0, 1.94712297}, y}];

And the area is simply:

Area @ RegionUnion[r1, r2]

14.7695075

We can visualize the region to be sure:

RegionPlot[{r1, r2}, PlotRange -> {{-3, 3}, {-8, 8}}]

Mathematica graphics

$\endgroup$
  • $\begingroup$ Regarding all solutions using NSolve, numeric intermediate solutions and getting numeric area: Solve works fine, and produces a Root object. All values in this problem can be maintained in abstract, precise form - either Root, or converted to radicals using ToRadicals. And of course, FullSimplify often cleans up overly complicated radicals. $\endgroup$ – kirma Sep 2 '14 at 17:28
  • 1
    $\begingroup$ @kirma, I realize that Solve works fine and gives the exact value, that was what I used first. I just wanted to use NSolve to keep things simple and convey the idea which is the important thing here. $\endgroup$ – RunnyKine Sep 2 '14 at 17:30
11
$\begingroup$

Here's what the plot looks like:

f[x_] := x^3
g[x_] := x^5 - 2 x^3 - 3 x

Plot[{f[x], g[x]}, {x, -5, 5}, PlotRange -> {-10, 10}]

Mathematica graphics

You first solve for the intersections:

sol = x /. NSolve[f[x] == g[x], x, Reals]

{-1.94712297, 0, 1.94712297}

Now you can find the area by integrating the difference between the curves in the intervals obtained:

Integrate[g[x] - f[x], {x, sol[[1]], sol[[2]]}]

7.38475373

Same goes for the interval from $0$ to $1.9471$, in this region $f(x) > g(x)$

Integrate[f[x] - g[x], {x, sol[[2]], sol[[3]]}]

7.38475373

So the total area is just $2(7.38475373)$

14.7695075

From the graph it's obvious both functions are symmetric and we could have just found the area in one region and multiplied by $2$.

$\endgroup$
5
$\begingroup$
f[x_] := x^3
g[x_] := x^5 - 2 x^3 - 3 x
sol = Partition[x /. NSolve[f[x] == g[x], x, Reals], 2, 1]
Tr@(Abs@Integrate[g[x] - f[x], {x, Sequence @@ #}] & /@ sol)

(*14.7695*)
$\endgroup$
  • 3
    $\begingroup$ Is there an obfuscated Mathematica contest?? :) $\endgroup$ – Mark McClure Sep 1 '14 at 9:12
  • 2
    $\begingroup$ @MarkMcClure ya know: "your programming style mirrors your mind" $\endgroup$ – Dr. belisarius Sep 1 '14 at 13:28
4
$\begingroup$

The exact area - i.e. not a numerical approximation - can be obtained as follows:

f[x_] := x^3;
g[x_] := x^5 - 2 x^3 - 3 x;

Find the points on the real axis where f[x] and g[x] intersect.

sol = Solve[f[x] == g[x], x, Reals]

(* {{x -> 0}, {x -> Root[-3 - 3 #1^2 + #1^4 &, 1]}, {x -> Root[-3 - 3 #1^2 + #1^4 &, 2]}} *)

Compute the area enclosed by integrating Abs[f[x] - g[x]] between the end points.

area = Integrate[Abs[f[x] - g[x]], {x, x /. sol[[2]], x /. sol[[3]]}] // FullSimplify

(* 1/4 (27 + 7 Sqrt[21]) *)

Compute a numerical approximation to the enclosed area.

N[area]

(* 14.7695 *)
$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.