ok, I got your point. Now, a different issue with "bool" bool( sin(2*x) == 2*sin(x)*cos(x) ) returns True while bool( sin(x) == 2*sin(x/2)*cos(x/2) ) returns False
Similarly, bool( tan(x) == sin(2*x)/(1+cos(2*x)) ) returns True while bool( tan(x/2) == sin(x)/(1+cos(x)) ) returns False Do you have any idea why sage "bool" fails for trig functions with fractional angles? Can you suggest any work around? On Nov 12, 9:36 pm, Robert Bradshaw <rober...@math.washington.edu> wrote: > On Fri, Nov 12, 2010 at 3:44 PM, Derrick <we.sana...@gmail.com> wrote: > > Any clue why bool(arcsin(x) == 2*arctan(x/(1+sqrt(1-x^2)))) returns > > false where the expressions are mathematically equivalent. > > Because an expression being equal to zero is, in general, and > undecideable question. If it can't tell, it'd rather error on the side > of caution (not being equal) than claim they're equal. > > > I found that arcsin(x) - 2*arctan(x/(1+sqrt(1-x^2))) is not exactly 0 > > for all x in [-1,1]. > > True. You can't even represent arcsin(x) exactly as a floating point > number for most values of x. There's rounding error and all when you > combine operations as well. > > > In sage, is there any way to compare expressions > > with some numerical precision? > > sage: expr.subs(x=1/3).n() > 0.000000000000000 > sage: expr.subs(x=1/3).n(100) > 3.9443045261050590270586428264e-31 > sage: expr.subs(x=1/3).n(1000) > 0.000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000 > > - Robert -- To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to sage-support+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-support URL: http://www.sagemath.org