Processing math: 100%
Ask Your Question
0

Law of logs false for symbols but true for numbers

asked 4 years ago

cybervigilante gravatar image

updated 4 years ago

Why do I get False for the additive law of logs for symbols, but True for numbers?

var('a b') 
print(bool(log(a)+log(b)==log(a*b))) 
print(bool(log(5)+log(10)==log(5*10))) 

False
True
Preview: (hide)

Comments

And how do I delete a comment?

cybervigilante gravatar imagecybervigilante ( 4 years ago )

1 Answer

Sort by » oldest newest most voted
0

answered 4 years ago

tmonteil gravatar image

As you can see with its source code (by typing log??), the log function first tries to call the .log method, which is different from symbolic expressions and for Sage integers, so there is no contradiction here.

What you are pointing here is the fact that when the symbolic ring is not able to prove something, it considers it as False. Here, False means False or Unknown. I admit that such a trivial case should be dealt with.

As a workaround, you can help the symbolic ring to prove the equality by expanding the logs:

sage: print(bool((log(a)+log(b)==log(a*b)).simplify_log()))                                                                                                                                                  
True
Preview: (hide)
link

Comments

The problem here, once again, is that most functions we consider are actually multivalued complex functions, which really aren't function on C at all in the normal sense. This usually gets solved by picking a "principal branch", but that sacrifices analyticity along the branch cut. For log, you can see what happens:

sage: log(-1)
I*pi
sage: log(-1)+log(-1)
2*I*pi
sage: log( (-1)*(-1))
0

These two values are not equal: they differ by an integer multiple of 2πI. Since complex logs are "only defined up to multiples of 2πI, they are "essentially" equal (as values taken by logs), but not as elements of C.

nbruin gravatar imagenbruin ( 4 years ago )

I couldn't find a description of simplify_log anywhere, or in Help. Can you point me to one? So far it doesn't seem to do anything. It returned the same log of products as the same that was input, and as the same symbolic type. I'm curious what it actually does.

I think what bothers me is bool(log(a)+log(b)==log(a*b) was working Entirely in symbolic values, so I'm wondering just where I can trust Sagemath for symbolic results without checking type for every single step.

cybervigilante gravatar imagecybervigilante ( 4 years ago )

It still works:

sage: var('a,b')
sage: bool(log(a)+log(b) == log(a*b))
False

In general you cannot expect that a symbolic engine will be able to prove all symbolic identities, so it's important that False can mean Don't know. In this case, however, it's really the case that there are numerical inputs for which the identity doesn't hold, so the False really is False in this case.

nbruin gravatar imagenbruin ( 4 years ago )

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

Seen: 326 times

Last updated: Aug 15 '20