Book a Demo!
CoCalc Logo Icon
StoreFeaturesDocsShareSupportNewsAboutPoliciesSign UpSign In
Download
241852 views
1
#################################################################################
2
#
3
# (c) Copyright 2010 William Stein
4
#
5
# This file is part of PSAGE
6
#
7
# PSAGE is free software: you can redistribute it and/or modify
8
# it under the terms of the GNU General Public License as published by
9
# the Free Software Foundation, either version 3 of the License, or
10
# (at your option) any later version.
11
#
12
# PSAGE is distributed in the hope that it will be useful,
13
# but WITHOUT ANY WARRANTY; without even the implied warranty of
14
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
15
# GNU General Public License for more details.
16
#
17
# You should have received a copy of the GNU General Public License
18
# along with this program. If not, see <http://www.gnu.org/licenses/>.
19
#
20
#################################################################################
21
r"""
22
Category of function fields
23
"""
24
25
26
from sage.categories.category import Category
27
from sage.misc.cachefunc import cached_method
28
from sage.categories.basic import Fields
29
from sage.rings.field import is_Field
30
31
class FunctionFields(Category):
32
r"""
33
The category of function fields.
34
35
EXAMPLES:
36
37
We create the category of function fields::
38
39
sage: C = FunctionFields()
40
sage: C
41
Category of function fields
42
43
TESTS::
44
45
sage: TestSuite(FunctionFields()).run()
46
"""
47
48
@cached_method
49
def super_categories(self):
50
"""
51
EXAMPLES::
52
53
sage: FunctionFields().super_categories()
54
[Category of fields]
55
"""
56
return[Fields()]
57
58
def __contains__(self, x):
59
r"""
60
Returns True if ``x`` is a function field.
61
62
EXAMPLES::
63
64
"""
65
import sage.rings.all
66
return sage.rings.all.is_FunctionField(x)
67
68
def _call_(self, x):
69
r"""
70
Constructs an object in this category from the data in ``x``,
71
or throws a TypeError.
72
73
EXAMPLES::
74
75
sage: C = FunctionFields()
76
77
"""
78
try:
79
return x.function_field()
80
except AttributeError:
81
raise TypeError, "unable to canonically associate a function field to %s"%x
82
83
84
class ParentMethods:
85
pass
86
87
class ElementMethods:
88
pass
89
90