Ask Your Question
0

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

asked 2017-09-12 08:22:24 -0600

muxamilian gravatar image

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 flag offensive close merge delete

Comments

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

kcrisman gravatar imagekcrisman ( 2017-09-12 08:25:01 -0600 )edit

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 gravatar imagedan_fulea ( 2017-09-12 10:11:05 -0600 )edit

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

kcrisman gravatar imagekcrisman ( 2017-09-12 18:25:49 -0600 )edit

1 answer

Sort by » oldest newest most voted
1

answered 2017-09-12 10:03:58 -0600

FrédéricC gravatar image

But

sage: (eq.lhs()-eq.rhs()).log_expand()
0.0
edit flag offensive delete link more

Comments

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

kcrisman gravatar imagekcrisman ( 2017-09-12 10:09:00 -0600 )edit
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...)

dan_fulea gravatar imagedan_fulea ( 2017-09-12 10:32:11 -0600 )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

Stats

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

Seen: 53 times

Last updated: Sep 12