Ask Your Question
1

Can Sage verify (some) hyperbolic identities?

asked 2015-07-24 14:35:00 +0100

f9qMRIktzYLG gravatar image

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 flag offensive close merge delete

2 Answers

Sort by » oldest newest most voted
2

answered 2015-07-24 21:54:31 +0100

eric_g gravatar image

updated 2015-07-26 10:01:42 +0100

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.

edit flag offensive delete link more
2

answered 2015-07-26 15:29:13 +0100

rws gravatar image

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
edit flag offensive delete link more

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 2015-07-24 14:35:00 +0100

Seen: 605 times

Last updated: Jul 26 '15