Lab 2

Questions 1 and 2 are 2 marks,
Questions 3 and 4  are 1 mark,
Question 5 is 4 marks.
Total 10 marks

1.

D[Sin[x], x]

D[x^x,  x]

D[x^3 - 3  x*y^2, y]

D[ArcCos[x],  {x, 2}]

D[ (x + I*y)^3,  {x, 2}]  +  
      D[(x + I*y)^3,  {y, 2}]

D[f[x^2], x]

2.

Integrate[x, x]

Integrate[Sin[x],  x]

Integrate[ (1 + E^x)^(-1),  x]

Integrate[ (x (2  x*
                  Exp[3  x^2]*(x - (1 + x + 2  x^2 + 2  x^3)*
                        Log[1 + x])  +  (x^2*Exp[2  x^2]  -  
                      Log[1 + x]^2)^2))/((1 + 
                x) (-x^2 Exp[2  x^2]  +  Log[1 + x]^2)^2),  
      x]

Integrate[x/(1 + E^x),  x]

Polylog[ ] is a special, nonelementary functions.  Elementary functions are power, sine, cosine, expoential, and log, and any combinations.

Integrate[ (6  x^5 + 6  x^4 - 8  x^3 - 18  x^2 + 8  x + 
            8)/(x^6 - 5  x^4 - 8  x^3 - 2  x^2 + 2  x + 1),  
      x]

The RootSum here means the expresssion:
(Subscript[((∑^6)), i = 1]) (4 Log[x - (Subscript[r, i])] + 4 Log[x - (Subscript[r, i])] (Subscript[r, i]) - 
            9 Log[x - (Subscript[r, i])] ((Subscript[r, i])^2) - 4 Log[x - (Subscript[r, i])] ((Subscript[r, i])^3) + 
            3 Log[x - (Subscript[r, i])] ((Subscript[r, i])^4) + 3 Log[x - (Subscript[r, i])] ((Subscript[r, i])^5))/(1 - 
            2 (Subscript[r, i]) - 12 ((Subscript[r, i])^2) - 10 ((Subscript[r, i])^3) + 3 ((Subscript[r, i])^5))
where (Subscript[r, i]) is the ith root the the polynomial in the first argument of Rootum[ ].

3.

NSolve[x^5 + 5  x^4 + 4  x^3 + 3  x^2 + 2  x + 1  ==  0,  x,  
      30]

4.

res  =  
      Solve[{y^2 + x^2 - y - 3  x == 0,  
          y^2 - 6  x*y - x^2 + 11  y + 7  x - 12  == 0},  {x, 
          y}]

To verify we do

{ y^2 + x^2 - y - 3  x,  
        y^2 - 6  x*y - x^2 + 11  y + 7  x - 12}  /.  res

5.

f[x_]  := 1/(x^2 + 1)

Plot[f[x], {x, -2, 2}]

fac[n_Integer]  :=  
        Infinity  /;  n  <  0 ;
fac[0]  :=  1;
fac[n_Integer]  :=  n*fac[n - 1]

{fac[-1], fac[0],  fac[5]}

gcd[a_Integer]  :=  a;
gcd[a_Integer, 0]  :=  a;
gcd[a_Integer,  b_Integer]  :=  
        gcd[b,  Mod[a, b]];
gcd[a_Integer,  b_Integer,  c__]  :=  gcd[a, gcd[b, c]]

{gcd[3], gcd[10, 2, 8], gcd[5, 10],  gcd[12, 6, 4, 2]}

If norecusive definition is used and program is long, we'll  minus 1 mark.