# Revision history [back]

Given the example, it is pretty easy:

sage: K=var('K');
....: l=var('l');
....: x=var('x');
....: z(x)=(cosh(-1/2*K*l+K*x)-cosh(1/2*K*l))/K;


The derivative of z (with respect to the variable x) is:

sage: diff(z(x),x)
sinh(-1/2*K*l + K*x)


Since the only zeros of the sinh function is zero, solving $z'(x)=0$ is equivalent to solving $-1/2Kl + K*x=0$:

sage: solve(-1/2*K*l + K*x == 0, x)
[x == 1/2*l]


So, if there is an extrema, it can only be at $x=l/2$, but it is not sure.

However, since sinh changes its sign at 0, and since -1/2*K*l + K*x is affine, z' changes its sign at l/2 (when K is nonzero), hence the point $x=l/2$ is an extrema (hence, the only one). The nature of the extrema depends on the sign of K.

You can check with different values of K and l, e.g.:

sage: z.subs(K=2,l=2).plot([-1,2])
sage: z.subs(K=-2,l=2).plot([-1,2])
sage: z.subs(K=1,l=3).plot([-1,3])
sage: z.subs(K=-1,l=3).plot([-1,3])


Given the example, it is pretty easy:

sage: K=var('K');
....: l=var('l');
....: x=var('x');
....: z(x)=(cosh(-1/2*K*l+K*x)-cosh(1/2*K*l))/K;


The derivative of z (with respect to the variable x) is:

sage: diff(z(x),x)
sinh(-1/2*K*l + K*x)


Since the only zeros of the sinh function is zero, solving $z'(x)=0$ is equivalent to solving $-1/2Kl + K*x=0$:

sage: solve(-1/2*K*l + K*x == 0, x)
[x == 1/2*l]


EDIT Actually Sage knows about sinh:

sage: solve(diff(z(x),x)==0,x)
[x == 1/2*l]


So, if there is an extrema, it can only be at $x=l/2$, but it is not sure.

However, sure yet.

Now, since sinh changes its sign at 0, and since -1/2*K*l + K*x is affine, z' changes its sign at l/2 (when K is nonzero), hence the point $x=l/2$ is an extrema (hence, the only one). The nature of the extrema depends on the sign of K.

You can check with different values of K and l, e.g.:

sage: z.subs(K=2,l=2).plot([-1,2])
sage: z.subs(K=-2,l=2).plot([-1,2])
sage: z.subs(K=1,l=3).plot([-1,3])
sage: z.subs(K=-1,l=3).plot([-1,3])