Ask Your Question
0

Why don't log rules work for symbolic values?

asked 2021-04-19 06:17:20 +0100

cybervigilante gravatar image

updated 2021-04-19 06:17:58 +0100

Log rules are working for actual values, but fail for symbolic ones. What am I doing wrong?

var('a b')
c = bool(log(a*b) == log(a) + log(b));print(c)
c = bool(log(5*3) == log(5) + log(3));print(c)
c = log(5*3).n(); print(c)
c = log(5).n() + log(3).n(); print(c)

False
False
2.70805020110221
2.70805020110221
edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
0

answered 2021-04-19 09:23:29 +0100

Emmanuel Charpentier gravatar image

Log rules do workfor symbolic values ; they just aren't autimatically applied :

sage: var("a, b")
(a, b)
sage: bool(log(a*b)==log(a)+log(b))
False
sage: bool((log(a*b)==log(a)+log(b)).log_expand())
True

HTH,

edit flag offensive delete link more

Comments

Thanks. Although I was surprised that the log_expand method distributed over the equivalence statement. But this appears to be generally true, which is useful, so thanks again:

In: x = 5*(log(a*b)==log(a)+log(b)); x

Out:  5*log(a*b) == 5*log(a) + 5*log(b)
cybervigilante gravatar imagecybervigilante ( 2021-04-20 02:12:55 +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: 2021-04-19 06:17:20 +0100

Seen: 189 times

Last updated: Apr 19 '21