ASKSAGE: Sage Q&A Forum - Latest question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Tue, 28 Nov 2017 01:24:06 -0600Why is sagemath real numbers arithmetic gives incorrect result?http://ask.sagemath.org/question/39824/why-is-sagemath-real-numbers-arithmetic-gives-incorrect-result/ I was using Sagemath for computation.
There I was input "152.8-152.43" and gets something like "0.370000000000005". I tried to use RLF and RR too but I could not eliminate the extra number "5" at the end of the result. This raises no problem, since I do not that level of precision, but the number "5" at the end of the result just drives me upset. Why is it so? Is there anyway I can do to eliminate this problem? Matlab gave me the right answer. Is this some kind of weakness of Sagemath? I love Sagemath and intend to stick to it lifelong. But did I go wrong somewhere?michaeldnguyen10Tue, 28 Nov 2017 01:24:06 -0600http://ask.sagemath.org/question/39824/bool returns true to an incorrect function call?http://ask.sagemath.org/question/8173/bool-returns-true-to-an-incorrect-function-call/This happened to me by mistake.
sage: var('x1,t1,x2,t2,u,c',domain=RR);assume(u>0);assume(c>u);assume(x2>x1);assume(t2>t1);
(x1, t1, x2, t2, u, c)
sage: T1 = (t1-((u*x1)/(c^2)))/sqrt(1-((u^2)/(c^2)))
sage: T2 = (t2-((u*x2)/(c^2)))/sqrt(1-((u^2)/(c^2)))
sage: dT = T2-T1
sage: bool(dT.full_simplify >= 0)
True
sage: bool(dT.full_simplify() >= 0)
False
When I made the incorrect function call dT.full_simplify , bool returned true. When I made the correct function call dT.full_simplify() , bool returned false. Is this a bug?
ThanksomoplataMon, 20 Jun 2011 13:18:07 -0500http://ask.sagemath.org/question/8173/