ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 14 Oct 2022 16:24:12 +0200evaluating log(a/b) == log(a) - log(b)https://ask.sagemath.org/question/64366/evaluating-logab-loga-logb/ Hi there, I have entered the following,
a = var('a', domain='real')
b = var('b', domain='real')
assume(a > 0)
assume(b > 0)
stmt = log(a / b) == log(a) - log(b)
but when I do `bool(stmt)` it says False. Why is this? Did I miss some condition?Mon, 10 Oct 2022 03:04:16 +0200https://ask.sagemath.org/question/64366/evaluating-logab-loga-logb/Answer by eric_g for <p>Hi there, I have entered the following,</p>
<pre><code>a = var('a', domain='real')
b = var('b', domain='real')
assume(a > 0)
assume(b > 0)
stmt = log(a / b) == log(a) - log(b)
</code></pre>
<p>but when I do <code>bool(stmt)</code> it says False. Why is this? Did I miss some condition?</p>
https://ask.sagemath.org/question/64366/evaluating-logab-loga-logb/?answer=64444#post-id-64444You have to keep in mind that when checking for an identity, Sage returns `True` if it has been capable to prove the identity and `False` if either (i) Sage has been capable to disprove it or (ii) Sage has not been capable to prove or disprove it. So, a `False` output means either "false" or "unknown". For instance, on your example, we have
sage: bool(log(a / b) == log(a) - log(b))
False
sage: bool(log(a / b) != log(a) - log(b))
False
These two results seem contradictory, but here the two `False` actually mean "unknown". This state of affairs is due to `bool` implementing a bivalent logic, not a ternary one (which would have permit `Unknown` as a possible output).
As @Emmanuel_Charpentier explains in his answer, you have to help Sage by invoking `log_expand`:
sage: stmt = log(a / b) == log(a) - log(b)
sage: bool(stmt.log_expand())
True
Fri, 14 Oct 2022 16:24:12 +0200https://ask.sagemath.org/question/64366/evaluating-logab-loga-logb/?answer=64444#post-id-64444Answer by Emmanuel Charpentier for <p>Hi there, I have entered the following,</p>
<pre><code>a = var('a', domain='real')
b = var('b', domain='real')
assume(a > 0)
assume(b > 0)
stmt = log(a / b) == log(a) - log(b)
</code></pre>
<p>but when I do <code>bool(stmt)</code> it says False. Why is this? Did I miss some condition?</p>
https://ask.sagemath.org/question/64366/evaluating-logab-loga-logb/?answer=64443#post-id-64443WorksForMe(TM) on Sage 9.8.beta1:
sage: var("a, b")
(a, b)
sage: log(a/b).log_expand()
log(a) - log(b)
sage: log(a/b).log_expand().log_simplify()
log(a/b)
HTH,Fri, 14 Oct 2022 15:04:26 +0200https://ask.sagemath.org/question/64366/evaluating-logab-loga-logb/?answer=64443#post-id-64443