MAT421 - Lab 2


In [89]:
#%matplotlib notebook
%matplotlib inline
#%pylab inline
#init_session(use_unicode=True)
from __future__ import division
from sympy import *
x, y, z, t = symbols('x y z t', real=True)
k, m, n = symbols('k m n', integer=True)
f, g, h = symbols('f g h', cls=Function)
init_printing()

To run a cell: Shift+Enter.

To print:

  • Cell > Run All.
  • Make sure no there is no error.
  • File -> Print Preview. Print using the browser's print menu.

Print your name using print function.

Example: print("Ali bin Ahmad")


In [ ]:

Print your student id using print function.


In [ ]:


Define the functions f and g, find the intersections (if exists), plot the graph and find the enclosed area.

a) $f(x) = x^2 + 2$ and $g(x)=1-x$ between $x=0$ and $x=1$.

Define $f$ and $g$. Then, plot $f$ and $g$ on the same graph for $x\in[0,1]$.


In [ ]:

Calculate the enclosed area.


In [ ]:


b) $f(x) = x - 1$ and $g(x)=2x^3 - 1$ between $x=1$ and $x=2$.

Define $f$ and $g$. Then, plot $f$ and $g$ on the same graph for $x\in[1,2]$.


In [ ]:

Calculate the enclosed area.


In [ ]:

c) $f(x) = (x-1)^2$ and $g(x)=-x+3$.

Define $f$ and $g$. Then, find the $x$ value of the intersection point(s) of $f$ and $g$ using function "solve".


In [ ]:

Plot $f$ and $g$ on the same graph for $x\in[-1,2]$.


In [ ]:

Calculate the enclosed area.


In [ ]:


Define the functions f and g, find the intersections (if exists), plot the graph and find the volume of solids by DIsk (Washer).

a) $f(x) = \sqrt x$, $g(x) = x - 2$, $y = 0$. Revolve about $y=0$.

Define $f$ and $g$. Then, find the $x$ value of the intersection point(s) of $f$ and $g$ using function "solve".


In [ ]:

Plot $f$ and $g$ on the same graph for $x\in[0,4]$.


In [ ]:

Calculate the volume.


In [ ]:

Define the functions f and g, find the intersections (if exists), plot the graph and find the volume of solids by Cylindrical Shell Method.

a) $f(x) = x^2 + 1$, $g(x)=0$, $x=0$ and $x=2$. Revolve about $x=0$.

Define $f$ and $g$. Then, plot $f$ and $g$ on the same graph for $x\in[0,2]$.


In [ ]:

Calculate the volume.


In [ ]:

The End