8 Exercises
There are usually several ways to get the same result in
Xcas. We will try to use the simplest approaches.
Exercise 1 Verify the following identities.

(2^{1/3}+4^{1/3})^{3}−6(2^{1/3}+4^{1/3})=6
 π /4 = 4arctan(1/5)−arctan(1/239)
 sin(5x) = 5sin(x)−20sin^{3}(x)+16sin^{5}(x)
 (tan(x)+tan(y))cos(x)cos(y) = sin(x+y)
 cos^{6}(x)+sin^{6}(x) = 1−3sin^{2}(x)cos^{2}(x)
 ln(tan(x/2+π/4)) = argsinh(tan(x))
Exercise 2 Transform the rational expression
x^{4}+x^{3}−4x^{2}−4x 

x^{4}+x^{3}−x^{2}−x 

into the following:
(x+2)(x+1)(x−2) 

x^{3}+x^{2}−x−1 

,
 x^{4}+x^{3}−4x^{2}−4x 

x(x−1)(x+1)^{2} 

,
  ,

Exercise 3 Transform the rational expression
2  x^{3}−yx^{2}−yx+y^{2} 

x^{3}−yx^{2}−x+y 

into the following
Exercise 4 For each of the following definitions of a function
f

Find an antiderivative F.
 Find F′(x) and show that F′(x) can be simplified to f(x).
Exercise 5 For each of the following integrals
∫    √   dx ,
 ∫   x^{4}sin(x)cos(x) dx .


Find the exact value, and find an approximation.
 For n=100 and n=1000, do the following.
For each j=0,…,n, let x_{j}=a+j(b−a)/n and y_{j}=f(x_{j}).
Find an approximate value for the integral by using the left endpoint
rule:
 f(x_{j})(x_{j+1}−x_{j}) .

 Do the same as the previous part, except use the trapezoid
method:
   (f(x_{j})+f(x_{j+1}))(x_{j+1}−x_{j}) .

Exercise 6 Define the function
f by
f(
x,
y)=cos(
xy).

Let x_{0}=y_{0}=π/4. Define the function that maps (u,v,t) to
 Define the function g which is the partial derivative of the
preceding function with respect to t (so this will be a directional
derivative of f).
 Find the gradient of f at (x_{0},y_{0}), then find the scalar product
of this gradient with the vector (u,v). Write this result in terms
of g.
Exercise 7 Consider
x^{3}−(
a−1)
x^{2}+
a^{2}x−
a^{3}=0 as an equation in
x.

Graph the solution x as a function of a using plotimplicit.
 Find the three solutions of the equation. You can use rootof
to find the first solution, then use quo to factor out the
first solution. You can then find the last two solutions by solving
the resulting second degree equation. (You can use coeff to
find the discriminant of the equation.)
 For the values of a which give three real roots, graph each of the
roots in different colors on the same graph.
(You can use resultant to find the values of a for which the
equation has a multiple root; these values are the possible bounds of
intervals for a where each of the roots is real.)
 Find the solutions for a=0,1,2.
Exercise 8 For each of the limits
  
,
  (sin(x))^{1/x}
,
  (1+1/x)^{x}
,
  (2^{x}+3^{x})^{1/x}


Find the exact value.
 Find a value of x such that the distance from f(x) to the limit is
less than 10^{−3}.
Exercise 9 For each function
f, find ranges for the
x coordinates and the
y
coordinates that give the most informative graph.

f(x)=1/x.
 f(x)=e^{x}.
 f(x)=1/sin(x).
 f(x)=x/sin(x).
 f(x)=sin(x)/x.
Exercise 10 Let
f(
x)=3
x^{2}+1+1/π
^{4}ln((π−
x)
^{2}).

Verify that this function takes negative values on ℝ^{+}.
Graph the function over the interval [0,5].
 Find є >0 such that Xcas gives the correct graph of the
function over the interval [π−є,π+є].
Exercise 11

Graph the function exp(x) over the interval [−1,1].
On the same graph, plot the Taylor polynomials (of orders 1,2,3 and 4)
for this function centered at x=0.
 Same question for the interval [1,2].
 Graph the function sin(x) on the interval [−π,π].
On the same graph, plot the Taylor polynomials (of orders 1,3 and 5)
for this function centered at x=0.
Exercise 12 Plot the following graphs on the same window, with
x and
y
coordinates from 0 to 1.

The line y=x.
 The graph of the function f : x↦ 1/6+x/3+x^{2}/2.
 The tangent line to the graph of f at x=1.
 The vertical line segment from the xaxis to the point where the
graph of f intersects the line y=x, and a horizontal line segment
from the yaxis to that point of intersection.
 The labels “fixed point” and “tangent”, at the appropriate positions.
Exercise 13 The goal of this exercise is to graph a family of functions on the
same screen. You will need to choose the number of curves, the
interval to graph over to obtain the most informative graphic.

Functions f_{a}(x) = x^{a}e^{−x} for a from −1 to 1.
 Functions f_{a}(x)=1/(x−a)^{2} for a from −1 to 1.
 Functions f_{a}(x)=sin(ax), for a from 0 to 2.
Exercise 14 Graph each of the following curves. You will need to choose a range
of values for the parameter to make sure you have the complete graph.

⎧
⎨
⎩  x(t)  =  sin(t) 
y(t)  =  cos^{3}(t)



⎧
⎨
⎩  x(t)  =  sin(4 t) 
y(t)  =  cos^{3}(6 t)



⎧
⎨
⎩  x(t)  =  sin(132 t) 
y(t)  =  cos^{3}(126 t)



Exercise 15 The goal of this exercise is to visualize in different ways the
surface of the graph
z=
f(
x,
y)=
x y^{2}. You will need to have a
3d geometry window open.

Use plotfunc to draw an informative graph, choosing an
appropriate domain and number of steps.
 Create an editable parameter a with assume. Draw the curve
z=f(a,y) and vary the parameter with the mouse.
 Create an editable parameter b with assume. Draw the curve
z=f(x,b) and vary the parameter with the mouse.
Exercise 16 The goal of this exercise is to visualize a cone in different ways.

Draw the surface given by z=1−√x^{2}+y^{2}.
 Sketch the parameterized surface defined by
⎧
⎪
⎨
⎪
⎩  x(u,v)  =  u cos(v) 
y(u,v)  =  u sin(v) 
z(u,v)  =  1−u .



 For a sufficiently large value of a, draw the curve parameterized by
⎧
⎪
⎨
⎪
⎩  x(t)  =  t cos(a t) 
y(t)  =  t sin(a t) 
z(t)  =  1−t .



 Draw the family of curves parameterized by
⎧
⎪
⎨
⎪
⎩  x(t)  =  a cos(t) 
y(t)  =  a sin(t) 
z(t)  =  1−a .



 Draw the cone using the cone function.
Exercise 17

Generate a list ℓ of 100 integers randomly generated between 1 and 9.
 Verify that all values in ℓ are in {1,…,9}.
 Extract from the list ℓ all values greater than or equal to 5.
 For each k=1,…,9, find the number of values in ℓ which are
equal to k.
Exercise 18 For a real number
x, the continued fraction for
x of order
n is
a list of integers [
a_{0},…,
a_{n}] created in the following way:

let x_{0} = x.
 let a_{0} be the integer part of x_{0}.
 let x_{1} = 1/(x_{0}−a_{0}).
 for k=1,…,n, let a_{k} be the integer part of x_{k} and let
x_{k+1} = 1/(x_{k} − a_{k}).
The list [
a_{0},…,
a_{n}] is associated with the fraction
For
x∈{π,√
2,
e} and
n∈ {5,10} :

Find [a_{0},…,a_{n}].
 Compare your result with the value given by Xcas’s dfc
function.
 Find u_{n} and the numeric value of x−u_{n}.
Exercise 19 Write (without using a loop) the following sequences:

The numbers from 1 to 3 in steps of 0.1.
 The numbers from 3 to 1 in steps of −0.1.
 The squares of the first 10 integers.
 Numbers of the form (−1)^{n} n^{2} for n=1,…,10.
 10 “0”s followed by 10 “1”s.
 3 “0”s followed by 3 “1”s, followed by 3 “2”,…,
followed by 3 “9”s.
 “1” followed by 1 “0”, followed by a “2” followed by 2 “0”s,
…, followed by “8” followed by 8 “0”s, followed by “9”.
 1 “1” followed by 2 “2”s, followed by 3 “3”s,…,
followed by 9 “9”s.
Exercise 20

Define the following polynomials of degree 6.

A polynomial whose roots are the integers from 1 to 6.
 A polynomial whose roots are 0 (triple root), 1
(double root) and 2 (simple root).
 The polynomial (x^{2}−1)^{3}.
 The polynomial x^{6}−1.
 Write (without using the companion function)
the companion matrix A for each of the polynomials in (1).
Recall the the companion matrix for the polynomial
P=x^{d}+a_{d−1}x^{d−1}+⋯+a_{1}x+a_{0} ,

is
A =
 ⎛
⎜
⎜
⎜
⎜
⎜
⎜
⎝ 
 0  1  0  …   0 
⋮  ⋱  ⋱  ⋱   ⋮ 
     
⋮    ⋱  ⋱  0 
0  …   …  0  1 
−a_{0}  −a_{1}   …   −a_{d−1}


 ⎞
⎟
⎟
⎟
⎟
⎟
⎟
⎠  .
(1) 
 Find the eigenvalues of the matrix A.
 Find the characteristic polynomial of A.
Exercise 21

For variables a and b, write the square matrix A of order 4 with
a_{j,k}=a if j=k and a_{j,k}=b if j ≠ k.
 Find and factor the characteristic polynomial of A.
 Find an orthogonal matrix P such that P^{T} A P is a diagonal
matrix.
 Use your answer to the previous question to define the function that
maps an integer n to the matrix A^{n}.
 Find A^{k} for k=1,…,6 by finding the matrix products. Check
that the function given in the previous part gives the same results.
Exercise 22

Find the square matrix N of order 6 given by n_{j,k}=1 if
k=j+1 and n_{j,k}=0 if k ≠ j+1.
 Find N^{p} for p=1,…,6.
 Write the matrix A = xI+N, where x is a variable.
 Find A^{p} for p=1,…,6.
 Find exp(At) as a function of x and t :
Exercise 23 Define the following functions without using a loop.

The function f which takes as input an integer n and two real
numbers a and b and returns the n× n matrix A whose
diagonal terms are all equal to a and whose nondiagonal entries are
equal to b.
 The function g which takes as input an integer n and three real
numbers a,b and cm and returns the matrix
A=(a_{j,k})_{j,k=1,…,n} whose diagonal elements are equal to
a, whose terms a_{j,j+1} are equal to b and whose terms a_{j+1,j}
are equal to c, and whose remaining terms are 0.
 The function H which takes as input an integer n and returns
Hilbert’s Matrix; the matrix A=(a_{j,k})_{j,k=1,…,n} where
a_{j,k} = 1/(j+k+1).
Compare the execution time of your function with that of the
hilbert function.
 The function V which takes as input a vector x=[x_{1},…,x_{n}] and
returns Vandermonde’s Matrix; the matrix
A=(a_{j,k})_{j,k=1,…,n} where a_{j,k} = x_{k}^{j−1}.
Compare the execution time of your function with that of the
vandermonde function.
 The function T which takes as input a vector x=[x_{1},…,x_{n}] and
returns the Toeplitz Matrix; the matrix
A=(a_{j,k})_{j,k=1,…,n} where
a_{j,k} = x_{j−k+1} .
Exercise 24 Write the following functions, which take as input a function
f:ℝ
→ ℝ and three real numbers
x_{min},
x_{0} and
x_{max} with
x_{min}≤
x_{0} ≤
x_{max}.

derive :
This function calculates and graphs the derivative of f over the
interval [x_{min},x_{max}] and returns f′(x_{0}).
 tangent :
This function graphs the function f on the interval
[x_{min},x_{max}] and in the same window draws the tangent to the
graph at x_{0}. It returns the equation for the tangent line as a
first degree polynomial.
 araignee :
This function graphs the function f on the [x_{min},x_{max}], as
well as the line y=x. It calculates and returns the first 10
iterates of f starting at x_{0} (so x_{1} = f(x_{0}), x_{2} =
f(x_{1}),…). It also draws the sequence of segments, alternately
vertical and horizontal, allowing you to visualize the iterations:
segments joining (x_{0},0), (x_{0},x_{1}), (x_{1},x_{1}),
(x_{1},x_{2}), (x_{2},x_{2}), …(compare this to the function plotseq)
 newton_graph :
This function graphs the function f over the interval [x_{min},x_{max}].
It also calculates and returns the first ten iterates of the sequence
starting at x_{0} given by Newton’s Method: x_{1}=x_{0} −f(x_{0})/f′(x_{0}),
x_{2}=x_{1} − f(x_{1})/f′(x_{1}) … (The values of the derivative
should be approximated.) This function also graphs in the same window
the segments displaying the iterations: segments joining
(x_{0},0), (x_{0},f(x_{0})), (x_{1},0),
(x_{1},f(x_{1})), (x_{2},0), (x_{2},f(x_{2})),…(compare with the function newton)
Exercise 25 Let
D be the unit square
D=(0,1)
^{2}. Let Φ
be the function defined on
D by
Φ(x,y) = (z(x,y),t(x,y))=
 ⎛
⎜
⎜
⎝   ,   ⎞
⎟
⎟
⎠  .


Find the inverse of Φ.
 Find and graph the image under Φ of the domain D: Δ=Φ(D).
 Let A(x,y) be the Jacobian matrix of Φ at a point (x,y) in
D, and B(z,t) the Jacobian matrix of Φ^{−1} at a point
(x,y) in Δ. Calculate these two matrices, and verify that
B(Φ(x,y)) and A(x,y) are inverses of each other.
 Let J(z,t) be the determinant of the matrix B. Calculate and simplify
J(z,t).
 Evaluate
I_{1}=  ∬    ⎛
⎜
⎜
⎝    ⎞
⎟
⎟
⎠   dxdy .

 Evaluate
I_{2}=  ∬   (1+z)(1+t) dzdt ,

and verify that I_{1}=I_{2}.