%	TEST ONE A, Eight marks
%
%	QUESTION ONE
>> syms x; g = sin(x^2) - (x)/(2+(sin(x))^2)
>> pretty(g)
>> X= -2 : 0.25 : 1;
>> 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=exp(-2*x) + (x^2 - y)^2 + (y - 3)/(1+log(abs(2*x)))
>> pretty(z)
>> zx=subs(z,x,-1.4);
>> zxy=subs(zx,y,-1.5);
>> zxy
%One Mark was given for getting the correct value.
%
%	QUESTION THREE >> f=(x^2 + 2*x + 9)/(x^2 + x + 7)
>> pretty(f)
>> ezplot(f,[-3 3])
>> 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 = -1.5;
>> m=subs(df,x1);
>> y1=subs(f,x1);
>> y=m*(x-x1)+y1;
>> pretty(y)
>> ezplot(y,[-3 3])
%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 - 5*x - 4*(x^3))/(2*(2*x-1)^3);
>> pretty(limf)
>> limit(limf,inf)
%one mark was given for getting the correct value.

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

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

 
                                  2         x
                             sin(x ) - -----------
                                                 2
                                       2 + sin(x)

ans =

   -2.0000   -0.0493
   -1.7500    0.6686
   -1.5000    1.2789
   -1.2500    1.4309
   -1.0000    1.2107
   -0.7500    0.8376
   -0.5000    0.4716
   -0.2500    0.1837
         0         0
    0.2500   -0.0588
    0.5000    0.0232
    0.7500    0.2290
    1.0000    0.4722

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

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

zxy =

   26.1991

f =
 
(x^2+2*x+9)/(x^2+x+7)

 

                                  2
                                 x  + 2 x + 9
                                 ------------
                                   2
                                  x  + x + 7
Current plot held
 
                                    2
                      2 x + 2     (x  + 2 x + 9) (2 x + 1)
                     ---------- - ------------------------
                      2                  2         2
                     x  + x + 7        (x  + x + 7)
 
                                 140     1233
                                 --- x + ----
                                 961     961
 
                                               3
                                  3 - 5 x - 4 x
                              1/2 --------------
                                             3
                                    (2 x - 1)
 
ans =
 
-1/4