%	TEST ONE B, Eight marks
%
%	QUESTION ONE
>> syms x; g=(x^3 - sin(2*x))/(2+(cos(x))^2)
>> pretty(g)
>> X= -1 : 0.2 : 2;
>> Y=subs(g,X);
>> Xt=transpose(X); 			%One can also use Xt = X’
>> Yt=transpose(Y);			%But I prefer transpose(X).
>> [Xt Yt]
%One mark was given for getting the correct values.
%One mark was given for putting the values in a table.
%
%	QUESTION TWO
>> syms y;
>> z=x*y - (2*x-1)/(1+log(abs(x - y))) - exp(3*(x + y))
>> pretty(z)
>> zx=subs(z,x,1.2);
>> zxy=subs(zx,y,-1.5);
>> zxy
%One Mark was given for getting the correct value.
%
%	QUESTION THREE
>> f=(x^2 - x - 4)/(x^2 - x + 4)
>> pretty(f) 				%pretty is good to use for checking the 
>> ezplot(f,[-4 4])			%function input is correct.
>> hold
% >> xlabel('x label goes here')	Written later to prevent over writing.
% >> ylabel('y label goes here')
% >> title('title goes here')
%One mark was given for using ezplot correctly.
%One function was given for labelling the graph. If no graph was saved on 
%the disc half marks were given for correctly using the labelling commands .
%
>> df=diff(f);
>> pretty(df)
%One mark was given for obtaining the derivative.
%
>> x1 = -2;
>> m=subs(df,x1);
>> y1=subs(f,x1);
>> y=m*(x-x1)+y1;
>> pretty(y)
>> ezplot(y,[-4 4])
%One mark was given for plotting the tangent correctly.
%
>> xlabel('x label goes here')
>> ylabel('y label goes here')
>> title('title goes here')
%
%	QUESTION FOUR
>> limf= (-4 + (2/(x^2)) - (2/(x^3)))/((2-1/x)^3);
>> pretty(limf)
>> limit(limf,0)
%one mark was given for getting the correct value.

=======================================================================

Output for above:
g =
 
(x^3-sin(2*x))/(2+cos(x)^2)

 
                                  3
                                 x  - sin(2 x)
                                 -------------
                                            2
                                  2 + cos(x)

ans =

   -1.0000   -0.0396
   -0.8000    0.1962
   -0.6000    0.2671
   -0.4000    0.2294
   -0.2000    0.1288
         0         0
    0.2000   -0.1288
    0.4000   -0.2294
    0.6000   -0.2671
    0.8000   -0.1962
    1.0000    0.0396
    1.2000    0.4938
    1.4000    1.1874
    1.6000    2.0763
    1.8000    3.0583
    2.0000    4.0295

z =
 
x*y-(2*x-1)/(1+log(abs(x-y)))-exp(3*x+3*y)

 
                              2 x - 1
                   x y - ------------------ - exp(3 x + 3 y)
                         1 + log(| x - y |)

zxy =

   -2.9089

f =
 
(x^2-x-4)/(x^2-x+4)

                                   2
                                  x  - x - 4
                                  ----------
                                   2
                                  x  - x + 4
Current plot held
 
                                     2
                       2 x - 1     (x  - x - 4) (2 x - 1)
                      ---------- - ----------------------
                       2                 2         2
                      x  - x + 4       (x  - x + 4)
 
                                 - 2/5 x - 3/5
 
                                     2      2
                               -4 + ---- - ----
                                      2      3
                                     x      x
                               ----------------
                                           3
                                  (2 - 1/x)
 
ans =

2