Ask Your Question
2

evaluating log(a/b) == log(a) - log(b)

asked 2 years ago

anonymous user

Anonymous

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?

Preview: (hide)

2 Answers

Sort by » oldest newest most voted
1

answered 2 years ago

eric_g gravatar image

You 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
Preview: (hide)
link
1

answered 2 years ago

Emmanuel Charpentier gravatar image

WorksForMe(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,

Preview: (hide)
link

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: 2 years ago

Seen: 240 times

Last updated: Oct 14 '22