On Tue, 18 Apr 2023, 22:59 aw, <aw.phone.00...@gmail.com> wrote:

> On Tuesday, April 18, 2023 at 3:29:03 PM UTC-6 Dima Pasechnik wrote:
>
> It is a problem, as e^1.1 cannot be represented exactly, and it is
> evaluated eagerly. To what precision should it be evaluated? To 200 bits?
> Then you will complain that you can't get what you want at 400 bits. Etc
> etc.
>
>
> "1.1" doesn't need to be evaluated, it needs to be replaced by "11/10", in
> pre-processing.
>
> I don't know the code involved, but I'll take a stab at one way it could
> be done, something like this: when the Sage interpreter is looking at the
> user-supplied string "RealLazyField(200)(e^1.1)", it knows that it is about
> to pass a parse of the string "e^1.1" on to RealLazyField.
>


what you propose is lazy evaluation.
(there is no Sage interpreter, it's basically Python, which does not do it
for such cases)

And this it better thought of as

1) compute t=e^1.1
2) compute RealLazyField(200)(t)

When you do step 1), you need, in Python, to set a precision, implicitly or
explicitly. (Same in Mathematica, by the way, you can do SetPrecision[...]).

When you do 2), and the precision chosen in 1) was not enough, tough luck
(in Mathematica, too).



In this situation, where the receiver of the parse is RealLazyField, the
> interpreter can easily change its usual parsing of "1.1". Instead of some
> kind of float, it can parse it as the exact rational 11/10, and send the
> resulting parse of the whole expression to RealLazyField for evaluation. To
> RealLazyField, it's as if the user supplied string was
> "RealLazyField(200)(e^(11/10))".
>
> The details of how this gets done, don't matter.
>
> All that matters is that "1.1" gets replaced by "11/10".
>
> Do that any way you want.
>
> -aw
>
> --
> 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/c4885432-5b32-46d9-895b-6d7fae260f0bn%40googlegroups.com
> <https://groups.google.com/d/msgid/sage-devel/c4885432-5b32-46d9-895b-6d7fae260f0bn%40googlegroups.com?utm_medium=email&utm_source=footer>
> .
>

-- 
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/CAAWYfq2f6c7jB4Ld96HuAfx_N%2BhOVQbcSwc9L0zt4pyapRcUjQ%40mail.gmail.com.

Reply via email to