Ask Your Question
2

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

asked 2022-10-10 03:04:16 +0200

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?

edit retag flag offensive close merge delete

2 Answers

Sort by ยป oldest newest most voted
1

answered 2022-10-14 15:04:26 +0200

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,

edit flag offensive delete link more
1

answered 2022-10-14 16:24:12 +0200

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
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

1 follower

Stats

Asked: 2022-10-10 03:04:16 +0200

Seen: 103 times

Last updated: Oct 14 '22