Skip to content
This repository has been archived by the owner on Jan 30, 2023. It is now read-only.

Commit

Permalink
doctest fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
rwst committed Aug 30, 2016
1 parent 91a08d2 commit a4f58d7
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 22 deletions.
2 changes: 1 addition & 1 deletion src/doc/en/prep/Calculus.rst
Expand Up @@ -308,7 +308,7 @@ help it look nicer in the browser?
::

sage: integrate(1/(1+x^5),x)
1/5*sqrt(5)*(sqrt(5) + 1)*arctan((4*x + sqrt(5) - 1)/sqrt(2*sqrt(5) + 10))/sqrt(2*sqrt(5) + 10) + 1/5*sqrt(5)*(sqrt(5) - 1)*arctan((4*x - sqrt(5) - 1)/sqrt(-2*sqrt(5) + 10))/sqrt(-2*sqrt(5) + 10) - 1/2*(sqrt(5) + 3)*log(2*x^2 - x*(sqrt(5) + 1) + 2)/(5*sqrt(5) + 5) - 1/2*(sqrt(5) - 3)*log(2*x^2 + x*(sqrt(5) - 1) + 2)/(5*sqrt(5) - 5) + 1/5*log(x + 1)
1/5*sqrt(5)*(sqrt(5) + 1)*arctan((4*x + sqrt(5) - 1)/sqrt(2*sqrt(5) + 10))/sqrt(2*sqrt(5) + 10) + 1/5*sqrt(5)*(sqrt(5) - 1)*arctan((4*x - sqrt(5) - 1)/sqrt(-2*sqrt(5) + 10))/sqrt(-2*sqrt(5) + 10) - 1/10*(sqrt(5) + 3)*log(2*x^2 - x*(sqrt(5) + 1) + 2)/(sqrt(5) + 1) - 1/10*(sqrt(5) - 3)*log(2*x^2 + x*(sqrt(5) - 1) + 2)/(sqrt(5) - 1) + 1/5*log(x + 1)

Some integrals are a little tricky, of course. If Sage doesn't know the
whole antiderivative, it returns as much of it as it (more properly, as
Expand Down
2 changes: 1 addition & 1 deletion src/sage/schemes/elliptic_curves/ell_generic.py
Expand Up @@ -385,7 +385,7 @@ def _symbolic_(self, SR):
0
sage: 2*w
(-2*pi + (2*pi - 3*pi^2 + 10)^2/(-40*pi + 4*pi^3 - 4*pi^2 - 79) + 1 : (3*pi - (2*pi - 3*pi^2 + 10)^2/(-40*pi + 4*pi^3 - 4*pi^2 - 79) - 1)*(2*pi - 3*pi^2 + 10)/sqrt(-40*pi + 4*pi^3 - 4*pi^2 - 79) + 1/2*sqrt(-40*pi + 4*pi^3 - 4*pi^2 - 79) - 1/2 : 1)
(-2*pi - (2*pi - 3*pi^2 + 10)^2/(40*pi - 4*pi^3 + 4*pi^2 + 79) + 1 : (3*pi + (2*pi - 3*pi^2 + 10)^2/(40*pi - 4*pi^3 + 4*pi^2 + 79) - 1)*(2*pi - 3*pi^2 + 10)/sqrt(-40*pi + 4*pi^3 - 4*pi^2 - 79) + 1/2*sqrt(-40*pi + 4*pi^3 - 4*pi^2 - 79) - 1/2 : 1)
sage: x, y, z = 2*w; temp = ((y^2 + y) - (x^3 - x^2 - 10*x - 20))
Expand Down
40 changes: 22 additions & 18 deletions src/sage/symbolic/expression.pyx
Expand Up @@ -3579,22 +3579,6 @@ cdef class Expression(CommutativeRingElement):
TESTS::
sage: (Mod(2,7)*x^2 + Mod(2,7))^7
(2*x^2 + 2)^7
The leading coefficient in the result above is 1 since::
sage: t = Mod(2,7); gcd(t, t)^7
1
sage: gcd(t,t).parent()
Ring of integers modulo 7
::
sage: k = GF(7)
sage: f = expand((k(1)*x^5 + k(1)*x^2 + k(2))^7); f
x^35 + x^14 + 2
sage: x^oo
Traceback (most recent call last):
...
Expand Down Expand Up @@ -4310,6 +4294,20 @@ cdef class Expression(CommutativeRingElement):
sage: ((x+sqrt(2)*x)^2).expand()
2*sqrt(2)*x^2 + 3*x^2
Check that exactness is preserved::
sage: ((x+1.001)^2).expand()
x^2 + 2.00200000000000*x + 1.00200100000000
sage: ((x+1.001)^3).expand()
x^3 + 3.00300000000000*x^2 + 3.00600300000000*x + 1.00300300100000
Check that :trac:`21302` is fixed::
sage: ((x+1)^-2).expand()
1/(x^2 + 2*x + 1)
sage: (((x-1)/(x+1))^2).expand()
x^2/(x^2 + 2*x + 1) - 2*x/(x^2 + 2*x + 1) + 1/(x^2 + 2*x + 1)
"""
if side is not None:
if not is_a_relational(self._gobj):
Expand Down Expand Up @@ -5808,8 +5806,8 @@ cdef class Expression(CommutativeRingElement):
The behaviour is undefined with noninteger or negative exponents::
sage: p = (17/3*a)*x^(3/2) + x*y + 1/x + x^x + 5*x^y
sage: rset = set([(1, -1), (y, 1), (17/3*a, 3/2), (x^x, 0), (5, y)])
sage: p = (17/3*a)*x^(3/2) + x*y + 1/x + 2*x^x + 5*x^y
sage: rset = set([(1, -1), (y, 1), (17/3*a, 3/2), (2, x), (5, y)])
sage: all([(pair[0],pair[1]) in rset for pair in p.coefficients(x)])
True
sage: p.coefficients(x, sparse=False)
Expand Down Expand Up @@ -5846,6 +5844,12 @@ cdef class Expression(CommutativeRingElement):
sage: f.coefficients(g)
[[t, 0], [3, 1], [1, 2]]
Handle bound variable strictly as part of a constant::
sage: (sin(1+x)*sin(1+x^2)).coefficients(x)
[[sin(x^2 + 1)*sin(x + 1), 0]]
sage: (sin(1+x)*sin(1+x^2)*x).coefficients(x)
[[sin(x^2 + 1)*sin(x + 1), 1]]
"""
cdef vector[pair[GEx,GEx]] vec
cdef pair[GEx,GEx] gexpair
Expand Down
4 changes: 2 additions & 2 deletions src/sage/tensor/differential_form_element.py
Expand Up @@ -312,9 +312,9 @@ class DifferentialForm(AlgebraElement):
sage: form2
1/log(y)*dz + dx + e^cos(x)*dy
sage: d(form2)
-(1/y)/log(y)^2*dy/\dz + -e^cos(x)*sin(x)*dx/\dy
-1/(y*log(y)^2)*dy/\dz + -e^cos(x)*sin(x)*dx/\dy
sage: form2.diff()
-(1/y)/log(y)^2*dy/\dz + -e^cos(x)*sin(x)*dx/\dy
-1/(y*log(y)^2)*dy/\dz + -e^cos(x)*sin(x)*dx/\dy
sage: d(form1) == form1.diff()
True
Expand Down

0 comments on commit a4f58d7

Please sign in to comment.