Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

sage.interfaces: Update # needs #36656

Merged
merged 16 commits into from
Dec 10, 2023
Merged
105 changes: 57 additions & 48 deletions src/sage/interfaces/axiom.py
Original file line number Diff line number Diff line change
Expand Up @@ -304,12 +304,13 @@ def _commands(self):

EXAMPLES::

sage: cmds = axiom._commands() #optional - axiom
sage: len(cmds) > 100 #optional - axiom
sage: # optional - axiom
sage: cmds = axiom._commands()
sage: len(cmds) > 100
True
sage: '<' in cmds #optional - axiom
sage: '<' in cmds
True
sage: 'factor' in cmds #optional - axiom
sage: 'factor' in cmds
True
"""
s = self.eval(")what things")
Expand All @@ -327,18 +328,19 @@ def _tab_completion(self, verbose=True, use_disk_cache=True):

EXAMPLES::

sage: c = axiom._tab_completion(use_disk_cache=False, verbose=False) #optional - axiom
sage: len(c) > 100 #optional - axiom
sage: # optional - axiom
sage: c = axiom._tab_completion(use_disk_cache=False, verbose=False)
sage: len(c) > 100
True
sage: 'factor' in c #optional - axiom
sage: 'factor' in c
True
sage: '**' in c #optional - axiom
sage: '**' in c
False
sage: 'upperCase?' in c #optional - axiom
sage: 'upperCase?' in c
False
sage: 'upperCase_q' in c #optional - axiom
sage: 'upperCase_q' in c
True
sage: 'upperCase_e' in c #optional - axiom
sage: 'upperCase_e' in c
True
"""
try:
Expand Down Expand Up @@ -396,11 +398,12 @@ def get(self, var):

EXAMPLES::

sage: axiom.set('xx', '2') #optional - axiom
sage: axiom.get('xx') #optional - axiom
sage: # optional - axiom
sage: axiom.set('xx', '2')
sage: axiom.get('xx')
'2'
sage: a = axiom('(1 + sqrt(2))^5') #optional - axiom
sage: axiom.get(a.name()) #optional - axiom
sage: a = axiom('(1 + sqrt(2))^5')
sage: axiom.get(a.name())
' +-+\r\r\n 29\\|2 + 41'
"""
s = self._eval_line(str(var))
Expand Down Expand Up @@ -571,26 +574,28 @@ def _richcmp_(self, other, op):
"""
EXAMPLES::

sage: two = axiom(2) #optional - axiom
sage: two == 2 #optional - axiom
sage: # optional - axiom
sage: two = axiom(2)
sage: two == 2
True
sage: two == 3 #optional - axiom
sage: two == 3
False
sage: two < 3 #optional - axiom
sage: two < 3
True
sage: two > 1 #optional - axiom
sage: two > 1
True

sage: a = axiom(1); b = axiom(2) #optional - axiom
sage: a == b #optional - axiom
sage: # optional - axiom
sage: a = axiom(1); b = axiom(2)
sage: a == b
False
sage: a < b #optional - axiom
sage: a < b
True
sage: a > b #optional - axiom
sage: a > b
False
sage: b < a #optional - axiom
sage: b < a
False
sage: b > a #optional - axiom
sage: b > a
True

We can also compare more complicated object such as functions::
Expand Down Expand Up @@ -649,15 +654,16 @@ def __getitem__(self, n):

EXAMPLES::

sage: v = axiom('[i*x^i for i in 0..5]'); v # optional - axiom
sage: # optional - axiom
sage: v = axiom('[i*x^i for i in 0..5]'); v
2 3 4 5
[0,x,2x ,3x ,4x ,5x ]
sage: v[4] # optional - axiom
sage: v[4]
3
3x
sage: v[1] # optional - axiom
sage: v[1]
0
sage: v[10] # optional - axiom
sage: v[10]
Traceback (most recent call last):
...
IndexError: index out of range
Expand All @@ -677,12 +683,13 @@ def comma(self, *args):

EXAMPLES::

sage: two = axiom(2) #optional - axiom
sage: two.comma(3) #optional - axiom
sage: # optional - axiom
sage: two = axiom(2)
sage: two.comma(3)
[2,3]
sage: two.comma(3,4) #optional - axiom
sage: two.comma(3,4)
[2,3,4]
sage: _.type() #optional - axiom
sage: _.type()
Tuple PositiveInteger
"""
P = self._check_valid()
Expand Down Expand Up @@ -796,12 +803,12 @@ def _sage_(self):
2.12340000000000
sage: _.parent() #optional - axiom
Real Field with 53 bits of precision
sage: a = RealField(100)(pi)
sage: axiom(a)._sage_() #optional - axiom
sage: a = RealField(100)(pi) # needs sage.symbolic
sage: axiom(a)._sage_() # optional - axiom # needs sage.symbolic
3.1415926535897932384626433833
sage: _.parent() #optional - axiom
sage: _.parent() # optional - axiom # needs sage.symbolic
Real Field with 100 bits of precision
sage: axiom(a)._sage_() == a #optional - axiom
sage: axiom(a)._sage_() == a # optional - axiom # needs sage.symbolic
True
sage: axiom(2.0)._sage_() #optional - axiom
2.00000000000000
Expand All @@ -810,16 +817,17 @@ def _sage_(self):


We can also convert Axiom's polynomials to Sage polynomials.
sage: a = axiom(x^2 + 1) #optional - axiom
sage: a.type() #optional - axiom
sage: # optional - axiom, needs sage.symbolic
sage: a = axiom(x^2 + 1)
sage: a.type()
Polynomial Integer
sage: a.sage() #optional - axiom
sage: a.sage()
x^2 + 1
sage: _.parent() #optional - axiom
sage: _.parent()
Univariate Polynomial Ring in x over Integer Ring
sage: axiom('x^2 + y^2 + 1/2').sage() #optional - axiom
sage: axiom('x^2 + y^2 + 1/2').sage()
y^2 + x^2 + 1/2
sage: _.parent() #optional - axiom
sage: _.parent()
Multivariate Polynomial Ring in y, x over Rational Field


Expand Down Expand Up @@ -902,12 +910,13 @@ def __init__(self, object, name):
"""
TESTS::

sage: a = axiom('"Hello"') #optional - axiom
sage: a.upperCase_q #optional - axiom
sage: # optional - axiom
sage: a = axiom('"Hello"')
sage: a.upperCase_q
upperCase?
sage: a.upperCase_e #optional - axiom
sage: a.upperCase_e
upperCase!
sage: a.upperCase_e() #optional - axiom
sage: a.upperCase_e()
"HELLO"
"""
if name.endswith("_q"):
Expand Down
2 changes: 1 addition & 1 deletion src/sage/interfaces/expect.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
# -*- coding: utf-8 -*-
# sage.doctest: needs sage.libs.gap sage.libs.pari sage.libs.singular sage.symbolic
"""
Common Interface Functionality through Pexpect

Expand Down
Loading