%	TEST ONE A, Eight marks
%
%	QUESTION ONE
>> syms x; g=((exp(1-x))/(1+(cos(2*x))^2))+sqrt(2*(x^2)+1)
>> pretty(g)
>> X= -2 : 0.5 : 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=y^3 + 3*exp(-3*x) + (3 - 2*x)/(1+2*log(abs(y-1)))
>> pretty(z)
>> zx=subs(z,x,-1.2);
>> zxy=subs(zx,y,-1.4);
>> zxy
%One Mark was given for getting the correct value.
%
%	QUESTION THREE
>> f=(x^3 - 2*x - 6)/(x^2 + 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.3;
>> 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= (-3*(x^3) + 3*x - 1)/((1-2*x)^3 + 2*(x^3));
>> pretty(limf)
>> limit(limf,inf)
%one mark was given for getting the correct value.

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

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

 
                          exp(1 - x)         2     1/2
                         ------------- + (2 x  + 1)
                                     2
                         1 + cos(2 x)

ans =

   -2.0000   17.0729
   -1.5000    8.4977
   -1.0000    8.0304
   -0.5000    4.6937
         0    2.3591
    0.5000    2.5009
    1.0000    2.5844
    1.5000    2.6515
    2.0000    3.2578

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

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

zxy =

  109.0137

f =
 
(x^3-2*x-6)/(x^2+4)

 
                                  3
                                 x  - 2 x - 6
                                 ------------
                                     2
                                    x  + 4
Current plot held
 
                            2           3
                         3 x  - 2     (x  - 2 x - 6) x
                         -------- - 2 ----------------
                           2               2     2
                          x  + 4         (x  + 4)
 
                   6934493818971937     5193731428180467883
                   ---------------- x + --------------------
                   9007199254740992     16735376215308763136
 
                                    3
                                -3 x  + 3 x - 1
                               -----------------
                                        3      3
                               (1 - 2 x)  + 2 x
 
ans =
 
1/2