# Can Sage verify (some) hyperbolic identities?

If I enter bool( cosh(x) == (exp(x)+exp(-x))/2 ), the output is False. This happens with other hyperbolic identities. Is it possible to verify them in Sage? If so, what is the correct way?

edit retag close merge delete

Sort by » oldest newest most voted

Hi,

As far as I know, there is no simple way to verify such identities with Sage yet. A related issue is that Sage is currently unable to simplify cosh(x) - (exp(x)+exp(-x))/2 to 0:

sage: (cosh(x) - (exp(x)+exp(-x))/2).simplify_full()
1/2*(2*cosh(x)*e^x - e^(2*x) - 1)*e^(-x)


But there is a workaround: the rewrite extension written by François Maltey. To use it, download the file rewrite-20110123.sage from this page; then in a Sage session, you may ask to rewrite the hyperbolic functions in terms of exp, so that the outcome of the check is now True:

sage: %runfile rewrite-20110123.sage
sage: bool( rewrite(cosh(x), 'sinhcosh2exp') == (exp(x)+exp(-x))/2 )
True


Equivalently, you may also ask to rewrite the whole identity:

sage: bool( rewrite(cosh(x) == (exp(x)+exp(-x))/2, 'sinhcosh2exp') )
True


See here for the documentation of rewrite. Hopefully, it shall be included in main Sage some day.

more

You might want to familiarize with the Maxima and SymPy parts of Sage. With Maxima you can do

sage: ex = cosh(x) - (exp(x)+exp(-x))/2
sage: ex._maxima_().exponentialize().sage()
0


Here the Maxima function exponentialize does the rewrite. In Sympy:

sage: ex = cosh(x) - (exp(x)+exp(-x))/2
sage: import sympy
sage: sympy.simplify(ex)
0

more