# Lab sheet 11

## Miscellaneous problems

Exercise 1.1

r0:0.0945$ x0:-0.1225$ y0:0.7449$

wxdraw2d(
   proportional_axes=xy,nticks=200,
    axis_top=false,axis_bottom=false,axis_left=false,axis_right=false,xtics=false,ytics=false,
   parametric(cos(t)/2-cos(2*t)/4,sin(t)/2-sin(2*t)/4,t,0,2*%pi),
   parametric(-1+cos(t)/4,sin(t)/4,t,0,2*%pi), 
   parametric(x0+r0*cos(t),r0*sin(t)+y0,t,0,2*%pi),
   parametric(x0+r0*cos(t),r0*sin(t)-y0,t,0,2*%pi)
);

Exercise 1.2

apply(wxdraw2d,append(
    [proportional_axes=xy,color=red],
    makelist(implicit(abs(x)^n+abs(y)^n=n^(n/2),x,-3,3,y,-3,3),n,1,9)
));

Exercise 1.3

wxdraw2d(points(makelist([n,50^n/n!],n,1,100)));

Exercise 1.4

N:10$
f(t):=realpart(bfzeta(1/2+%i*t,N));
g(t):=imagpart(bfzeta(1/2+%i*t,N));

f(7);

wxplot2d([f(t),g(t)],[t,0,50],[legend,"Re","Im"]);

wxdraw2d(
  proportional_axes = xy,
  nticks=500,
  parametric(f(t),g(t),t,0,50)
);

Exercise 1.5

y:exp(-1/x);

dy: makelist(factor(diff(y,x,n)),n,0,5);

wxplot2d(dy,[x,0.00001,1],[legend,false]);

kill(y,dy)$

Exercise 1.6

expand((x+y+z)^3-3*(x+y+z)*(x*y+y*z+z*x)+3*x*y*z);

Exercise 1.7

expand((x+1)^3-3*(x+1)^2+3*(x+1)-1);

expand((x+1)^4-4*(x+1)^3+6*(x+1)^2-4*(x+1)+1);

expand((x+1)^5-5*(x+1)^4+10*(x+1)^3-10*(x+1)^2+5*(x+1)-1);

p(n) := sum(binomial(n,i)*(-1)^i*(x+1)^(n-i),i,0,n);

p(10);

expand(p(10));

kill(p)$

Exercise 1.8

assume(u>0,v>0,w>0,x>0,y>0);

A:(1/u+1/v)/(1/x+1/y);
B:(u*x/v+x)/(u*x/y+u);
C:(x-y)*(u/v-v/u)/((u-v)*(x/y-y/x));
D:(x^2+y^2)*(u/v-v/u)/((u^2+v^2)*(x/y-y/x));
E:(u^3*x*y+u^2*v*x*y)/(u^3*v*x+u^3*v*y);

factor(A-B);factor(A-C);factor(A-E);

factor(A/D);

kill(A,B,C,D,E)$

Exercise 1.9

X:(2+cos(a))*cos(b);
Y:(2+cos(a))*sin(b);
Z:sin(a);
U:(X^2+Y^2+Z^2-5)/4;
V:X/(X^2+Y^2);

trigsimp(U);

trigsimp(V);

kill(X,Y,Z,U,V)$

Exercise 1.10

x: 2*u/(u^2+v^2+1);
y: 2*v/(u^2+v^2+1);
z:(u^2+v^2-1)/(u^2+v^2+1);
r: sqrt(x^2+y^2+z^2);
w:x/(1-z);

factor(r);

factor(w);

kill(x,y,z,r,w)$

Exercise 1.11

assume(a>0,b>0,c>0,x>0,y>0,z>0);

expand((x^(a*b)*x^(b*c)*x^(c*a))^(1/(a*b*c)));

factor(((x/y)/z)/(x/(y/z)));

expand((x+1)^6-6*x*(x+1)^4+9*x^2*(x+1)^2);

factor((2/x^3 + 2/(x^9-x^3))  - (1/(x^3-1) + 1/(x^3+1)));

factor(subst(z = (p*x+q*y)/(p+q),  (p*x+q*y+r*z)/(p+q+r)  - z));

## Solitons

q: sqrt(2); p: log(3+2*q); r: x-4*t; s: q*(x-8*t);
T: 32*cosh(2*r-p) + 16*cosh(2*s-p) + 16;
B: 4*(1+q)*cosh(r)*cosh(s)+(4*q-8)*exp(r+s);
phi[0]: 2/cosh(r)^2;
phi[1]:4/cosh(s)^2;
phi[2]:2/cosh(r-p)^2;
phi[3]:4/cosh(s-p)^2;
phi[4]:T/B^2;

makelist(factor(exponentialize(diff(phi[k],t)+diff(phi[k],x,3)+6*phi[k]*diff(phi[k],x))),k,0,3);

err: diff(phi[4],t)+diff(phi[4],x,3)+6*phi[4]*diff(phi[4],x)$

err: exponentialize(err)$

err:num(factor(err))$

err: args(args(err)[1])[3]$

ev(subst([x=1.2,t=-0.7],err),numer);

length(args(err));

subst([
        %e^(2^(7/2)*x+2^(5/2)*x+4*x+2^(9/2)*t+8*t)=E1,
        %e^(2^(7/2)*x+2^(5/2)*x+2*x+2^(9/2)*t+16*t)=E2,
        %e^(2^(7/2)*x+2^(3/2)*x+4*x+2^(11/2)*t+8*t)=E3,
        %e^(2^(7/2)*x+2^(3/2)*x+2*x+2^(11/2)*t+16*t)=E4,
        %e^(2^(7/2)*x+6*x+2^(11/2)*t+2^(9/2)*t)=E5,
        %e^(2^(7/2)*x+6*x+3*2^(9/2)*t)=E6,
        %e^(2^(7/2)*x+4*x+2^(11/2)*t+2^(9/2)*t+8*t)=E7,
        %e^(2^(7/2)*x+4*x+3*2^(9/2)*t+8*t)=E8,
        %e^(2^(7/2)*x+2*x+2^(11/2)*t+2^(9/2)*t+16*t)=E9,
        %e^(2^(7/2)*x+2*x+3*2^(9/2)*t+16*t)=E10,
        %e^(2^(7/2)*x+2^(11/2)*t+2^(9/2)*t+24*t)=E11,
        %e^(2^(7/2)*x+3*2^(9/2)*t+24*t)=E12,
        %e^(3*2^(5/2)*x+4*x+2^(9/2)*t+8*t)=E13,
        %e^(3*2^(5/2)*x+2*x+2^(9/2)*t+16*t)=E14,
        %e^(2^(5/2)*x+3*2^(3/2)*x+4*x+2^(11/2)*t+8*t)=E15
   ],err);