On Sun, Apr 16, 2023 at 12:40 PM Michael Orlitzky <mich...@orlitzky.com> 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 calculator properly they are very quickly confronted with
> > the reality that "dots in numbers" lead to arithmetic that isn't quite what
> > we learn in the lower grades of primary school.
>
> 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, my old Casio calculator knows it, and in fact, Sage knows it:
>
>   sage: 2 * 0.5 == ZZ(1)
>   True
>
> We're pre-parsing the user's input, so there is an opportunity to do
> the right thing. But instead, we silently convert 2*0.5 to float, and
> then silently convert the entire matrix to a float matrix, on which
> half the methods in sage are completely meaningless.
>
>
> > Do you think we should have "B == A" return false? ...
> > A more reasonably solution might be to have B.rank() return an error
>
> Yes, ultimately, I think it would be better to have a class hierarchy
> that can distinguish between inexact rings where these operations are
> meaningful and those where they're not. But these are Sage library
> issues and that's not my main complaint.
>
> 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
> should not ruin the entire assignment without so much as a warning.

perhaps the preparser should have an option to convert the floating
point input into
rationals.

>
> --
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-devel/caa19202f0a1dc1eef92dbab1df231efb1f2741c.camel%40orlitzky.com.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/CAAWYfq2k7ZbrmsMRXs%3DHhdrRzqQZUsE2ESsM9G34HA%2BU4f3nYw%40mail.gmail.com.

Reply via email to