Re: [sage-devel] sqrt(n) conversion/comparison
On Friday, February 27, 2015 at 7:58:24 PM UTC+1, Nils Bruin wrote: > > On Friday, February 27, 2015 at 8:36:52 AM UTC-8, Ralf Stephan wrote: > >> Which of these do not use Maxima? >> > > You can figure that out by making sure that maxima doesn't work anymore: > Thanks. It appears to have nothing to do with Maxima. There are two different groups of these errors: one is associated with class HyperbolicFunction and the comparison fails always with those functions. The other affects all functions and the comparison fails on varying conditions, like the argument(s) being expressions involving symbolic constants, e.g. sage: ex=sin(1+pi) sage: bool(ex==CC(ex)) False Maybe it's FP noise, no idea. Since it only affects "ex in CC" in a ticket branch I tend to turn to more important things. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] sqrt(n) conversion/comparison
On Friday, February 27, 2015 at 8:36:52 AM UTC-8, Ralf Stephan wrote: > Which of these do not use Maxima? > You can figure that out by making sure that maxima doesn't work anymore: sage: integrate(x,x) #trigger maxima initialization 1/2*x^2 sage: sage.libs.ecl.shutdown_ecl() #any existing ecl objects are now corrupted sage: integrate(x,x) RuntimeError: ECL says: Detected access to an invalid or protected memory address. or alternatively (this has a lighter touch) sage: integrate(x,x) 1/2*x^2 sage: sage.calculus.calculus.maxima=None sage: integrate(x,x) AttributeError: 'NoneType' object has no attribute 'sr_integral' A little warning: if we have a very bad try/except somewhere that catches arbitrary RuntimeError or AttributeError, the above trick might not quite work. To be completely sure, you should probably patch ecllib to log something anytime it gets called. -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] sqrt(n) conversion/comparison
On Thursday, February 26, 2015 at 10:10:03 AM UTC+1, vdelecroix wrote: > > We also have > > sage: RR(tan(pi/20)) == CC(tan(pi/20)) > False > The utility code in #17866 uncovers more: sage: bool(csc(2)==CC(csc(2))) False sage: bool(csch(2)==CC(csch(2))) False sage: bool(arcsec(2)==CC(arcsec(2))) False sage: bool(arcsech(pi/10)==CC(arcsech(pi/10))) False sage: bool(arcsech(2)==CC(arcsech(2))) AttributeError: 'sage.rings.complex_interval.ComplexIntervalFieldElement' object has no attribute 'arcsech' sage: bool(coth(2)==CC(coth(2))) False and so on (argument pi/10): zetaderiv, spherical_harmonic, dilog, elliptic_pi, exp_integral_e, (gen_)laguerre, Ei. Which of these do not use Maxima? -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] sqrt(n) conversion/comparison
Assuming fp values cannot be equal, would it make more sense to test elementship in CC by implementing ComplexField.__contains__() instead of trusting Python or Maxima == ? -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] sqrt(n) conversion/comparison
We also have sage: RR(tan(pi/20)) == CC(tan(pi/20)) False But it seems right for cos, sin, exp, atan, cosh, sinh. Is there a way to test all symbolic functions? 2015-02-26 10:02 UTC+01:00, Ralf Stephan : > On Thursday, February 26, 2015 at 9:50:40 AM UTC+1, vdelecroix wrote: >> >> sage: bool(RR(sqrt(2)) == sqrt(2)) >> False >> sage: sqrt(2).n() == RR(sqrt(2)) >> True >> > These two come from bool(sqrt(2)==sqrt(2).n()) being False I think > (because Maxima is involved here) but this is different than > > sage: bool(sqrt(2).n()==CC(sqrt(2))) > False > > -- > You received this message because you are subscribed to the Google Groups > "sage-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-devel+unsubscr...@googlegroups.com. > To post to this group, send email to sage-devel@googlegroups.com. > Visit this group at http://groups.google.com/group/sage-devel. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] sqrt(n) conversion/comparison
On Thursday, February 26, 2015 at 9:50:40 AM UTC+1, vdelecroix wrote: > > sage: bool(RR(sqrt(2)) == sqrt(2)) > False > sage: sqrt(2).n() == RR(sqrt(2)) > True > These two come from bool(sqrt(2)==sqrt(2).n()) being False I think (because Maxima is involved here) but this is different than sage: bool(sqrt(2).n()==CC(sqrt(2))) False -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
Re: [sage-devel] sqrt(n) conversion/comparison
Hello, There is something wrong sage: bool(RR(pi) == pi) True sage: bool(RR(golden_ratio) == golden_ratio) True which is fine to me. You coerce to the field with less precision. But sage: bool(RR(sqrt(2)) == sqrt(2)) False sage: sqrt(2).n() == RR(sqrt(2)) True sage: RR(sqrt(2)) == CC(sqrt(2)) False which is very wrong. Vincent 2015-02-26 9:41 UTC+01:00, Ralf Stephan : > Hi, > > with current Sage, > sage: bool(sqrt(2)==CC(sqrt(2))) > False > > You would expect that this leads to > sage: sqrt(2) in CC > False > but due to a bug I'm fixing atm in #12967 this returns True. > However, now that it's fixed I'm faced with the question if > answer to both really should be False. If one doctest in parent.py > is right both should be True. But how could Sage see that equation > holds if > sage: CC(sqrt(2)) > 1.41421356237309 > sage: sqrt(2).n() > 1.41421356237310 > so either there is a bug in SR+CC or the abovementioned doctest > is wromg. > > What do you think? > > Regards, > > -- > You received this message because you are subscribed to the Google Groups > "sage-devel" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-devel+unsubscr...@googlegroups.com. > To post to this group, send email to sage-devel@googlegroups.com. > Visit this group at http://groups.google.com/group/sage-devel. > For more options, visit https://groups.google.com/d/optout. > -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.
[sage-devel] sqrt(n) conversion/comparison
Hi, with current Sage, sage: bool(sqrt(2)==CC(sqrt(2))) False You would expect that this leads to sage: sqrt(2) in CC False but due to a bug I'm fixing atm in #12967 this returns True. However, now that it's fixed I'm faced with the question if answer to both really should be False. If one doctest in parent.py is right both should be True. But how could Sage see that equation holds if sage: CC(sqrt(2)) 1.41421356237309 sage: sqrt(2).n() 1.41421356237310 so either there is a bug in SR+CC or the abovementioned doctest is wromg. What do you think? Regards, -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To post to this group, send email to sage-devel@googlegroups.com. Visit this group at http://groups.google.com/group/sage-devel. For more options, visit https://groups.google.com/d/optout.