Opened 6 years ago
Last modified 2 years ago
#15944 new enhancement
Thematic tutorial about real and complex numbers in Sage
Reported by: | tmonteil | Owned by: | |
---|---|---|---|
Priority: | major | Milestone: | sage-6.4 |
Component: | documentation | Keywords: | real number |
Cc: | kcrisman | Merged in: | |
Authors: | Thierry Monteil | Reviewers: | |
Report Upstream: | N/A | Work issues: | |
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
This tickets implements a thematic tutorial about the different representations of real numbers in Sage, and when it is convenient to use them.
The doc is not yet finished, but should be quite soon.
Attachments (2)
Change History (11)
comment:1 Changed 6 years ago by
- Milestone changed from sage-6.2 to sage-6.3
comment:2 Changed 6 years ago by
- Milestone changed from sage-6.3 to sage-6.4
comment:3 Changed 4 years ago by
- Cc kcrisman added
Changed 2 years ago by
Changed 2 years ago by
comment:4 Changed 2 years ago by
comment:5 Changed 2 years ago by
You missed in your list sage.rings.complex_mpc.MPComplexField(prec)
(that is using mpc_t
from the mpc library.
And I think that it would be good to list the upstream libraries (gmp, mpfr, mpir, arb, mpc, etc) and describe their data structures (mpz_t
, mpq_t
, mpfr_t
, etc).
comment:6 follow-up: ↓ 8 Changed 2 years ago by
I think that a first version would already be more than welcome inside the list of thematic tutorials now! The tutorial can be improved in further tickets.
comment:7 Changed 2 years ago by
And in your table at the begining you do not mention RealLazyField
(RLF
). Is that on purpose?
comment:8 in reply to: ↑ 6 ; follow-up: ↓ 9 Changed 2 years ago by
Replying to vdelecroix:
I think that a first version would already be more than welcome inside the list of thematic tutorials now! The tutorial can be improved in further tickets.
I agree, the problem is that the syntax for independent rst tutorial is not the same as for Sage thematic tutorial. Since we will have a workshop on experimental mathematics soon that might get some feedback by participants, let us plan the branch to the end of the month, so that there is no versionning issue.
Replying to vdelecroix:
You missed in your list
sage.rings.complex_mpc.MPComplexField(prec)
(that is usingmpc_t
from the mpc library.
As far as i understand, this interface is not used within Sage, since a custom representation with two MPFR is used instead. I am not sure whether it is for historical reasons, or if the Sage own implementation is faster, or what. Do you know the differences/advantages/drawbacks with Sage custom implementation ? It could be nice to explain that in the section about complex numbers, but i am not sure it should enter the table at the beginning.
And I think that it would be good to list the upstream libraries (gmp, mpfr, mpir, arb, mpc, etc)
Thanks for the suggestion, i will add a column about "Upstream libraries" in the table.
and describe their data structures (
mpz_t
,mpq_t
,mpfr_t
, etc).
I fear that it is too much "under the hood" compared of the rest of the tutorial, since the end user is not supposed to touch that (or maybe i am wrong). While the main question of the tutorial is "which representation to use for which purpose", we could make a dedicated section about "how to use them low-level", but i do not want to mix that with the simpler examples, not to fear the newcomer.
Replying to vdelecroix:
And in your table at the begining you do not mention
RealLazyField
(RLF
). Is that on purpose?
Yes, it was on purpose, like the real litterals, it is a "transitional field", but not something the user is supposed to define. This explains a dedicated section. Note that i did not mention cyclotomic fields either. I am not sure if the table is supposed to be exhaustive or if it should show the main representations.
comment:9 in reply to: ↑ 8 Changed 2 years ago by
Replying to tmonteil:
Replying to vdelecroix: Replying to vdelecroix:
You missed in your list
sage.rings.complex_mpc.MPComplexField(prec)
(that is usingmpc_t
from the mpc library.As far as i understand, this interface is not used within Sage, since a custom representation with two MPFR is used instead. I am not sure whether it is for historical reasons, or if the Sage own implementation is faster, or what. Do you know the differences/advantages/drawbacks with Sage custom implementation ? It could be nice to explain that in the section about complex numbers, but i am not sure it should enter the table at the beginning.
I think that using mpc_t
(maintained by the MPFR team) is much reliable than an home made Cython version. If there is any missing feature we should just provide some patches to upstream. See in particular the on going discussion at #24489.
and describe their data structures (
mpz_t
,mpq_t
,mpfr_t
, etc).I fear that it is too much "under the hood" compared of the rest of the tutorial, since the end user is not supposed to touch that (or maybe i am wrong). While the main question of the tutorial is "which representation to use for which purpose", we could make a dedicated section about "how to use them low-level", but i do not want to mix that with the simpler examples, not to fear the newcomer.
Yes and no. I think that it would make sense to have a section "how to use C-functions on real numbers". That can also be a "more advanced" tutorial on real numbers. That would also be the occasion to clean the various implementations.
Replying to vdelecroix:
And in your table at the begining you do not mention
RealLazyField
(RLF
). Is that on purpose?Yes, it was on purpose, like the real litterals, it is a "transitional field", but not something the user is supposed to define. This explains a dedicated section. Note that i did not mention cyclotomic fields either. I am not sure if the table is supposed to be exhaustive or if it should show the main representations.
Indeed, but from a technical perspective I think that RLF is actually something that should be used in constructions. For example, the QQ-module generated by 1 and pi should be something like
sage: QQ + QQ*pi
Or even more useful, number field + uniform random element in [0,1], etc.
Here is one of the versions of the tutorial. Let me attach files directly since they are not interacting with the rest of Sage source code, it will avoid useless rebase. There is still some work to do for an acceptable version. In particular, i would have liked to have a way to display exercises with solutions (see e.g. #22508). Also, Sage code within notes is not well rendered within ipynb files.