Ticket #1470: maxima-16.2-fix.patch

File maxima-16.2-fix.patch, 10.5 kB (added by mhansen, 5 months ago)
  • a/sage/calculus/calculus.py

    old new  
    775775            sage: f = integral(sin(x^2)); f 
    776776            sqrt(pi)*((sqrt(2)*I + sqrt(2))*erf((sqrt(2)*I + sqrt(2))*x/2) + (sqrt(2)*I - sqrt(2))*erf((sqrt(2)*I - sqrt(2))*x/2))/8 
    777777            sage: print f 
    778                                                          (sqrt(2)  I + sqrt(2)) x 
    779                    sqrt( pi) ((sqrt(2)  I + sqrt(2)) erf(------------------------) 
    780                                                                     2 
    781                                                                (sqrt(2)  I - sqrt(2)) x 
    782                                   + (sqrt(2)  I - sqrt(2)) erf(------------------------))/8 
    783                                                                           2 
     778                                                    (sqrt(2)  I + sqrt(2)) x 
     779             (sqrt( pi) ((sqrt(2)  I + sqrt(2)) erf(------------------------) 
     780                                                               2 
     781                                                      (sqrt(2)  I - sqrt(2)) x 
     782                         + (sqrt(2)  I - sqrt(2)) erf(------------------------)))/8 
     783                                                                 2 
     784 
     785 
    784786        """ 
    785787        if not self._has_been_simplified(): 
    786788            self = self.simplify() 
     
    21782180 
    21792181            sage: f = log(log(x))/log(x) 
    21802182            sage: forget(); assume(x<-2); lim(f, x=0, taylor=True) 
    2181             und 
     2183            limit(log(log(x))/log(x), x, 0) 
    21822184 
    21832185        Here ind means "indefinite but bounded": 
    21842186            sage: lim(sin(1/x), x = 0) 
     
    24512453                     x y  + Sqrt[--] FresnelS[Sqrt[--] x] 
    24522454                                 2                 Pi 
    24532455            sage: print f.integral(x) 
    2454                   z                                         (sqrt(2)  I + sqrt(2)) x 
    2455                x y  + sqrt( pi) ((sqrt(2)  I + sqrt(2)) erf(------------------------) 
    2456                                                                        2 
    2457                                                            (sqrt(2)  I - sqrt(2)) x 
    2458                               + (sqrt(2)  I - sqrt(2)) erf(------------------------))/8 
    2459                                                                       2 
     2456                        z 
     2457                     x y  + (sqrt( pi) ((sqrt(2)  I + sqrt(2)) 
     2458                 (sqrt(2)  I + sqrt(2)) x 
     2459             erf(------------------------) + (sqrt(2)  I - sqrt(2)) 
     2460                            2 
     2461                 (sqrt(2)  I - sqrt(2)) x 
     2462             erf(------------------------)))/8 
     2463                            2 
    24602464                                                                           
    24612465        We integrate the above function in maple now: 
    24622466            sage: g = maple(f); g                             # optional -- requires maple 
     
    26262630        """ 
    26272631        try: 
    26282632            v = self._maxima_().quad_qags(var(x), 
    2629                                       a, b, desired_relative_error, 
    2630                                       maximum_num_subintervals) 
     2633                                      a, b, epsrel=desired_relative_error, 
     2634                                      limit=maximum_num_subintervals) 
    26312635        except TypeError, err: 
    26322636            if "ERROR" in str(err): 
    26332637                raise ValueError, "Maxima (via quadpack) cannot compute the integral to that precision" 
    26342638            else: 
    26352639                raise TypeError, err 
     2640 
     2641        #This is just a work around until there is a response to  
     2642        #http://www.math.utexas.edu/pipermail/maxima/2008/012975.html 
     2643        if 'quad_qags' in str(v): 
     2644            raise ValueError, "Maxima (via quadpack) cannot compute the integral to that precision" 
    26362645             
    26372646        return float(v[0]), float(v[1]), Integer(v[2]), Integer(v[3]) 
    26382647 
  • a/sage/calculus/desolvers.py

    old new  
    132132        sage: f = function('f', x) 
    133133        sage: de = lambda y: diff(y,x,x) - 2*diff(y,x) + y 
    134134        sage: desolve_laplace(de(f(x)),["x","f"]) 
    135         "x*%e^x*(?%at('diff(f(x),x,1),x=0))-f(0)*x*%e^x+f(0)*%e^x" 
     135        "x*%e^x*('at('diff(f(x),x,1),x=0))-f(0)*x*%e^x+f(0)*%e^x" 
    136136        sage: desolve_laplace(de(f(x)),["x","f"],[0,1,2]) 
    137137         'x*%e^x+%e^x' 
    138138 
  • a/sage/combinat/combinat.py

    old new  
    14251425    When $x = 1$, this coincides with Riemann's zeta function. The Dirichlet L-functions  
    14261426    may be expressed as a linear combination of Hurwitz zeta functions. 
    14271427 
     1428    Note that if you use floting point inputs, then the results may be slightly off. 
     1429 
    14281430    EXAMPLES: 
    14291431        sage: hurwitz_zeta(3,1/2,6) 
    14301432        8.41439000000000 
    1431         sage: hurwitz_zeta(1.1,1/2,6) 
     1433        sage: hurwitz_zeta(11/10,1/2,6) 
    14321434        12.1041000000000 
    1433         sage: hurwitz_zeta(1.1,1/2,50) 
    1434         12.103813495683744469025853545548130581952676591199 
     1435        sage: hurwitz_zeta(11/10,1/2,50) 
     1436        12.103813495683755105709077412966680619033648618088 
    14351437 
    14361438    REFERENCES: 
    14371439        http://en.wikipedia.org/wiki/Hurwitz_zeta_function 
  • a/sage/functions/piecewise.py

    old new  
    504504        interval endpoints. 
    505505 
    506506        EXAMPLES: 
    507             sage: x = PolynomialRing(QQ, 'x').0 
     507            sage: R.<x> = QQ['x'] 
    508508            sage: f1 = x^0 
    509509            sage: f2 = 10*x - x^2 
    510510            sage: f3 = 3*x^4 - 156*x^3 + 3036*x^2 - 26208*x 
    511511            sage: f = Piecewise([[(0,3),f1],[(3,10),f2],[(10,20),f3]]) 
    512             sage: f.critical_points() 
    513             [5.0, 12.000000000000171, 12.9999999999996, 14.000000000000229] 
     512            sage: expected = [5, 12, 13, 14] 
     513            sage: all(abs(e-a) < 0.001 for e,a in zip(expected, f.critical_points())) 
     514            True 
    514515        """ 
    515516        maxima = sage.interfaces.all.maxima 
    516517        x = PolynomialRing(QQ,'x').gen() 
  • a/sage/interfaces/expect.py

    old new  
    10911091    def _object_class(self): 
    10921092        return ExpectElement 
    10931093 
    1094     def function_call(self, function, args=[]): 
     1094    def function_call(self, function, args=[], kwds={}): 
     1095        """ 
     1096        EXAMPLES: 
     1097            sage: maxima.quad_qags(x, x, 0, 1, epsrel=1e-4) 
     1098            [0.5,5.5511151231257...E-15,21,0] 
     1099            sage: maxima.function_call('quad_qags', [x, x, 0, 1], {'epsrel':'1e-4'}) 
     1100            [0.5,5.5511151231257...E-15,21,0] 
     1101        """ 
    10951102        if function == '': 
    10961103            raise ValueError, "function name must be nonempty" 
    10971104        if function[:2] == "__": 
     
    11011108        for i in range(len(args)): 
    11021109            if not isinstance(args[i], ExpectElement): 
    11031110                args[i] = self.new(args[i]) 
    1104         return self.new("%s(%s)"%(function, ",".join([s.name() for s in args]))) 
     1111        for key, value in kwds.iteritems(): 
     1112            kwds[key] = self.new(value) 
     1113 
     1114        return self.new("%s(%s)"%(function, ",".join([s.name() for s in args]+ 
     1115                                                     ['%s=%s'%(key,value.name()) for key, value in kwds.items()]))) 
    11051116             
    1106     def call(self, function_name, *args): 
    1107         return self.function_call(function_name, args
     1117    def call(self, function_name, *args, **kwds): 
     1118        return self.function_call(function_name, args, kwds
    11081119 
    11091120    def _contains(self, v1, v2): 
    11101121        raise NotImplementedError 
     
    11561167    def __repr__(self): 
    11571168        return "%s"%self._name 
    11581169     
    1159     def __call__(self, *args): 
    1160         return self._parent.function_call(self._name, list(args)
     1170    def __call__(self, *args, **kwds): 
     1171        return self._parent.function_call(self._name, list(args), kwds
    11611172         
    11621173         
    11631174class FunctionElement(SageObject): 
     
    11711182    def __repr__(self): 
    11721183        return "%s"%self._name 
    11731184 
    1174     def __call__(self, *args): 
    1175         return self._obj.parent().function_call(self._name, [self._obj] + list(args)
     1185    def __call__(self, *args, **kwds): 
     1186        return self._obj.parent().function_call(self._name, [self._obj] + list(args), kwds
    11761187     
    11771188    def help(self): 
    11781189        print self._sage_doc_() 
  • a/sage/interfaces/maxima.py

    old new  
    624624        if self._expect is None: return 
    625625        r = randrange(2147483647) 
    626626        s = marker + str(r+1) 
    627         cmd = '''sconc("%s",(%s+1));\n'''%(marker,r) 
     627        cmd = '''sconcat("%s",(%s+1));\n'''%(marker,r) 
    628628        self._sendstr(cmd) 
    629629        try: 
    630630            self._expect_expr(timeout=0.5) 
     
    919919         
    920920        EXAMPLES: 
    921921            sage: maxima.version() 
    922             '5.13.0
     922            '5.16.2
    923923        """ 
    924924        return maxima_version() 
    925925 
     
    11201120            sage: maxima.clear('x'); maxima.clear('f')             
    11211121            sage: f = maxima.de_solve_laplace("diff(f(x),x,2) = 2*diff(f(x),x)-f(x)", ["x","f"]) 
    11221122            sage: f 
    1123             f(x)=x*%e^x*(?%at('diff(f(x),x,1),x=0))-f(0)*x*%e^x+f(0)*%e^x 
     1123            f(x)=x*%e^x*('at('diff(f(x),x,1),x=0))-f(0)*x*%e^x+f(0)*%e^x 
    11241124            sage: print f 
    11251125                                               ! 
    11261126                                   x  d        !                  x          x 
     
    15711571            0.52848223531423071361790491935415653021675547587292866196865279321015401702040079 
    15721572        """ 
    15731573        from sage.rings.all import Integer 
    1574         v = self.quad_qags(var, a, b, desired_relative_error, 
    1575                            maximum_num_subintervals) 
     1574        v = self.quad_qags(var, a, b, epsrel=desired_relative_error, 
     1575                           limit=maximum_num_subintervals) 
    15761576        return v[0], v[1], Integer(v[2]), Integer(v[3]) 
    15771577 
    15781578    def integral(self, var='x', min=None, max=None):