MAT421 - Lab 1a


In [162]:
%matplotlib notebook
#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 your name using print function.

Example: print("Ali bin Ahmad")


In [ ]:

Print your student id using print function.


In [ ]:

Sketch the graph of $\displaystyle f(x) = x^3 + 1$.

Define function f.

Example: f = x + 4


In [ ]:

x-intercepts. When $y=0$, $x=?$.

Use function solve (Sympy Docs pg. 1462).


In [ ]:

x-intercept:

Answer:

y-intercepts. When $x=0$, $y=?$

Use function subs (Sympy Docs pg. 15).


In [ ]:

y-intercept:

Answer:

Critical Value(s)

Find the first derivative, $f'(x)$, and assign it to variable called f1.

Use function diff (Sympy Docs pg. 37).

Print f1 using function pprint (Sympy Docs pg. 22).


In [ ]:

Solve $f'(x)=0$.

Use function solve (Sympy Docs pg. 1462).


In [ ]:

Critical value:

Answer: x=0

Interval of decreasing/increasing.

$f'(x<c)$

Use function subs (Sympy Docs pg. 15).


In [ ]:

The function is

Answer:

$f'(x>c)$

Use function subs (Sympy Docs pg. 15).


In [ ]:

The function is

Answer:

Maximum or Minimum point

Find the second derivative, $f''(x)$, and assign it to variable called f2.

Use function diff (Sympy Docs pg. 37).

Print f2 using function pprint.


In [ ]:

Find the value of $f''$ at the critical value.

Use function subs (Sympy Docs pg. 15).


In [ ]:

The point is (maximum / minimum / neither)

Answer:

Concavity

Solve the second derivative equation for $x$.

Use function solve (Sympy Docs pg. 1462).


In [ ]:

$f''(x < c)$

Use function subs (Sympy Docs pg. 15).


In [ ]:

The function is

Answer:

$f''(x > c)$

Use function subs (Sympy Docs pg. 15).


In [ ]:

The function is

Answer:

Plot the function

Use function plot to plot the function (Sympy Docs pg. 1264).


In [ ]: