Ticket #9880: trac_9880-more_doctests-be.patch

File trac_9880-more_doctests-be.patch, 20.1 KB (added by burcin, 8 years ago)
  • sage/calculus/calculus.py

    # HG changeset patch
    # User Burcin Erocal <burcin@erocal.org>
    # Date 1368115979 -7200
    # Node ID cefe06ba0a87c78cd21d559b1790ea1721141d18
    # Parent  f793b8c61200cbe11537ff58b592c58260ce8b47
    [mq]: trac_9880-more_doctests-be.patch
    
    diff --git a/sage/calculus/calculus.py b/sage/calculus/calculus.py
    a b  
    371371(Trac #9217) is fixed::
    372372
    373373    sage: taylor(gamma(1/3+x),x,0,3)
    374     -1/432*((36*(pi*sqrt(3) + 9*log(3))*euler_gamma^2 + 27*pi^2*log(3) + 72*euler_gamma^3 + 243*log(3)^3 + 18*(6*pi*sqrt(3)*log(3) + pi^2 + 27*log(3)^2 + 12*psi(1, 1/3))*euler_gamma + 324*psi(1, 1/3)*log(3) + (pi^3 + 9*(9*log(3)^2 + 4*psi(1, 1/3))*pi)*sqrt(3))*gamma(1/3) - 72*gamma(1/3)*psi(2, 1/3))*x^3 + 1/24*(6*pi*sqrt(3)*log(3) + 4*(pi*sqrt(3) + 9*log(3))*euler_gamma + pi^2 + 12*euler_gamma^2 + 27*log(3)^2 + 12*psi(1, 1/3))*x^2*gamma(1/3) - 1/6*(6*euler_gamma + pi*sqrt(3) + 9*log(3))*x*gamma(1/3) + gamma(1/3)
     374    -1/432*((72*euler_gamma^3 + 36*euler_gamma^2*(sqrt(3)*pi + 9*log(3)) +
     375    27*pi^2*log(3) + 243*log(3)^3 + 18*euler_gamma*(6*sqrt(3)*pi*log(3) + pi^2
     376    + 27*log(3)^2 + 12*psi(1, 1/3)) + 324*log(3)*psi(1, 1/3) + sqrt(3)*(pi^3 +
     377    9*pi*(9*log(3)^2 + 4*psi(1, 1/3))))*gamma(1/3) - 72*psi(2,
     378    1/3)*gamma(1/3))*x^3 + 1/24*(6*sqrt(3)*pi*log(3) + 12*euler_gamma^2 + pi^2
     379    + 4*euler_gamma*(sqrt(3)*pi + 9*log(3)) + 27*log(3)^2 + 12*psi(1,
     380    1/3))*x^2*gamma(1/3) - 1/6*(6*euler_gamma + sqrt(3)*pi +
     381    9*log(3))*x*gamma(1/3) + gamma(1/3)
    375382    sage: map(lambda f:f[0].n(), _.coeffs())  # numerical coefficients to make comparison easier; Maple 12 gives same answer
    376383    [2.6789385347..., -8.3905259853..., 26.662447494..., -80.683148377...]
    377384
     
    379386
    380387    sage: k = var("k")
    381388    sage: sum(1/(1+k^2), k, -oo, oo)
    382     1/2*I*psi(-I) - 1/2*I*psi(I) + 1/2*I*psi(-I + 1) - 1/2*I*psi(I + 1)
     389    -1/2*I*psi(I + 1) + 1/2*I*psi(-I + 1) - 1/2*I*psi(I) + 1/2*I*psi(-I)
    383390
    384391Ensure that ticket #8624 is fixed::
    385392
     
    865872
    866873        sage: f = x^3 - x + 1
    867874        sage: a = f.solve(x)[0].rhs(); a
    868         -1/2*(I*sqrt(3) + 1)*(1/18*sqrt(3)*sqrt(23) - 1/2)^(1/3) - 1/6*(-I*sqrt(3) + 1)/(1/18*sqrt(3)*sqrt(23) - 1/2)^(1/3)
     875        -1/2*(1/18*sqrt(23)*sqrt(3) - 1/2)^(1/3)*(I*sqrt(3) + 1) - 1/6*(-I*sqrt(3) + 1)/(1/18*sqrt(23)*sqrt(3) - 1/2)^(1/3)
    869876        sage: a.minpoly()
    870877        x^3 - x + 1
    871878
     
    878885        sage: f = a.minpoly(); f
    879886        x^8 - 40*x^6 + 352*x^4 - 960*x^2 + 576
    880887        sage: f(a)
    881         ((((sqrt(2) + sqrt(3) + sqrt(5))^2 - 40)*(sqrt(2) + sqrt(3) + sqrt(5))^2 + 352)*(sqrt(2) + sqrt(3) + sqrt(5))^2 - 960)*(sqrt(2) + sqrt(3) + sqrt(5))^2 + 576
     888        ((((sqrt(5) + sqrt(3) + sqrt(2))^2 - 40)*(sqrt(5) + sqrt(3) + sqrt(2))^2 + 352)*(sqrt(5) + sqrt(3) + sqrt(2))^2 - 960)*(sqrt(5) + sqrt(3) + sqrt(2))^2 + 576
    882889        sage: f(a).expand()
    883890        0
    884891
     
    13011308        sage: xt = E[0,2].inverse_laplace(s,t)
    13021309        sage: yt = E[1,2].inverse_laplace(s,t)
    13031310        sage: xt
    1304         629/2*e^(-4*t) - 91/2*e^(4*t) + 1
     1311        -91/2*e^(4*t) + 629/2*e^(-4*t) + 1
    13051312        sage: yt
    1306         629/8*e^(-4*t) + 91/8*e^(4*t)
     1313        91/8*e^(4*t) + 629/8*e^(-4*t)
    13071314        sage: p1 = plot(xt,0,1/2,rgbcolor=(1,0,0))
    13081315        sage: p2 = plot(yt,0,1/2,rgbcolor=(0,1,0))
    13091316        sage: (p1+p2).save(os.path.join(SAGE_TMP, "de_plot.png"))
  • sage/calculus/desolvers.py

    diff --git a/sage/calculus/desolvers.py b/sage/calculus/desolvers.py
    a b  
    365365        sage: sage.calculus.calculus.maxima('domain:complex')  # back to the default complex domain
    366366        complex
    367367        sage: desolve(x*diff(y,x)-x*sqrt(y^2+x^2)-y == 0, y, contrib_ode=True)
    368         [1/2*(2*x^2*sqrt(x^(-2)) - 2*x*sqrt(x^(-2))*arcsinh(y(x)/sqrt(x^2))
    369         - 2*x*sqrt(x^(-2))*arcsinh(y(x)^2/(sqrt(y(x)^2)*x))
    370         + log(4*(2*x^2*sqrt((x^2*y(x)^2 + y(x)^4)/x^2)*sqrt(x^(-2)) + x^2 + 2*y(x)^2)/x^2))/(x*sqrt(x^(-2))) == c]
     368        [1/2*(2*x^2*sqrt(x^(-2)) - 2*x*sqrt(x^(-2))*arcsinh(y(x)/sqrt(x^2)) -
     369            2*x*sqrt(x^(-2))*arcsinh(y(x)^2/(x*sqrt(y(x)^2))) +
     370            log(4*(2*x^2*sqrt((x^2*y(x)^2 + y(x)^4)/x^2)*sqrt(x^(-2)) + x^2 +
     371            2*y(x)^2)/x^2))/(x*sqrt(x^(-2))) == c]
    371372
    372373    Trac #6479 fixed::
    373374
  • sage/calculus/tests.py

    diff --git a/sage/calculus/tests.py b/sage/calculus/tests.py
    a b  
    9595    sage: derivative(arctan(x), x)
    9696    1/(x^2 + 1)
    9797    sage: derivative(x^n, x, 3)
    98     (n - 2)*(n - 1)*n*x^(n - 3)
     98    (n - 1)*(n - 2)*n*x^(n - 3)
    9999    sage: derivative( function('f')(x), x)
    100100    D[0](f)(x)   
    101101    sage: diff( 2*x*f(x^2), x)
    102102    4*x^2*D[0](f)(x^2) + 2*f(x^2)
    103103    sage: integrate( 1/(x^4 - a^4), x)
    104     1/4*log(-a + x)/a^3 - 1/4*log(a + x)/a^3 - 1/2*arctan(x/a)/a^3
     104    -1/2*arctan(x/a)/a^3 - 1/4*log(a + x)/a^3 + 1/4*log(-a + x)/a^3
    105105    sage: expand(integrate(log(1-x^2), x))
    106     x*log(-x^2 + 1) - 2*x - log(x - 1) + log(x + 1)
     106    x*log(-x^2 + 1) - 2*x + log(x + 1) - log(x - 1)
    107107    sage: integrate(log(1-x^2)/x, x)
    108     1/2*log(-x^2 + 1)*log(x^2) + 1/2*polylog(2, -x^2 + 1)
     108    1/2*log(x^2)*log(-x^2 + 1) + 1/2*polylog(2, -x^2 + 1)
    109109    sage: integrate(exp(1-x^2),x)
    110     1/2*sqrt(pi)*e*erf(x)
     110    1/2*sqrt(pi)*erf(x)*e
    111111    sage: integrate(sin(x^2),x)
    112     1/8*((I - 1)*sqrt(2)*erf((1/2*I - 1/2)*sqrt(2)*x) + (I + 1)*sqrt(2)*erf((1/2*I + 1/2)*sqrt(2)*x))*sqrt(pi)
     112    1/8*sqrt(pi)*((I + 1)*sqrt(2)*erf((1/2*I + 1/2)*sqrt(2)*x) + (I - 1)*sqrt(2)*erf((1/2*I - 1/2)*sqrt(2)*x))
    113113
    114114    sage: integrate((1-x^2)^n,x)
    115115    integrate((-x^2 + 1)^n, x)
    116116    sage: integrate(x^x,x)
    117117    integrate(x^x, x)
    118118    sage: integrate(1/(x^3+1),x)
    119     1/3*sqrt(3)*arctan(1/3*(2*x - 1)*sqrt(3)) + 1/3*log(x + 1) - 1/6*log(x^2 - x + 1)
     119    1/3*sqrt(3)*arctan(1/3*sqrt(3)*(2*x - 1)) - 1/6*log(x^2 - x + 1) + 1/3*log(x + 1)
    120120    sage: integrate(1/(x^3+1), x, 0, 1)
    121     1/9*pi*sqrt(3) + 1/3*log(2)
     121    1/9*sqrt(3)*pi + 1/3*log(2)
    122122
    123123::
    124124
  • sage/functions/exp_integral.py

    diff --git a/sage/functions/exp_integral.py b/sage/functions/exp_integral.py
    a b  
    609609        EXAMPLES::
    610610
    611611            sage: log_integral_offset(3)
    612             -log_integral(2) + log_integral(3)
     612            log_integral(3) - log_integral(2)
    613613
    614614        """
    615615        BuiltinFunction.__init__(self, "log_integral_offset", nargs=1,
     
    737737        x*sin_integral(x) + cos(x)
    738738
    739739        sage: integrate(sin(x)/x, x)
    740         1/2*I*Ei(-I*x) - 1/2*I*Ei(I*x)
     740        -1/2*I*Ei(I*x) + 1/2*I*Ei(-I*x)
    741741
    742742
    743743    Compare values of the functions `\operatorname{Si}(x)` and
  • sage/functions/orthogonal_polys.py

    diff --git a/sage/functions/orthogonal_polys.py b/sage/functions/orthogonal_polys.py
    a b  
    469469        sage: gen_legendre_Q(0, 1, x)
    470470        -1/sqrt(-x^2 + 1)
    471471        sage: gen_legendre_Q(2, 4, x).factor()
    472         48*x/((x - 1)^2*(x + 1)^2)
     472        48*x/((x + 1)^2*(x - 1)^2)
    473473    """
    474474    from sage.functions.all import sqrt
    475475    if m <= n:
  • sage/functions/other.py

    diff --git a/sage/functions/other.py b/sage/functions/other.py
    a b  
    15061506            sage: beta(-1/2,-1/2)
    15071507            0
    15081508            sage: beta(x/2,3)
    1509             beta(1/2*x, 3)
     1509            beta(3, 1/2*x)
    15101510            sage: beta(.5,.5)
    15111511            3.14159265358979
    15121512            sage: beta(1,2.0+I)
    15131513            0.400000000000000 - 0.200000000000000*I
    15141514            sage: beta(3,x+I)
    1515             beta(x + I, 3)
     1515            beta(3, x + I)
    15161516
    15171517        Note that the order of arguments does not matter::
    15181518
    15191519            sage: beta(1/2,3*x)
    1520             beta(3*x, 1/2)
     1520            beta(1/2, 3*x)
    15211521
    15221522        The result is symbolic if exact input is given::
    15231523
    15241524            sage: beta(2,1+5*I)
    1525             beta(5*I + 1, 2)
     1525            beta(2, 5*I + 1)
    15261526            sage: beta(2, 2.)
    15271527            0.166666666666667
    15281528            sage: beta(I, 2.)
  • sage/functions/special.py

    diff --git a/sage/functions/special.py b/sage/functions/special.py
    a b  
    585585                sage: n(bessel_J(3,10,"maxima"))
    586586                0.0583793793051...
    587587                sage: spherical_hankel2(2,x)
    588                 -(I*x^2 + 3*x - 3*I)*e^(-I*x)/x^3
     588                (-I*x^2 - 3*x + 3*I)*e^(-I*x)/x^3
    589589            """
    590590            MaximaFunction.__init__(self, name)
    591591
     
    13391339    EXAMPLES::
    13401340   
    13411341        sage: spherical_hankel2(2, x)
    1342         -(I*x^2 + 3*x - 3*I)*e^(-I*x)/x^3
     1342        (-I*x^2 - 3*x + 3*I)*e^(-I*x)/x^3
    13431343   
    13441344    Here I = sqrt(-1).
    13451345    """
     
    13551355   
    13561356        sage: x,y = var('x,y')
    13571357        sage: spherical_harmonic(3,2,x,y)
    1358         15/4*sqrt(7/30)*e^(2*I*y)*sin(x)^2*cos(x)/sqrt(pi)
     1358        15/4*sqrt(7/30)*cos(x)*e^(2*I*y)*sin(x)^2/sqrt(pi)
    13591359        sage: spherical_harmonic(3,2,1,2)
    1360         15/4*sqrt(7/30)*e^(4*I)*sin(1)^2*cos(1)/sqrt(pi)
     1360        15/4*sqrt(7/30)*cos(1)*e^(4*I)*sin(1)^2/sqrt(pi)
    13611361    """
    13621362    _init()
    13631363    return meval("spherical_harmonic(%s,%s,%s,%s)"%(ZZ(m),ZZ(n),x,y))
     
    14751475        sage: z = var("z")
    14761476        sage: # this is still wrong: must be abs(sin(z)) + 2*round(z/pi)
    14771477        sage: elliptic_e(z, 1)
    1478         sin(z) + 2*round(z/pi)
     1478        2*round(z/pi) + sin(z)
    14791479        sage: elliptic_e(z, 0)
    14801480        z
    14811481        sage: elliptic_e(0.5, 0.1)
  • sage/symbolic/constants.py

    diff --git a/sage/symbolic/constants.py b/sage/symbolic/constants.py
    a b  
    183183    mertens + twinprime + khinchin + log2 + golden_ratio + catalan + euler_gamma + pi + e
    184184    sage: parent(a)
    185185    Symbolic Ring
    186     sage: RR(a)
     186    sage: RR(a) #abstol 1e11
    187187    13.2713479401972
    188188    sage: RealField(212)(a)
    189189    13.2713479401972493100988191995758139408711068200030748178329712
    190190    sage: RealField(230)(a)
    191191    13.271347940197249310098819199575813940871106820003074817832971189555
    192     sage: CC(a)
     192    sage: CC(a) #abstol 1e11
    193193    13.2713479401972
    194194    sage: CDF(a)
    195195    13.2713479402
  • sage/symbolic/expression.pyx

    diff --git a/sage/symbolic/expression.pyx b/sage/symbolic/expression.pyx
    a b  
    1515::
    1616
    1717    sage: eqn^2
    18     (x - 1)^4 <= (-x^2 + 2*x - 3)^2
     18    (x - 1)^4 <= (x^2 - 2*x + 3)^2
    1919    sage: eqn.expand()
    2020    x^2 - 2*x + 1 <= x^2 - 2*x + 3
    2121
     
    14291429            sage: v,c = var('v,c')
    14301430            sage: assume(c != 0)
    14311431            sage: integral((1+v^2/c^2)^3/(1-v^2/c^2)^(3/2),v)
    1432             -1/4*v^5/(c^4*sqrt(-v^2/c^2 + 1)) - 17/8*v^3/(c^2*sqrt(-v^2/c^2 + 1)) + 83/8*v/sqrt(-v^2/c^2 + 1) - 75/8*arcsin(v/(c^2*sqrt(c^(-2))))/sqrt(c^(-2))
     1432            83/8*v/sqrt(-v^2/c^2 + 1) - 17/8*v^3/(c^2*sqrt(-v^2/c^2 + 1)) - 1/4*v^5/(c^4*sqrt(-v^2/c^2 + 1)) - 75/8*arcsin(v/(c^2*sqrt(c^(-2))))/sqrt(c^(-2))
    14331433            sage: forget()
    14341434        """
    14351435        from sage.symbolic.assumptions import _assumptions
     
    30793079            -cos(x)*cos(y) + sin(x)*sin(y)
    30803080            sage: f = ((x^2+1)/(x^2-1))^(1/4)
    30813081            sage: g = derivative(f, x); g # this is a complex expression
    3082             1/2*(x/(x^2 - 1) - (x^2 + 1)*x/(x^2 - 1)^2)/((x^2 + 1)/(x^2 - 1))^(3/4)
     3082            -1/2*((x^2 + 1)*x/(x^2 - 1)^2 - x/(x^2 - 1))/((x^2 + 1)/(x^2 - 1))^(3/4)
    30833083            sage: g.factor()
    3084             -x/((x - 1)^2*(x + 1)^2*((x^2 + 1)/(x^2 - 1))^(3/4))
     3084            -x/((x + 1)^2*(x - 1)^2*((x^2 + 1)/(x^2 - 1))^(3/4))
    30853085 
    30863086        ::
    30873087       
     
    35573557            sage: sin(x/2).expand_trig(half_angles=False)
    35583558            sin(1/2*x)
    35593559            sage: sin(x/2).expand_trig(half_angles=True)
    3560             sqrt(-1/2*cos(x) + 1/2)*(-1)^floor(1/2*x/pi)
     3560            (-1)^floor(1/2*x/pi)*sqrt(-1/2*cos(x) + 1/2)
    35613561
    35623562        ALIASES:
    35633563
     
    37313731            sage: w0 = SR.wild(0); w1 = SR.wild(1)
    37323732
    37333733            sage: (sin(x)*sin(y)).find(sin(w0))
    3734             [sin(x), sin(y)]
     3734            [sin(y), sin(x)]
    37353735
    37363736            sage: ((sin(x)+sin(y))*(a+b)).expand().find(sin(w0))
    3737             [sin(x), sin(y)]
     3737            [sin(y), sin(x)]
    37383738
    37393739            sage: (1+x+x^2+x^3).find(x)
    37403740            [x]
     
    37563756        while itr.is_not_equal(found.end()):
    37573757            res.append(new_Expression_from_GEx(self._parent, itr.obj()))
    37583758            itr.inc()
    3759         res.sort()
     3759        res.sort(cmp)
    37603760        return res
    37613761
    37623762    def has(self, pattern):
     
    52555255            sage: lcm(x^100-y^100, x^10-y^10)
    52565256            -x^100 + y^100
    52575257            sage: lcm(expand( (x^2+17*x+3/7*y)*(x^5 - 17*y + 2/3) ), expand((x^13+17*x+3/7*y)*(x^5 - 17*y + 2/3)) )
    5258             1/21*(21*x^7 + 357*x^6 + 9*x^5*y - 357*x^2*y + 14*x^2 - 6069*x*y - 153*y^2 + 238*x + 6*y)*(21*x^18 - 357*x^13*y + 14*x^13 + 357*x^6 + 9*x^5*y - 6069*x*y - 153*y^2 + 238*x + 6*y)/(3*x^5 - 51*y + 2)
     5258             1/21*(21*x^18 - 357*x^13*y + 14*x^13 + 357*x^6 + 9*x^5*y -
     5259                     6069*x*y - 153*y^2 + 238*x + 6*y)*(21*x^7 + 357*x^6 +
     5260                             9*x^5*y - 357*x^2*y + 14*x^2 - 6069*x*y -
     5261                             153*y^2 + 238*x + 6*y)/(3*x^5 - 51*y + 2)
    52595262           
    52605263        TESTS:
    52615264       
     
    53285331            sage: f.collect(x)
    53295332            x^2 + x*y - x*z - y*z
    53305333            sage: f.expand().collect(x)
    5331             (y - z)*x + x^2 - y*z
     5334            x^2 + x*(y - z) - y*z
    53325335
    53335336        TESTS:
    53345337
     
    70287031
    70297032            sage: f = x*(x-1)/(x^2 - 7) + y^2/(x^2-7) + 1/(x+1) + b/a + c/a
    70307033            sage: f.normalize()
    7031             (a*x^3 + a*x*y^2 + b*x^3 + c*x^3 + a*x^2 + a*y^2 + b*x^2 + c*x^2 - a*x - 7*b*x - 7*c*x - 7*a - 7*b - 7*c)/((x + 1)*(x^2 - 7)*a)
     7034            (a*x^3 + b*x^3 + c*x^3 + a*x*y^2 + a*x^2 + b*x^2 + c*x^2 +
     7035                    a*y^2 - a*x - 7*b*x - 7*c*x - 7*a - 7*b - 7*c)/((x^2 -
     7036                        7)*a*(x + 1))
    70327037
    70337038        ALGORITHM: Uses GiNaC.
    70347039
     
    74257430
    74267431            sage: f = e^(I*x)
    74277432            sage: f.rectform()
    7428             I*sin(x) + cos(x)
     7433            cos(x) + I*sin(x)
    74297434
    74307435        TESTS:
    74317436
     
    76277632            sage: f = ((x - 1)^(3/2) - (x + 1)*sqrt(x - 1))/sqrt((x - 1)*(x + 1)); f
    76287633            -((x + 1)*sqrt(x - 1) - (x - 1)^(3/2))/sqrt((x + 1)*(x - 1))
    76297634            sage: f.simplify_rational()
    7630             2*sqrt(x - 1)/sqrt(x^2 - 1)
     7635            -2*sqrt(x - 1)/sqrt(x^2 - 1)
    76317636
    76327637        With ``map=True`` each term in a sum is simplified separately
    76337638        and thus the resuls are shorter for functions which are
     
    81358140            sage: var('x,y')
    81368141            (x, y)
    81378142            sage: (x^99 + y^99).factor()
    8138             (x^60 + x^57*y^3 - x^51*y^9 - x^48*y^12 + x^42*y^18+ x^39*y^21
    8139             - x^33*y^27 - x^30*y^30 - x^27*y^33 + x^21*y^39+ x^18*y^42
    8140             - x^12*y^48 - x^9*y^51 + x^3*y^57 + y^60)*(x^20 + x^19*y
    8141             - x^17*y^3 - x^16*y^4 + x^14*y^6 + x^13*y^7 - x^11*y^9
    8142             - x^10*y^10 - x^9*y^11 + x^7*y^13 + x^6*y^14 - x^4*y^16
    8143             - x^3*y^17 + x*y^19 + y^20)*(x^10 - x^9*y + x^8*y^2 - x^7*y^3
    8144             + x^6*y^4 - x^5*y^5 + x^4*y^6 - x^3*y^7 + x^2*y^8 - x*y^9
    8145             + y^10)*(x^6 - x^3*y^3 + y^6)*(x^2 - x*y + y^2)*(x + y)
     8143            (x^60 + x^57*y^3 - x^51*y^9 - x^48*y^12 + x^42*y^18 + x^39*y^21 -
     8144            x^33*y^27 - x^30*y^30 - x^27*y^33 + x^21*y^39 + x^18*y^42 -
     8145            x^12*y^48 - x^9*y^51 + x^3*y^57 + y^60)*(x^20 + x^19*y -
     8146            x^17*y^3 - x^16*y^4 + x^14*y^6 + x^13*y^7 - x^11*y^9 -
     8147            x^10*y^10 - x^9*y^11 + x^7*y^13 + x^6*y^14 - x^4*y^16 -
     8148            x^3*y^17 + x*y^19 + y^20)*(x^10 - x^9*y + x^8*y^2 - x^7*y^3 +
     8149            x^6*y^4 - x^5*y^5 + x^4*y^6 - x^3*y^7 + x^2*y^8 - x*y^9 +
     8150            y^10)*(x^6 - x^3*y^3 + y^6)*(x^2 - x*y + y^2)*(x + y)
    81468151        """
    81478152        from sage.calculus.calculus import symbolic_expression_from_maxima_string, symbolic_expression_from_string
    81488153        if len(dontfactor) > 0:
     
    82018206            (x, u, v)
    82028207            sage: f = expand((2*u*v^2-v^2-4*u^3)^2 * (-u)^3 * (x-sin(x))^3)
    82038208            sage: f.factor()
    8204             -(-4*u^3 + 2*u*v^2 - v^2)^2*u^3*(x - sin(x))^3
     8209            -(4*u^3 - 2*u*v^2 + v^2)^2*u^3*(x - sin(x))^3
    82058210            sage: g = f.factor_list(); g                     
    8206             [(-4*u^3 + 2*u*v^2 - v^2, 2), (u, 3), (x - sin(x), 3), (-1, 1)]
     8211            [(4*u^3 - 2*u*v^2 + v^2, 2), (u, 3), (x - sin(x), 3), (-1, 1)]
    82078212
    82088213        This function also works for quotients::
    82098214       
     
    84818486            (f6, f5, f4, x)
    84828487            sage: e=15*f6*x^2 + 5*f5*x + f4
    84838488            sage: res = e.roots(x); res
    8484             [(-1/30*(5*f5 + sqrt(-60*f4*f6 + 25*f5^2))/f6, 1), (-1/30*(5*f5 - sqrt(-60*f4*f6 + 25*f5^2))/f6, 1)]
     8489            [(-1/30*(5*f5 + sqrt(25*f5^2 - 60*f4*f6))/f6, 1), (-1/30*(5*f5 - sqrt(25*f5^2 - 60*f4*f6))/f6, 1)]
    84858490            sage: e.subs(x=res[0][0]).is_zero()
    84868491            True
    84878492        """
     
    89298934            sage: a.solve(t)
    89308935            []
    89318936            sage: b = a.simplify_radical(); b
    8932             23040*(2.0*e^(1800*t) - 25.0*e^(900*t) + 32.0)*e^(-2400*t)
     8937            -23040*(-2.0*e^(1800*t) + 25.0*e^(900*t) - 32.0)*e^(-2400*t)
    89338938            sage: b.solve(t)
    89348939            []
    89358940            sage: b.solve(t, to_poly_solve=True)
  • sage/symbolic/integration/integral.py

    diff --git a/sage/symbolic/integration/integral.py b/sage/symbolic/integration/integral.py
    a b  
    456456                 x y  + Sqrt[--] FresnelS[Sqrt[--] x]
    457457                             2                 Pi
    458458        sage: print f.integral(x)
    459         y^z*x + 1/8*((I - 1)*sqrt(2)*erf((1/2*I - 1/2)*sqrt(2)*x) + (I + 1)*sqrt(2)*erf((1/2*I + 1/2)*sqrt(2)*x))*sqrt(pi)
     459        x*y^z + 1/8*sqrt(pi)*((I + 1)*sqrt(2)*erf((1/2*I + 1/2)*sqrt(2)*x) + (I - 1)*sqrt(2)*erf((1/2*I - 1/2)*sqrt(2)*x))
    460460
    461461    Alternatively, just use algorithm='mathematica_free' to integrate via Mathematica
    462462    over the internet (does NOT require a Mathematica license!)::
     
    527527    see #3013::
    528528
    529529        sage: integrate(sin(x)*cos(10*x)*log(x), x)
    530         1/198*(11*cos(9*x) - 9*cos(11*x))*log(x) + 1/44*Ei(-11*I*x) - 1/36*Ei(-9*I*x) - 1/36*Ei(9*I*x) + 1/44*Ei(11*I*x)
     530        -1/198*(9*cos(11*x) - 11*cos(9*x))*log(x) + 1/44*Ei(11*I*x) - 1/36*Ei(9*I*x) - 1/36*Ei(-9*I*x) + 1/44*Ei(-11*I*x)
    531531
    532532    It is no longer possible to use certain functions without an
    533533    explicit variable.  Instead, evaluate the function at a variable,
     
    592592        sage: integrate(t*cos(-theta*t),(t,-oo,oo))
    593593        integrate(t*cos(t*theta), t, -Infinity, +Infinity)
    594594
    595     Check if #6189 is fixed (which, by the way, also
    596     demonstrates it's not always good to expand)::
     595    Check if #6189 is fixed::
    597596
    598597        sage: n = N; n
    599598        <function numerical_approx at ...>
     
    603602        0.000000000000000
    604603        sage: integrate( ((F(x)-G(x))^2).expand(), x, -infinity, infinity).n()
    605604        -6.26376265908397e-17
    606         sage: integrate( (F(x)-G(x))^2, x, -infinity, infinity).n()
     605        sage: integrate( (F(x)-G(x))^2, x, -infinity, infinity).n()# abstol 1e-6
    607606        0
    608607
    609608    This was broken before Maxima 5.20::
     
    641640
    642641        sage: actual_result = integral(e^(-1/x^2), x, 0, 1)
    643642        sage: actual_result.full_simplify()
    644         ((e*erf(1) - e)*sqrt(pi) + 1)*e^(-1)
     643        (sqrt(pi)*(erf(1)*e - e) + 1)*e^(-1)
    645644        sage: ideal_result = 1/2*gamma(-1/2, 1)
    646645        sage: error = actual_result - ideal_result
    647646        sage: error.numerical_approx() # abs tol 1e-10
  • sage/symbolic/units.py

    diff --git a/sage/symbolic/units.py b/sage/symbolic/units.py
    a b  
    12781278    You can also convert quantities of units::
    12791279
    12801280        sage: sage.symbolic.units.convert(cos(50) * units.angles.radian, units.angles.degree)
    1281         (180*cos(50)/pi)*degree
     1281        degree*(180*cos(50)/pi)
    12821282        sage: sage.symbolic.units.convert(cos(30) * units.angles.radian, units.angles.degree).polynomial(RR)
    12831283        8.83795706233228*degree
    12841284        sage: sage.symbolic.units.convert(50 * units.length.light_year / units.time.year, units.length.foot / units.time.second)
     
    12871287    Quantities may contain variables (not for temperature conversion, though)::
    12881288
    12891289        sage: sage.symbolic.units.convert(50 * x * units.area.square_meter, units.area.acre)
    1290         (1953125/158080329*x)*acre
     1290        acre*(1953125/158080329*x)
    12911291    """
    12921292    base_target = target
    12931293    z = {}