# math-157-volumes

## 1753 days ago by basyrova

First we define the two functions:

f(x)=x^2 + 15/x; g(x)=20*sqrt(x);

Then we make a graph of y=f(x) and y=g(x).

Sage can even fill the region between the two graphs of functions for us.

The graph of y=f(x) will be blue, the graph of y=g(x) will be red, and the fill color is green.

To change the graphing window you can change the xmin and xmax values in the first two lines.

xmin=0; xmax=20; plot_f = plot(f(x),(x,xmin,xmax),color='blue'); plot_g = plot(g(x),(x,xmin,xmax),color='red',fill=f(x),fillcolor='green'); show(plot_f + plot_g);

Now we would like to find the points of intersection.

solve( f(x) == g(x), x);

Note that the above answer is really helpful as the computer tries to find the exact solutions.

In this case we can square both sides of the equation, and ask the computer to solve the modified version:

solve( (x^2 + 15/x)^2 == 20^2*x, x);

As you can see, we have about 6 solutions above, some of them complex, some of them real, but the expressions above are not really helpful.

If we are ready to settle for approximate decimals for the points of intersection, we can use the find_root function:

print find_root( f(x) == g(x), 0, 10);
 7.17511269287 7.17511269287

The find_root function takes in the equation, and the x-interval where to look for a solution.

Since we see two points of intersection on the graph, we can give the computer a hint where to look for the solutions:

print find_root( f(x)==g(x), 0, 2); print find_root( f(x)==g(x), 6, 8);
 0.847680343978 7.17511269287 0.847680343978 7.17511269287

Once we know the approximate points of intersection, we can start doing integration.

For an easy calculation, we can find the area between the two curves:

integral( g(x) - f(x), (x, 0.847680343978, 7.17511269287) );

In most volume calculations you would need the value of 'pi', which could be used as shown below:

integral( pi*( (g(x))^2 - (f(x))^2), (x, 0.847680343978, 7.17511269287));

To get a decimal approximation to the answer, we can add the .n() at the end of the 'integral' command:

integral( pi*( (g(x))^2 - (f(x))^2), (x, 0.847680343978, 7.17511269287)).n();