[sage-devel] Re: RealField isn't doing it right

2023-04-16 Thread Nils Bruin
On Sunday, 16 April 2023 at 21:42:01 UTC-7 Nils Bruin wrote: old_RealNumber=RealNumber def RealNumber(*args,**kwargs): return QQ(old_RealNumber(*args,**kwargs)) Apologies, typos corrected in code above (note the double star in **kwargs) -- You received this message because you are

[sage-devel] Re: RealField isn't doing it right

2023-04-16 Thread Nils Bruin
On Sunday, 16 April 2023 at 19:47:15 UTC-7 aw wrote: Here's what users expect when they type an expression into a higher-precision environment: they expect the answer to be the exact answer, truncated to the precision of that environment. Period. This is not negotiable. There is no latitude

Re: [sage-devel] RealField isn't doing it right

2023-04-16 Thread aw
On Saturday, April 15, 2023 at 5:25:27 PM UTC-6 Michael Orlitzky wrote: On Sat, 2023-04-15 at 18:20 -0400, David Roe wrote: My favorite permabug: sage: A = matrix([[-3, 2, 1 ], : [ 2,-4, 4 ], : [ 1, 2,-5 ]]) sage: B = (2 * 0.5 * A) sage: B == A True sage: B.rank() == A.rank()

[sage-devel] Re: RealField isn't doing it right

2023-04-16 Thread aw
On Saturday, April 15, 2023 at 9:12:09 PM UTC-6 Nils Bruin wrote: The design decision here to let the multiplication of a "RealLiteral" by a sage integer result in a "RealNumber" is because your use of RealLiteral was taken to signal intent to use floats over exact types. If you wanted exact

Re: [sage-devel] RealField isn't doing it right

2023-04-16 Thread aw
On Sunday, April 16, 2023 at 4:44:56 PM UTC-6 Nils Bruin wrote: On Sunday, 16 April 2023 at 14:31:43 UTC-7 aw wrote: Awesome, let's talk about floating point semantics. [...] We zero-pad the 1.1 to whatever length is needed to match the other number. Because we see 1.1 as a shorthand for

Re: [sage-devel] RealField isn't doing it right

2023-04-16 Thread aw
On Sunday, April 16, 2023 at 4:56:05 PM UTC-6 Edgar Costa wrote: Wolfram Alpha also has beginners and students as a big chunk of its user base, and they get the default semantics exactly right. Do they? https://www.wolframalpha.com/input?i=100+digits+of+e%5E1.1

Re: [sage-devel] RealField isn't doing it right

2023-04-16 Thread Edgar Costa
> > It's reasonable to expect that multiplying by one won't cause a viable > alternative to Mathematica et al. to go bonkers. I haven't declared a > float variable, and I haven't type-cast anything to float. The > expression "0.5" is, a priori, quite equal to 1/2. Mathematica knows > it > I

Re: [sage-devel] RealField isn't doing it right

2023-04-16 Thread Nils Bruin
On Sunday, 16 April 2023 at 14:31:43 UTC-7 aw wrote: Awesome, let's talk about floating point semantics. [...] We zero-pad the 1.1 to whatever length is needed to match the other number. Because we see 1.1 as a shorthand for 1.1 (infinitely many zeros) That's the

Re: [sage-devel] RealField isn't doing it right

2023-04-16 Thread aw
Awesome, let's talk about floating point semantics. There are two main kinds, that I can see. One is "ordinary person" semantics, the other is IEEE-like semantics. Ordinary-person semantics is what you learned in grade school. In grade school, suppose we want to add 1.1 to 2.8324, using pencil

Re: [sage-devel] make error

2023-04-16 Thread Dima Pasechnik
Your C++ compiler (gcc (Ubuntu 9.4.0-1ubuntu1~20.04.1) 9.4.0, released in 2019, that's before scipy 1.9.3) crashes while compiling some files in scipy. Could you perhaps try a newer gcc version? https://packages.ubuntu.com/focal/gcc-10 On Sun, Apr 16, 2023 at 9:01 PM Khai Dong wrote: > > Hello,

[sage-devel] Re: make error

2023-04-16 Thread Matthias Koeppe
>From the log: g++ -Iscipy/sparse/sparsetools/_sparsetools.cpython-38-x86_64-linux-gnu.so.p -Iscipy/sparse/sparsetools -I../../scipy/sparse/sparsetools -I/home/arucane/sage/sage-9.8/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/numpy/core/include -I/usr/include/python3.8

Re: [sage-devel] RealField isn't doing it right

2023-04-16 Thread Nils Bruin
On Sunday, 16 April 2023 at 04:40:50 UTC-7 Michael Orlitzky wrote: It's reasonable to expect that multiplying by one won't cause a viable alternative to Mathematica et al. to go bonkers. I haven't declared a float variable, and I haven't type-cast anything to float. The expression "0.5" is, a

Re: [sage-devel] RealField isn't doing it right

2023-04-16 Thread Oscar Benjamin
On Sun, 16 Apr 2023 at 15:52, Trevor Karn wrote: > > I don't have much understanding of how floating point arithmetic works, but > the argument > > >If you're writing python code, you should expect 2*0.5 to return a > >float. But if you're learning linear algebra for the first time and > >typing

Re: [sage-devel] RealField isn't doing it right

2023-04-16 Thread Dima Pasechnik
On Sun, 16 Apr 2023, 15:52 Trevor Karn, wrote: > I don't have much understanding of how floating point arithmetic works, > but the argument > > >If you're writing python code, you should expect 2*0.5 to return a > >float. But if you're learning linear algebra for the first time and > >typing a

Re: [sage-devel] RealField isn't doing it right

2023-04-16 Thread Trevor Karn
I don't have much understanding of how floating point arithmetic works, but the argument >If you're writing python code, you should expect 2*0.5 to return a >float. But if you're learning linear algebra for the first time and >typing a matrix into the Sage notebook, typing 0.5 instead of 1/2

Re: [sage-devel] RealField isn't doing it right

2023-04-16 Thread Dima Pasechnik
On Sun, Apr 16, 2023 at 12:25 AM Michael Orlitzky wrote: > > On Sat, 2023-04-15 at 18:20 -0400, David Roe wrote: > > I agree with William that you should refrain from insulting the Sage > > developers, especially when the underlying problem comes from your > > misunderstanding of how floating

Re: [sage-devel] RealField isn't doing it right

2023-04-16 Thread Dima Pasechnik
On Sun, Apr 16, 2023 at 12:40 PM Michael Orlitzky wrote: > > On Sat, 2023-04-15 at 19:11 -0700, Nils Bruin wrote: > > > > I fail to see what the reasonable expectations are here. As soon as you > > multiply by "0.5" you now have an "imprecise" result. When people learn to > > use a scientific

Re: [sage-devel] RealField isn't doing it right

2023-04-16 Thread Michael Orlitzky
On Sat, 2023-04-15 at 19:11 -0700, Nils Bruin wrote: > > I fail to see what the reasonable expectations are here. As soon as you > multiply by "0.5" you now have an "imprecise" result. When people learn to > use a scientific calculator properly they are very quickly confronted with > the

Re: [sage-devel] RealField isn't doing it right

2023-04-16 Thread Georgi Guninski
On Sun, Apr 16, 2023 at 2:25 AM Michael Orlitzky wrote: > > sage: A = matrix([[-3, 2, 1 ], > : [ 2,-4, 4 ], > : [ 1, 2,-5 ]]) > sage: B = (2 * 0.5 * A) > sage: B == A > True > sage: B.rank() == A.rank() > False > Doesn't this complicates citing