Real Transcendental Extension Fields

61 views
Skip to first unread message

Pat Hooper

unread,
Aug 8, 2018, 4:08:16 PM8/8/18
to sage-devel
Hi all,

I think Sage should support real transcendental extension fields. It does not as far as I can tell. For example it should support arithmetic and comparisons in Q(e) with e the usual constant e and in Q(r) where r is chosen at random in some interval with respect to Lebesgue measure. Ideally Sage would support Q(e,r), Q(sqrt(2),r), AA(r), Q(pi), Q(r_1, r_2), etc.

This is fairly easy to implement and I believe the code I attached works (with Sage 8.2 at least), but I would imagine people who know Sage well could do something more efficient than what I do. There is documentation in the RealTranscendentalExtension class that explain how to use it.

Basically a transcendental extension field is isomorphic to the field of rational functions, but you additionally need to be able to compute numerical approximations and make comparisons. In the attached code I handle this by describing the generator as the unique point in a nested intersection of closed intervals with endpoints in the field you are extending. Then you can do interval arithmetic with these intervals to get as good an approximation as you want to any number in the extension field. So, this is fairly easy to implement in Sage, and probably even easier if you know Sage better than I do. I ended up rolling my own interval arithmetic class and doing other things which are presumably already done more efficiently by code already in Sage.

This came up because I have a student doing a project who was doing extensive calculations in Q(e). We assumed that Sage was giving correct answers when you test positivity of numbers in Q(e). But this was incorrect, e.g.:
sage: print bool(e > sum([1/factorial(i) for i in xrange(20)]))
False
(This returns the correct answer of True with numbers less than 20 replacing 20.) This works correctly for even bigger values (presumably all values) once you take e to be the generator for Q(e) as defined in the attached code.

As a secondary interest, I would like to be able to run experiments with random numbers where I don't know the precision needed ahead of time. Such experiments can be done in Q(r).

Maybe I can also point out an issue I had with FunctionField. It doesn't seem to automatically reduce the scalar part of a Function Field element (over QQ) and in repeated calculation these scalars tend to blow up and slow calculations considerably. Here is an example of an uncancelled expression:
sage: K.<x> = FunctionField(QQ)
sage: (2*x)/(2*(x+1))
2*x/(2*x + 2)
I deal with this by calling f.factor().expand() whenever I store an element f of a FunctionField. If someone knows a better way of dealing with this, please let me know.

Anyway, I hope there is interest in this, and please let me know if I am posting this to the wrong place. I don't think the two blocks of code above represent "bugs"; they should just be taken to be my own misconceptions of Sage's capabilities.

Best regards,
Pat Hooper (City College of New York, CUNY Graduate Center)
real_transcendental_extension.py

Dima Pasechnik

unread,
Aug 9, 2018, 4:21:44 AM8/9/18
to sage-devel
It might also be interesting to have fields of Puiseux series as extensions of what you propose - in particular I'd be interested in having such fields where r plays role of an infinitesimal.
(or even several infinitesimals 0<<r_1<<r_2...<<1)

Samuel Lelievre

unread,
Aug 10, 2018, 8:00:48 AM8/10/18
to sage-devel


Wed 2018-08-08 22:08:16 UTC+2, Pat Hooper:


> I think Sage should support real transcendental extension fields.
> It does not as far as I can tell. For example it should support arithmetic
> and comparisons in Q(e) with e the usual constant e and in Q(r) where
> r is chosen at random in some interval with respect to Lebesgue measure.
> Ideally Sage would support Q(e,r), Q(sqrt(2),r), AA(r), Q(pi), Q(r_1, r_2), etc.

Excellent suggestion! I opened a ticket for that:

- Sage Trac ticket 26042:
  Real transcendental extension fields
Reply all
Reply to author
Forward
0 new messages