u(x) is the height of the interface at a radius x from the axis of rotation,
g is the acceleration due to gravity,
rho is the density of water at room temperature,
R is the radius of the cylinder,
h is the lowest part of the curve =u(0),
h0 is the height of the water when the rotational velocity is zero,
omega is the rotational velocity,
K is the rotational kinetic energy = I * omega^2/2,
U is the gravitational potential energy,
V is the volume of the water after equilibrium is reached,
lambda is the Lagrange multiplier,
and E is the energy function to minimize.

> restart;

> U:=int(pi*rho*g*(x*(u(x)^2-h)),x=0..R);

U := int(pi*rho*g*x*(u(x)^2-h),x = 0 .. R)

> K:=-int(pi*omega^2*rho*x^3*(u(x)-h),x=0..R);

K := -int(pi*omega^2*rho*x^3*(u(x)-h),x = 0 .. R)

> V:=int(2*pi*u(x)*x,x=0..R);

V := int(2*pi*u(x)*x,x = 0 .. R)

> E:=K+U+lambda*V;

E := -int(pi*omega^2*rho*x^3*(u(x)-h),x = 0 .. R)+i...

> t1:=subs({u(x)=a1,diff(u(x),x)=a2},E);

t1 := -int(pi*omega^2*rho*x^3*(a1-h),x = 0 .. R)+in...

> t2:=subs(R=x,diff(t1,R));

t2 := -pi*omega^2*rho*x^3*(a1-h)+pi*rho*g*x*(a1^2-h...

> t3:=subs({a1=u(x),a2=diff(u(x),x)},diff(t2,a1))-diff(subs({a1=u(x),a2=diff(u(x),x)},diff(t2,a2)),x);

t3 := -pi*omega^2*rho*x^3+2*pi*rho*g*x*u(x)+2*lambd...

> u1:=solve(t3,u(x));

u1 := 1/2*(omega^2*rho*x^2-2*lambda)/rho/g

> constraint:=h0*R^2*pi=V;

constraint := h0*R^2*pi = int(2*pi*u(x)*x,x = 0 .. ...

> subs(u(x)=u1,constraint);

h0*R^2*pi = int(pi*(omega^2*rho*x^2-2*lambda)/rho/g...

> solve(%,lambda);

-1/4*(4*h0*g-omega^2*R^2)*rho

> lambda1:=%;

lambda1 := -1/4*(4*h0*g-omega^2*R^2)*rho

> u2:=subs(lambda=lambda1,u1);

u2 := 1/2*(omega^2*rho*x^2+1/2*(4*h0*g-omega^2*R^2)...

> simplify(%);

1/4*(2*omega^2*x^2+4*h0*g-omega^2*R^2)/g

>

>