Ask Your Question

# Sage says equation isn't true while Mathematica says it is

I have the following equation, of which I know that it is true when sigma > 0 and mu > 0.

eq = mu + 0.5*log(2*pi*sigma^2*e) == log(sqrt(2)*sqrt(pi)*sigma*e^(mu + 0.5))


So I set the constraints assume(sigma > 0) and assume(mu > 0). When evaluating it with bool(eq), Sage says False while Mathematica says that the equation holds. What am I doing wrong?

edit retag close merge delete

## Comments

Note that Sage only says True if it can prove it is true, otherwise returning False.

Yes, you know it, but sage needs some help:

We really need a subpage to refer for this kind of bool-evaluation of symbolic equalities, it will be the hit.

So let us provide the help!

sage: var( 'mu,sigma' )
(mu, sigma)
sage: var( 'mu,sigma' );
sage: assume(sigma > 0)
sage: assume(mu > 0)
sage: eq = mu + 0.5*log(2*pi*sigma^2*e) == log(sqrt(2)*sqrt(pi)*sigma*e^(mu + 0.5))
sage: bool(eq)
False
sage: bool(eq.canonicalize_radical())
True
sage: eq.canonicalize_radical()
1.0*mu + 0.5*log(2) + 0.5*log(pi) + 1.0*log(sigma) + 0.5 == 1.0*mu + 0.5*log(2) + 0.5*log(pi) + 1.0*log(sigma) + 0.5


EDIT: Sorry, i'm afraid i was editing a comment of muxamilian...

@dan_fulea - do you have a Trac account? Then you could put something to add this to the doc.

## 1 answer

Sort by » oldest newest most voted But

sage: (eq.lhs()-eq.rhs()).log_expand()
0.0

more

## Comments

Nice. It would be great if this could happen automagically but computability ...

1

Just provide the help in the evaluation, if you know it:

sage: bool(eq)
False
sage: bool( eq.log_expand() )
True


(...in more complicated cases he same applies.) (For me there is no need to test if a to-be-equality is an equality indeed, but even if, just evaluate the eq, if still False, than just evaluate it at random values... or plot... or apply relevant simplifications...)

## Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

## Stats

Asked: 2017-09-12 08:22:24 -0500

Seen: 79 times

Last updated: Sep 12 '17