# Lab sheet 5

Exercise 1

q(x) := %gamma + log(log(x)) + log(x) * hypergeometric([1,1],[2,2],log(x));

wxplot2d(q(x),[x,1.0001,10],[ylabel,"q(x)"]);

Q(x,h) := (q(x+h) - q(x))/h;

fpprec:30;

ev(Q(exp( 2),0.01),numer);
ev(Q(exp(-2),0.01),numer);
ev(Q(exp( 4),0.01),numer);

wxplot2d([Q(x,0.02),1/log(x)],[x,1.2,3],[legend,"q'(x)","1/log(x)"]);

kill(q,Q)$

Exercise 2

f(x) := x^3 - x;

wxplot2d(f(x),[x,-1.2,1.2]);

solve(f(x),x);

df0: diff(f(x),x)$ df(x) := ''df0;

solve(df(x),x);

wxplot2d([f(x),df(x)],[x,-1.2,1.2],[legend,"f(x)","f'(x)"]);

g(x) := sin(x) + sin(3*x)/3;
dg0 : diff(g(x),x)$ dg(x) := ''dg0;

wxplot2d([g(x),dg(x)],[x,-3*%pi,3*%pi],[legend,"g(x)","g'(x)"]);

h(x) := tan(x);
dh0: diff(h(x),x)$ dh(x) := ''dh0; 

wxplot2d([h(x),dh(x)],[x,-3/2*%pi,3/2*%pi],[y,-10,10],[legend,"h(x)","h'(x)"]);

kill(f,df0,df,g,dg0,dg,h,dh0,dh)$

Exercise 3

S(y) := diff(y,x,3)/diff(y,x) - 3/2 * (diff(y,x,2)/diff(y,x))^2; 

factor(S(x^n));

factor(S((a*x+b)/(c*x+d)));

factor(S((a*p^x+b)/(c*p^x+d)));

T(u) := sqrt(diff(u,x)) * diff(1/sqrt(diff(u,x)),x,2);

TS(u) := factor(T(u)/S(u));

TS(x^n);

TS(sin(x)^2);

TS(exp(x));

TS(u(x));

kill(S,T,TS)$

Exercise 4

f(x) := cos(-2*log(x));

wxplot2d(f(x),[x,0,0.01]);

wxplot2d(y,[x,0,1000]);

a0:exp(-%pi/4)$    m0:subst(x=a0,diff(f(x),x))$
a1:exp(-3*%pi/4)$ m1:subst(x=a1,diff(f(x),x))$
a2:exp(-5*%pi/4)$ m2:subst(x=a2,diff(f(x),x))$
a3:exp(-7*%pi/4)$ m3:subst(x=a3,diff(f(x),x))$

wxplot2d([f(x),m0*(x-a0),m1*(x-a1),m2*(x-a2),m3*(x-a3)],[x,0,0.5],[y,-2.5,2.5],[legend,false]);