Project 2

1687 days ago by henkemeyert5137

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); 
       
\newcommand{\Bold}[1]{\mathbf{#1}}\left[x = \frac{1}{2} \, {\left(20 \, x^{\left(\frac{3}{2}\right)} - 15\right)}^{\left(\frac{1}{3}\right)} {\left(i \, \sqrt{3} - 1\right)}, x = \frac{1}{2} \, {\left(20 \, x^{\left(\frac{3}{2}\right)} - 15\right)}^{\left(\frac{1}{3}\right)} {\left(-i \, \sqrt{3} - 1\right)}, x = {\left(20 \, x^{\left(\frac{3}{2}\right)} - 15\right)}^{\left(\frac{1}{3}\right)}\right]
\newcommand{\Bold}[1]{\mathbf{#1}}\left[x = \frac{1}{2} \, {\left(20 \, x^{\left(\frac{3}{2}\right)} - 15\right)}^{\left(\frac{1}{3}\right)} {\left(i \, \sqrt{3} - 1\right)}, x = \frac{1}{2} \, {\left(20 \, x^{\left(\frac{3}{2}\right)} - 15\right)}^{\left(\frac{1}{3}\right)} {\left(-i \, \sqrt{3} - 1\right)}, x = {\left(20 \, x^{\left(\frac{3}{2}\right)} - 15\right)}^{\left(\frac{1}{3}\right)}\right]

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); 
       
\newcommand{\Bold}[1]{\mathbf{#1}}\left[x = \frac{1}{2} i \, {\left(20 \, \sqrt{85} + 185\right)}^{\left(\frac{1}{3}\right)} \sqrt{3} - \frac{1}{2} \, {\left(20 \, \sqrt{85} + 185\right)}^{\left(\frac{1}{3}\right)}, x = -\frac{1}{2} i \, {\left(20 \, \sqrt{85} + 185\right)}^{\left(\frac{1}{3}\right)} \sqrt{3} - \frac{1}{2} \, {\left(20 \, \sqrt{85} + 185\right)}^{\left(\frac{1}{3}\right)}, x = {\left(20 \, \sqrt{85} + 185\right)}^{\left(\frac{1}{3}\right)}, x = \frac{1}{2} i \, {\left(-20 \, \sqrt{85} + 185\right)}^{\left(\frac{1}{3}\right)} \sqrt{3} - \frac{1}{2} \, {\left(-20 \, \sqrt{85} + 185\right)}^{\left(\frac{1}{3}\right)}, x = -\frac{1}{2} i \, {\left(-20 \, \sqrt{85} + 185\right)}^{\left(\frac{1}{3}\right)} \sqrt{3} - \frac{1}{2} \, {\left(-20 \, \sqrt{85} + 185\right)}^{\left(\frac{1}{3}\right)}, x = {\left(-20 \, \sqrt{85} + 185\right)}^{\left(\frac{1}{3}\right)}\right]
\newcommand{\Bold}[1]{\mathbf{#1}}\left[x = \frac{1}{2} i \, {\left(20 \, \sqrt{85} + 185\right)}^{\left(\frac{1}{3}\right)} \sqrt{3} - \frac{1}{2} \, {\left(20 \, \sqrt{85} + 185\right)}^{\left(\frac{1}{3}\right)}, x = -\frac{1}{2} i \, {\left(20 \, \sqrt{85} + 185\right)}^{\left(\frac{1}{3}\right)} \sqrt{3} - \frac{1}{2} \, {\left(20 \, \sqrt{85} + 185\right)}^{\left(\frac{1}{3}\right)}, x = {\left(20 \, \sqrt{85} + 185\right)}^{\left(\frac{1}{3}\right)}, x = \frac{1}{2} i \, {\left(-20 \, \sqrt{85} + 185\right)}^{\left(\frac{1}{3}\right)} \sqrt{3} - \frac{1}{2} \, {\left(-20 \, \sqrt{85} + 185\right)}^{\left(\frac{1}{3}\right)}, x = -\frac{1}{2} i \, {\left(-20 \, \sqrt{85} + 185\right)}^{\left(\frac{1}{3}\right)} \sqrt{3} - \frac{1}{2} \, {\left(-20 \, \sqrt{85} + 185\right)}^{\left(\frac{1}{3}\right)}, x = {\left(-20 \, \sqrt{85} + 185\right)}^{\left(\frac{1}{3}\right)}\right]

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) ); 
       
\newcommand{\Bold}[1]{\mathbf{#1}}90.8892074062
\newcommand{\Bold}[1]{\mathbf{#1}}90.8892074062

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)); 
       
\newcommand{\Bold}[1]{\mathbf{#1}}5353.88228001 \, \pi
\newcommand{\Bold}[1]{\mathbf{#1}}5353.88228001 \, \pi

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(); 
       
\newcommand{\Bold}[1]{\mathbf{#1}}16819.7172390732
\newcommand{\Bold}[1]{\mathbf{#1}}16819.7172390732
integral( 2*pi*( ((g(x)) - (f(x)))*x), (x, 0.847680343978, 7.17511269287)).n(); 
       
2139.66868480830
2139.66868480830
integral( 2*pi*( ((g(x)) - (f(x)))*(10-x)), (x, 0.847680343978, 7.17511269287)).n(); 
       
3571.06864075260
3571.06864075260
integral( pi*( (g(x)+3)^2 - (f(x)+3)^2), (x, 0.847680343978, 7.17511269287)).n(); 
       
18532.9384367415
18532.9384367415
integral( 2*pi*( ((g(x)) - (f(x)))*(x+5)), (x, 0.847680343978, 7.17511269287)).n(); 
       
4995.03734758875
4995.03734758875
integral( pi*( (62-f(x))^2 - (62-g(x))^2), (x, 0.847680343978, 7.17511269287)).n(); 
       
18586.8541794043
18586.8541794043
a(x)=x^2 + 15/x; b(x)=10*sqrt(x+1)+(4/x)*cos(x^2); 
       
xmin=0.5; xmax=6; ymax=100; plot_a = plot(a(x),(x,xmin,xmax),color='blue'); plot_b = plot(b(x),(x,xmin,xmax),color='red',fill=a(x),fillcolor='green'); show(plot_a + plot_b); 
       
solve( a(x) == b(x), x); 
       
[x == -1/2*(I*sqrt(3) + 1)*(1/6*sqrt(-4000/3*(x + 1)^(3/2) +
144*cos(x^2)^2 - 1080*cos(x^2) + 2025) + 2*cos(x^2) - 15/2)^(1/3) +
1/3*(5*I*sqrt(3) - 5)*sqrt(x + 1)/(1/6*sqrt(-4000/3*(x + 1)^(3/2) +
144*cos(x^2)^2 - 1080*cos(x^2) + 2025) + 2*cos(x^2) - 15/2)^(1/3), x ==
-1/2*(-I*sqrt(3) + 1)*(1/6*sqrt(-4000/3*(x + 1)^(3/2) + 144*cos(x^2)^2 -
1080*cos(x^2) + 2025) + 2*cos(x^2) - 15/2)^(1/3) + 1/3*(-5*I*sqrt(3) -
5)*sqrt(x + 1)/(1/6*sqrt(-4000/3*(x + 1)^(3/2) + 144*cos(x^2)^2 -
1080*cos(x^2) + 2025) + 2*cos(x^2) - 15/2)^(1/3), x ==
(1/6*sqrt(-4000/3*(x + 1)^(3/2) + 144*cos(x^2)^2 - 1080*cos(x^2) + 2025)
+ 2*cos(x^2) - 15/2)^(1/3) + 10/3*sqrt(x + 1)/(1/6*sqrt(-4000/3*(x +
1)^(3/2) + 144*cos(x^2)^2 - 1080*cos(x^2) + 2025) + 2*cos(x^2) -
15/2)^(1/3)]
[x == -1/2*(I*sqrt(3) + 1)*(1/6*sqrt(-4000/3*(x + 1)^(3/2) + 144*cos(x^2)^2 - 1080*cos(x^2) + 2025) + 2*cos(x^2) - 15/2)^(1/3) + 1/3*(5*I*sqrt(3) - 5)*sqrt(x + 1)/(1/6*sqrt(-4000/3*(x + 1)^(3/2) + 144*cos(x^2)^2 - 1080*cos(x^2) + 2025) + 2*cos(x^2) - 15/2)^(1/3), x == -1/2*(-I*sqrt(3) + 1)*(1/6*sqrt(-4000/3*(x + 1)^(3/2) + 144*cos(x^2)^2 - 1080*cos(x^2) + 2025) + 2*cos(x^2) - 15/2)^(1/3) + 1/3*(-5*I*sqrt(3) - 5)*sqrt(x + 1)/(1/6*sqrt(-4000/3*(x + 1)^(3/2) + 144*cos(x^2)^2 - 1080*cos(x^2) + 2025) + 2*cos(x^2) - 15/2)^(1/3), x == (1/6*sqrt(-4000/3*(x + 1)^(3/2) + 144*cos(x^2)^2 - 1080*cos(x^2) + 2025) + 2*cos(x^2) - 15/2)^(1/3) + 10/3*sqrt(x + 1)/(1/6*sqrt(-4000/3*(x + 1)^(3/2) + 144*cos(x^2)^2 - 1080*cos(x^2) + 2025) + 2*cos(x^2) - 15/2)^(1/3)]
print find_root( a(x) == b(x), 0.1, 2); print find_root( a(x) == b(x), 4, 5); 
       
0.963115111089
4.50138314901
0.963115111089
4.50138314901
integral( b(x) - a(x), (x, 0.966779736994, 4.50138314901) ); 
       
Ei(-20671688565969529/1020196881751441*I) -
Ei(-16092076089049/17216980942225*I) -
Ei(16092076089049/17216980942225*I) +
Ei(20671688565969529/1020196881751441*I) + 14.4607111519
Ei(-20671688565969529/1020196881751441*I) - Ei(-16092076089049/17216980942225*I) - Ei(16092076089049/17216980942225*I) + Ei(20671688565969529/1020196881751441*I) + 14.4607111519
integral( b(x) - a(x), (x, 0.966779736994, 4.50138314901)).n(); 
       
13.9588810655777
13.9588810655777
integral(pi*((b(x))^2 - (a(x))^2), (x, 0.966779736994, 4.50138314901)).n(); 
       
1467.85904347485
1467.85904347485
integral( 2*pi*(((b(x)) - (a(x)))*x), (x, 0.966779736994, 4.50138314901)).n(); 
       
242.354464832591
242.354464832591
integral( 2*pi*(((b(x))-(a(x)))*(10-x)), (x, 0.966779736994, 4.50138314901)).n(); 
       
634.707899326458
634.707899326458
integral(pi*((b(x)+3)^2 - (a(x)+3)^2), (x, 0.966779736994, 4.50138314901)).n(); 
       
1730.97775272256
1730.97775272256
integral( 2*pi*(((b(x))-(a(x)))*(x+5)), (x, 0.966779736994, 4.50138314901)).n(); 
       
680.885646912116
680.885646912116
integral(pi*((62-a(x))^2 - (62-b(x))^2), (x, 0.966779736994, 4.50138314901)).n(); 
       
3969.92761431127
3969.92761431127