Solutions to the Practice Sets

Practice Set A

Problem 1

(a)

7  +  4  +  2

(b)

3^321

(c)

Here are the first 25 digits of (e^2).

N[E^2,  25]

And here are the first 25 digits of π.

N[Pi,  25]

(d)

N[{7/5,  141/100,  707/500,  Sqrt[2]}]

The best of the three approximations to (Sqrt[2]) is (707/500).

Problem 2

(a)

N[Cos[0.1],  15]

(b)

N[Log[2],  15]

(c)

N[ArcTan[1/2],  15]

Problem 3

Factor[x^4  -  y^4]

Problem 4

?FactorInteger

FactorInteger[123456789]

This means that 123456789 = (3^2)*3607*3803.

Problem 5

(a)

Simplify[1/(1  +  1/(1  +  1/x))]

(b)

Cos[x]^2  -  Sin[x]^2  // Simplify

Problem 6

(a)

Solve[8  x  +  3  ==  0,  x]

(b)

Solve[8  x  +  3.0  ==  0,  x]

(c)

We'll solve the quadratic equation, and then check the solutions.

quadraticsols  =  Solve[a*x^2  +  b*x  +  c  ==  0,  x]

Here's a way to check the solutions using the replacement operator.

a*x^2  +  b*x  +  c  /.  quadraticsols

Simplify[%]

Since the expression a(x^2) + bx + c evaluates to 0 when we substitute the values in quadraticsols for x, we have verified that the solutions in quadraticsols are correct.

(d)

Solve[{2  x  +  3  y  ==  7,  3  x  -  y  ==  2},  {x,  y}]

(e)

cubicsols  =  
      Solve[{x^2*y  +  3  x  -  2  y  ==  0,  x  +  y  ==  3}, 
         {x,  y}]

The solutions are rather complicated, because Mathematica is doing exact arithmetic, and the solutions involve cube roots.  Note that there are three solutions.  To check the solutions, we use the same method as in part (c).

Simplify[{x^2*y  +  3  x  -  2  y ,  x  +  y }  /.  
        cubicsols]

To get a decimal approximation of the solutions, we can type one of the numbers in the equations as a decimal, as follows.

Solve[{x^2*y  +  3  x  -  2  y  ==  0,  x  +  y  ==  3.0}, 
       {x,  y}]

If we check these solutions, however, we'll see that they are only approximately correct.

Simplify[{x^2*y  +  3  x  -  2  y,  x  +  y}  /.  %]

As you can see, for each of the three approximate solutions, the expression (x^2)y + 3x - 2y evaluates to something very close to 0 (on the order of (10^(-15)));  and the expression x + y evaluates to "3.", which means that it is equal to 3 up to 16 digits, the default precision used by Mathematica.

Problem 7

(a)

Plot[2  x  -  3,  {x,  -4,  4}];

(b)

Plot[x^2  -  x  +  2,  {x,  -4,  4}];

(c)

Plot[Sin[x],  {x,  0,  20  Pi}];

(d)

Plot[Tan[x/2],  {x,  -Pi,  Pi},  
      PlotRange  ->  {-10,  10}];

(e)

Plot[{Exp[(-x^2)/2],  x^4  -  x^2},  {x,  -2,  2}];

Problem 8

(a)

We start by defining the the function f to be the given polynomial expression.

f[x_]  =  
      x^6  -  21  x^5  +  175  x^4  -  735  x^3  +  1624  x^2  -  
        1764  x  +  720

(b)

f[0.5]f[Sqrt[2]]f[z^2]

(c)

Table[f[x], {x, 0.1, 1, 0.1}] // TableForm

(d)

Factor[f[x]]

(e)

Solve[f[x]  ==  0,  x]

Note that there are six distinct real roots.

(f)

Plot[f[x],  {x,  0.9,  6.1}];