bool function fails!?

29 views
Skip to first unread message

Daniel Edler

unread,
Apr 13, 2014, 12:16:28 PM4/13/14
to sage-s...@googlegroups.com
I wanted to show that two equations are equal so I used the bool() function. Unfortunately sage (6.1.1) do not see that it is equal but obviously they are. If I replace log(x) with -log(1/x) it works and the replacement itself is also true for sage. What is the problem? Here is my cell:

bool(     -g*m^2*log(   (m*v*cos(alpha))/(m*v*cos(alpha) - k*x)  )     /k^2 + m*v*sin(alpha)/k+ g*m^2/k^2 - (m*v*cos(alpha) - k*x)*sin(alpha)/(k*cos(alpha)) - (m*v*cos(alpha) - k*x)*g*m/(k^2*v*cos(alpha)) == (tan(alpha)+m*g/(k*v*cos(alpha)))*x + g*(m/k)^2 * log(1-k*x/(m*v*cos(alpha))) )
> False

but
bool(-g*m^2*log(x)/k^2 + m*v*sin(alpha)/k+ g*m^2/k^2 - (m*v*cos(alpha) - k*x)*sin(alpha)/(k*cos(alpha)) - (m*v*cos(alpha) - k*x)*g*m/(k^2*v*cos(alpha)) == (tan(alpha)+m*g/(k*v*cos(alpha)))*x + g*(m/k)^2 * log(1/x) )
> True

Michael Orlitzky

unread,
Apr 13, 2014, 6:18:39 PM4/13/14
to sage-s...@googlegroups.com
On 04/13/2014 12:16 PM, Daniel Edler wrote:
> I wanted to show that two equations are equal so I used the bool()
> function. Unfortunately sage (6.1.1) do not see that it is equal but
> obviously they are. If I replace log(x) with -log(1/x) it works and the
> replacement itself is also true for sage. What is the problem? Here is
> my cell:
>

When you call bool() on a symbolic equality, there are three potential
results that are returned as only two constants:

- True: They're equal
- False: Either they're not equal, or I don't know

In your case, False means "I don't know." Sage errs on the safe side
here. You can convince it to try more drastic transformations in order
to determine that they're equal:

sage: actual = -g*m^2*log( (m*v*cos(alpha))/(m*v*cos(alpha) - k*x)
) /k^2 + m*v*sin(alpha)/k+ g*m^2/k^2 - (m*v*cos(alpha) -
k*x)*sin(alpha)/(k*cos(alpha)) - (m*v*cos(alpha) -
k*x)*g*m/(k^2*v*cos(alpha))
sage: expected = (tan(alpha)+m*g/(k*v*cos(alpha)))*x + g*(m/k)^2 *
log(1-k*x/(m*v*cos(alpha)))
sage: bool(actual == expected)
False
sage: bool(actual.simplify_full() == expected.simplify_full())
True

Daniel Edler

unread,
Apr 14, 2014, 7:01:31 AM4/14/14
to sage-s...@googlegroups.com

  - False: Either they're not equal, or I don't know

That sound quite obvious, but I didn't figured out.

And thank you for the simplify_full() advise. I only tried simplify(). And thank you in general :)
Reply all
Reply to author
Forward
0 new messages