## 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.
1. (21/3+41/3)3−6(21/3+41/3)=6
2. π /4 = 4arctan(1/5)−arctan(1/239)
3. sin(5x) = 5sin(x)−20sin3(x)+16sin5(x)
4. (tan(x)+tan(y))cos(x)cos(y) = sin(x+y)
5. cos6(x)+sin6(x) = 1−3sin2(x)cos2(x)
6. ln(tan(x/2+π/4)) = argsinh(tan(x))
Exercise 2  Transform the rational expression
 x4+x3−4x2−4x x4+x3−x2−x
into the following:
 (x+2)(x+1)(x−2) x3+x2−x−1
,
 x4+x3−4x2−4x x(x−1)(x+1)2
,
 (x+2)(x−2) (x−1)(x+1)
,
 x2 (x−1)(x+1)
 4 (x−1)(x+1)
.
Exercise 3  Transform the rational expression
2
 x3−yx2−yx+y2 x3−yx2−x+y
into the following
2
 x2−y x2−1
,   2
 x2−y (x−1)(x+1)
,
2−
 y−1 x−1
+
 y−1 x+1
,   2−2
 y−1 x2−1
.
Exercise 4  For each of the following definitions of a function f
f(x) =
 ex−1
,   f(x) =
1
x
 1+x2
,
f(x) =
 1 1+sin(x)+cos(x)
,   f(x) =
 ln(x) x(x2+1)2
.
1. Find an antiderivative F.
2. Find F′(x) and show that F′(x) can be simplified to f(x).
Exercise 5  For each of the following integrals
 −1 −2
 1 x
dx ,
 1 0
xarctan(xdx ,
 π/2 0

 cos(x)
dx ,
 π/2 0
x4sin(x)cos(xdx .
1. Find the exact value, and find an approximation.
2. For n=100 and n=1000, do the following. For each j=0,…,n, let xj=a+j(ba)/n and yj=f(xj). Find an approximate value for the integral by using the left endpoint rule:
 n−1 ∑ j=0
f(xj)(xj+1xj) .
3. Do the same as the previous part, except use the trapezoid method:
 n−1 ∑ j=0

 1 2
(f(xj)+f(xj+1))(xj+1xj) .
Exercise 6  Define the function f by f(x,y)=cos(xy).
1. Let x0=y0=π/4. Define the function that maps (u,v,t) to
 f(x0+ut,y0+vt) .
2. 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).
3. Find the gradient of f at (x0,y0), then find the scalar product of this gradient with the vector (u,v). Write this result in terms of g.
Exercise 7  Consider x3−(a−1)x2+a2xa3=0 as an equation in x.
1. Graph the solution x as a function of a using plotimplicit.
2. 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.)
3. 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.)
4. Find the solutions for a=0,1,2.
Exercise 8  For each of the limits
 lim x→ 0

 sin(x) x
,
 lim x→ 0+
(sin(x))1/x  ,
 lim x→ +∞
(1+1/x)x  ,
 lim x→ +∞
(2x+3x)1/x
1. Find the exact value.
2. 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.
1. f(x)=1/x.
2. f(x)=ex.
3. f(x)=1/sin(x).
4. f(x)=x/sin(x).
5. f(x)=sin(x)/x.
Exercise 10  Let f(x)=3x2+1+1/π4ln((π−x)2).
1. Verify that this function takes negative values on ℝ+. Graph the function over the interval [0,5].
2. Find є >0 such that Xcas gives the correct graph of the function over the interval [π−є,π+є].
Exercise 11
1. 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.
2. Same question for the interval [1,2].
3. 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.
1. The line y=x.
2. The graph of the function f :  x↦ 1/6+x/3+x2/2.
3. The tangent line to the graph of f at x=1.
4. The vertical line segment from the x-axis to the point where the graph of f intersects the line y=x, and a horizontal line segment from the y-axis to that point of intersection.
5. 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.
1. Functions fa(x) = xaex for a from −1 to 1.
2. Functions fa(x)=1/(xa)2 for a from −1 to 1.
3. Functions fa(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.

1.  x(t) = sin(t) y(t) = cos3(t)

2.  x(t) = sin(4 t) y(t) = cos3(6 t)

3.  x(t) = sin(132 t) y(t) = cos3(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 y2. You will need to have a 3-d geometry window open.
1. Use plotfunc to draw an informative graph, choosing an appropriate domain and number of steps.
2. Create an editable parameter a with assume. Draw the curve z=f(a,y) and vary the parameter with the mouse.
3. 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.
1. Draw the surface given by z=1−√x2+y2.
2. Sketch the parameterized surface defined by

 x(u,v) = u cos(v) y(u,v) = u sin(v) z(u,v) = 1−u .
3. 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 .
4. Draw the family of curves parameterized by

 x(t) = a cos(t) y(t) = a sin(t) z(t) = 1−a .
5. Draw the cone using the cone function.
Exercise 17
1. Generate a list ℓ of 100 integers randomly generated between 1 and 9.
2. Verify that all values in ℓ are in {1,…,9}.
3. Extract from the list ℓ all values greater than or equal to 5.
4. 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 [a0,…,an] created in the following way:
• let x0 = x.
• let a0 be the integer part of x0.
• let x1 = 1/(x0a0).
• for k=1,…,n, let ak be the integer part of xk and let xk+1 = 1/(xkak).
The list [a0,…,an] is associated with the fraction
un = a0+
1
a1+
1
a2+
1
⋱+
 1 an
For x∈{π,√2, e} and n∈ {5,10} :
1. Find [a0,…,an].
2. Compare your result with the value given by Xcas’s dfc function.
3. Find un and the numeric value of xun.
Exercise 19  Write (without using a loop) the following sequences:
1. The numbers from 1 to 3 in steps of 0.1.
2. The numbers from 3 to 1 in steps of −0.1.
3. The squares of the first 10 integers.
4. Numbers of the form (−1)n n2 for n=1,…,10.
5. 10 “0”s followed by 10 “1”s.
6. 3 “0”s followed by 3 “1”s, followed by 3 “2”,…, followed by 3 “9”s.
7. “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”.
8. 1 “1” followed by 2 “2”s, followed by 3 “3”s,…, followed by 9 “9”s.
Exercise 20
1. Define the following polynomials of degree 6.
1. A polynomial whose roots are the integers from 1 to 6.
2. A polynomial whose roots are 0 (triple root), 1 (double root) and 2 (simple root).
3. The polynomial (x2−1)3.
4. The polynomial x6−1.
2. 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
is
A =

 0 1 0 … 0 ⋮ ⋱ ⋱ ⋱ ⋮ ⋮ ⋱ ⋱ 0 0 … … 0 1 −a0 −a1 … −ad−1

.     (1)
3. Find the eigenvalues of the matrix A.
4. Find the characteristic polynomial of A.
Exercise 21
1. For variables a and b, write the square matrix A of order 4 with aj,k=a if j=k and aj,k=b if jk.
2. Find and factor the characteristic polynomial of A.
3. Find an orthogonal matrix P such that PT A P is a diagonal matrix.
4. Use your answer to the previous question to define the function that maps an integer n to the matrix An.
5. Find Ak for k=1,…,6 by finding the matrix products. Check that the function given in the previous part gives the same results.
Exercise 22
1. Find the square matrix N of order 6 given by nj,k=1 if k=j+1 and nj,k=0 if kj+1.
2. Find Np for p=1,…,6.
3. Write the matrix A = xI+N, where x is a variable.
4. Find Ap for p=1,…,6.
5. Find exp(At) as a function of x and t :
exp(At) = I+
 ∞ ∑ p=1
 tp p!
Ap .
Exercise 23  Define the following functions without using a loop.
1. 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 non-diagonal entries are equal to b.
2. The function g which takes as input an integer n and three real numbers a,b and cm and returns the matrix A=(aj,k)j,k=1,…,n whose diagonal elements are equal to a, whose terms aj,j+1 are equal to b and whose terms aj+1,j are equal to c, and whose remaining terms are 0.
3. The function H which takes as input an integer n and returns Hilbert’s Matrix; the matrix A=(aj,k)j,k=1,…,n where aj,k = 1/(j+k+1). Compare the execution time of your function with that of the hilbert function.
4. The function V which takes as input a vector x=[x1,…,xn] and returns Vandermonde’s Matrix; the matrix A=(aj,k)j,k=1,…,n where aj,k = xkj−1. Compare the execution time of your function with that of the vandermonde function.
5. The function T which takes as input a vector x=[x1,…,xn] and returns the Toeplitz Matrix; the matrix A=(aj,k)j,k=1,…,n where aj,k = x|jk|+1 .
Exercise 24  Write the following functions, which take as input a function f:ℝ → ℝ and three real numbers xmin, x0 and xmax with xminx0xmax.
1. derive : This function calculates and graphs the derivative of f over the interval [xmin,xmax] and returns f′(x0).
2. tangent : This function graphs the function f on the interval [xmin,xmax] and in the same window draws the tangent to the graph at x0. It returns the equation for the tangent line as a first degree polynomial.
3. araignee : This function graphs the function f on the [xmin,xmax], as well as the line y=x. It calculates and returns the first 10 iterates of f starting at x0 (so x1 = f(x0), x2 = f(x1),…). It also draws the sequence of segments, alternately vertical and horizontal, allowing you to visualize the iterations: segments joining (x0,0), (x0,x1), (x1,x1), (x1,x2), (x2,x2), …(compare this to the function plotseq)
4. newton_graph : This function graphs the function f over the interval [xmin,xmax]. It also calculates and returns the first ten iterates of the sequence starting at x0 given by Newton’s Method: x1=x0f(x0)/f′(x0), x2=x1f(x1)/f′(x1) …  (The values of the derivative should be approximated.) This function also graphs in the same window the segments displaying the iterations: segments joining (x0,0), (x0,f(x0)), (x1,0), (x1,f(x1)), (x2,0), (x2,f(x2)),…(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))=

 x 1+y
,
 y 1+x

.
1. Find the inverse of Φ.
2. Find and graph the image under Φ of the domain D: Δ=Φ(D).
3. 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.
4. Let J(z,t) be the determinant of the matrix B. Calculate and simplify J(z,t).
5. Evaluate
I1=
 D

 1+x+y (1+x)(1+y)

 3
dxdy .
6. Evaluate
I2=
 Δ
(1+z)(1+tdzdt ,
and verify that I1=I2.