Re: [sage-support] Re: bug in numerical evaluation of symbolic expression
On 25/04/16 17:49, William Stein wrote: On Mon, Apr 25, 2016 at 12:06 PM, Volker Braunwrote: Presumable its because the RR nan doesn't correctly convert to the SR nan: sage: NaN.is_zero() False sage: SR(RR('nan')).is_zero() True Related and confusing/wrong/inconsistent: sage: RR('nan').is_zero() True sage: RR('nan') == 0 False This is indeed wrong. The fix is at http://trac.sagemath.org/ticket/20502 -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
Re: [sage-support] Re: bug in numerical evaluation of symbolic expression
On Mon, Apr 25, 2016 at 12:06 PM, Volker Braunwrote: > Presumable its because the RR nan doesn't correctly convert to the SR nan: > > sage: NaN.is_zero() > False > sage: SR(RR('nan')).is_zero() > True Related and confusing/wrong/inconsistent: sage: RR('nan').is_zero() True sage: RR('nan') == 0 False > > > > On Monday, April 25, 2016 at 7:40:39 PM UTC+2, William wrote: >> >> For a problem set I'm making today, I made up a random symbolic function, >> then evaluated it and got confusing/inconsistent behavior. See below: >> >> ~$ sage-develop >> ┌┐ >> │ SageMath version 7.2.beta5, Release Date: 2016-04-21 │ >> │ Type "notebook()" for the browser-based notebook interface.│ >> │ Type "help()" for help.│ >> └┘ >> ┏┓ >> ┃ Warning: this is a prerelease version, and it may be unstable. ┃ >> ┗┛ >> sage: f(x) = e^(pi*x) + asin(x) + 1/(x^2 - x- e) >> sage: f(1.1) # should this be NaN since asin(x) not defined? What is >> this output!? Print bug? >> 1/(-e + 0.110) + e^(1.10*pi) >> sage: N(f(1.1)) # yep >> NaN >> sage: N(1/(-e + 0.110) + e^(1.10*pi)) # What? >> 31.2987079491022 >> sage: f(1.1).simplify() # The NaN at the beginning makes sense... >> NaN + 1/(-e + 0.1101) + e^(1.1*pi) >> >> I'm worried maybe there is a printing bug or something in f(1.1)... >> >> -- >> William (http://wstein.org) > > -- > You received this message because you are subscribed to the Google Groups > "sage-support" group. > To unsubscribe from this group and stop receiving emails from it, send an > email to sage-support+unsubscr...@googlegroups.com. > To post to this group, send email to sage-support@googlegroups.com. > Visit this group at https://groups.google.com/group/sage-support. > For more options, visit https://groups.google.com/d/optout. -- William (http://wstein.org) -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.
[sage-support] Re: bug in numerical evaluation of symbolic expression
Presumable its because the RR nan doesn't correctly convert to the SR nan: sage: NaN.is_zero() False sage: SR(RR('nan')).is_zero() True On Monday, April 25, 2016 at 7:40:39 PM UTC+2, William wrote: > > For a problem set I'm making today, I made up a random symbolic function, > then evaluated it and got confusing/inconsistent behavior. See below: > > ~$ sage-develop > ┌┐ > │ SageMath version 7.2.beta5, Release Date: 2016-04-21 │ > │ Type "notebook()" for the browser-based notebook interface.│ > │ Type "help()" for help.│ > └┘ > ┏┓ > ┃ Warning: this is a prerelease version, and it may be unstable. ┃ > ┗┛ > sage: f(x) = e^(pi*x) + asin(x) + 1/(x^2 - x- e) > sage: f(1.1) # should this be NaN since asin(x) not defined? What is > this output!? Print bug? > 1/(-e + 0.110) + e^(1.10*pi) > sage: N(f(1.1)) # yep > NaN > sage: N(1/(-e + 0.110) + e^(1.10*pi)) # What? > 31.2987079491022 > sage: f(1.1).simplify() # The NaN at the beginning makes sense... > NaN + 1/(-e + 0.1101) + e^(1.1*pi) > > I'm worried maybe there is a printing bug or something in f(1.1)... > > -- > William (http://wstein.org) > -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-support+unsubscr...@googlegroups.com. To post to this group, send email to sage-support@googlegroups.com. Visit this group at https://groups.google.com/group/sage-support. For more options, visit https://groups.google.com/d/optout.