Ask Your Question
1

Simplify logarithmic expression

asked 2024-09-12 13:54:04 +0100

kaba gravatar image

updated 2024-09-12 17:33:31 +0100

FrédéricC gravatar image

I am trying to simplify the expression

1/2 * log(2) - 1/2 * log(2 * x + 2 * sqrt(x^2 - 1))

under the assumptions that x is real, and x > 1. I expect

-1/2 * acosh(x)

I tried

with assuming(x, 'real', x > 1):
    print((1/2 * log(2) - 1/2 * log(2 * x + 2 * sqrt(x^2 - 1))).full_simplify())

However, that just prints back the original expression.

I would do this by hand as follows:

 1/2 * log(2) - 1/2 * log(2 * x + 2 * sqrt(x^2 - 1))
 = 1/2 * log(2) - 1/2 * log(2 * (x + sqrt(x^2 - 1)))
 = 1/2 * log(2) - 1/2 * log(2) - 1/2 * log(x + sqrt(x^2 - 1))
 = -1/2 * log(x + sqrt(x^2 - 1))
 = -1/2 * acosh(x)

How can I get SageMath to perform this simplification?

Even without the acosh simplification I would expect to get rid of the 1/2 * log(2) term.

edit retag flag offensive close merge delete

1 Answer

Sort by » oldest newest most voted
1

answered 2024-09-12 14:53:56 +0100

Emmanuel Charpentier gravatar image

updated 2024-09-12 16:34:05 +0100

Sage's simplify{_xxx}methods are known to be somewhat weaker than what is available in other interpreters. Try :

sage: (1/2 * log(2) - 1/2 * log(2 * x + 2 * sqrt(x^2 - 1)))._sympy_().simplify()._sage_()
-1/2*log(x + sqrt(x^2 - 1))
sage: (1/2 * log(2) - 1/2 * log(2 * x + 2 * sqrt(x^2 - 1)))._giac_().simplify()._sage_()
1/2*log(x - sqrt(x^2 - 1))
sage: (1/2 * log(2) - 1/2 * log(2 * x + 2 * sqrt(x^2 - 1)))._mathematica_().FullSimplify().sage()
-1/2*log(x + sqrt(x^2 - 1))

The acosh reexpression seems, however, unavailable in any of the interpreters I tried. Extending the current demoivre and exponentialize methods to inverse trigonometric and hyperbolic functions may be possible.

edit flag offensive delete link more

Comments

Yes, that seems to at least take care of the logarithm. Hopefully SageMath develops better simplification capability later.

kaba gravatar imagekaba ( 2024-09-12 20:06:30 +0100 )edit
1

An alternative command for the solution proposed by Emmanuel is

sage: s = 1/2 * log(2) - 1/2 * log(2 * x + 2 * sqrt(x^2 - 1))
sage: simplify(s, algorithm='sympy')
-1/2*log(x + sqrt(x^2 - 1))
eric_g gravatar imageeric_g ( 2024-09-13 11:35:15 +0100 )edit

Your Answer

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

Add Answer

Question Tools

1 follower

Stats

Asked: 2024-09-12 13:54:04 +0100

Seen: 198 times

Last updated: Sep 12