# HG changeset patch
# User André Apitzsch <andre.apitzsch@st.ovgu.de>
# Date 1336896459 -7200
# Node ID f83aa160d6e5d28c6351a071032c8fa3502b6661
# Parent  aa148c3c0d7b06fd049b9e845eebeda2421d32bf
trac 12907: replace some deprecated python functions in sage/calculus

diff --git a/sage/calculus/calculus.py b/sage/calculus/calculus.py
--- a/sage/calculus/calculus.py
+++ b/sage/calculus/calculus.py
@@ -545,10 +545,10 @@
         if isinstance(v, str):
             v = var(v)
         else:
-            raise TypeError, "need a summation variable"
+            raise TypeError("need a summation variable")
 
     if v in SR(a).variables() or v in SR(b).variables():
-        raise ValueError, "summation limits must not depend on the summation variable"
+        raise ValueError("summation limits must not depend on the summation variable")
 
     if algorithm == 'maxima':
         return maxima.sr_sum(expression,v,a,b)
@@ -557,12 +557,12 @@
         try:
             sum = "Sum[%s, {%s, %s, %s}]" % tuple([repr(expr._mathematica_()) for expr in (expression, v, a, b)])
         except TypeError:
-            raise ValueError, "Mathematica cannot make sense of input"
+            raise ValueError("Mathematica cannot make sense of input")
         from sage.interfaces.mathematica import mathematica
         try:
             result = mathematica(sum)
         except TypeError:
-            raise ValueError, "Mathematica cannot make sense of: %s" % sum
+            raise ValueError("Mathematica cannot make sense of: %s" % sum)
         return result.sage()
 
     elif algorithm == 'maple':
@@ -571,7 +571,7 @@
         try:
             result = maple(sum).simplify()
         except TypeError:
-            raise ValueError, "Maple cannot make sense of: %s" % sum
+            raise ValueError("Maple cannot make sense of: %s" % sum)
         return result.sage()
 
     elif algorithm == 'giac':
@@ -580,11 +580,11 @@
         try:
             result = giac(sum)
         except TypeError:
-            raise ValueError, "Giac cannot make sense of: %s" % sum
+            raise ValueError("Giac cannot make sense of: %s" % sum)
         return result.sage()
 
     else:
-        raise ValueError, "unknown algorithm: %s" % algorithm
+        raise ValueError("unknown algorithm: %s" % algorithm)
 
 def nintegral(ex, x, a, b,
               desired_relative_error='1e-8',
@@ -716,17 +716,17 @@
         v = ex._maxima_().quad_qags(x, a, b,
                                     epsrel=desired_relative_error,
                                     limit=maximum_num_subintervals)
-    except TypeError, err:
+    except TypeError as err:
         if "ERROR" in str(err):
-            raise ValueError, "Maxima (via quadpack) cannot compute the integral"
+            raise ValueError("Maxima (via quadpack) cannot compute the integral")
         else:
-            raise TypeError, err
+            raise TypeError(err)
 
     # Maxima returns unevaluated expressions when the underlying library fails
     # to perfom numerical integration. See:
     # http://www.math.utexas.edu/pipermail/maxima/2008/012975.html
     if 'quad_qags' in str(v):
-        raise ValueError, "Maxima (via quadpack) cannot compute the integral"
+        raise ValueError("Maxima (via quadpack) cannot compute the integral")
 
     return float(v[0]), float(v[1]), Integer(v[2]), Integer(v[3])
 
@@ -945,16 +945,16 @@
                             elif epsilon and error < epsilon:
                                 return g
                             elif algorithm is not None:
-                                raise NotImplementedError, "Could not prove minimal polynomial %s (epsilon %s)" % (g, RR(error).str(no_sci=False))
+                                raise NotImplementedError("Could not prove minimal polynomial %s (epsilon %s)" % (g, RR(error).str(no_sci=False)))
 
         if algorithm is not None:
-            raise ValueError, "Could not find minimal polynomial (%s bits, degree %s)." % (bits, degree)
+            raise ValueError("Could not find minimal polynomial (%s bits, degree %s)." % (bits, degree))
 
     if algorithm is None or algorithm == 'algebraic':
         from sage.rings.all import QQbar
         return QQ[var](QQbar(ex).minpoly())
 
-    raise ValueError, "Unknown algorithm: %s" % algorithm
+    raise ValueError("Unknown algorithm: %s" % algorithm)
 
 
 ###################################################################
@@ -1145,7 +1145,7 @@
         ex = SR(ex)
 
     if len(argv) != 1:
-        raise ValueError, "call the limit function like this, e.g. limit(expr, x=2)."
+        raise ValueError("call the limit function like this, e.g. limit(expr, x=2).")
     else:
         k = argv.keys()[0]
         v = var(k)
@@ -1183,7 +1183,7 @@
             import sympy
             l = sympy.limit(ex._sympy_(), v._sympy_(), a._sympy_())
         else:
-            raise NotImplementedError, "sympy does not support one-sided limits"
+            raise NotImplementedError("sympy does not support one-sided limits")
 
     #return l.sage()
     return ex.parent()(l)
@@ -1421,7 +1421,7 @@
             kwds[str(c.lhs())]=c.rhs()
     else:
         if len(args) !=0:
-            raise TypeError,"at can take at most one argument, which must be a list"
+            raise TypeError("at can take at most one argument, which must be a list")
                 
     return ex.subs(**kwds)
 
@@ -1675,7 +1675,7 @@
     syms = sage.symbolic.pynac.symbol_table.get('maxima', {}).copy()
 
     if len(x) == 0:
-        raise RuntimeError, "invalid symbolic expression -- ''"
+        raise RuntimeError("invalid symbolic expression -- ''")
     maxima.set('_tmp_',x)
 
     # This is inefficient since it so rarely is needed:
@@ -1748,7 +1748,7 @@
         is_simplified = True
         return symbolic_expression_from_string(s, syms, accept_sequence=True)
     except SyntaxError:
-        raise TypeError, "unable to make sense of Maxima expression '%s' in Sage"%s
+        raise TypeError("unable to make sense of Maxima expression '%s' in Sage"%s)
     finally:
         is_simplified = False
 
diff --git a/sage/calculus/desolvers.py b/sage/calculus/desolvers.py
--- a/sage/calculus/desolvers.py
+++ b/sage/calculus/desolvers.py
@@ -86,14 +86,14 @@
       
       - for a second-order boundary solution, specify initial and
         final ``x`` and ``y`` boundary conditions, i.e. write `[x_0, y(x_0), x_1, y(x_1)]`.
-        
+
       - gives an error if the solution is not SymbolicEquation (as happens for 
         example for Clairaut equation)
-       
+
     - ``ivar`` - (optional) the independent variable (hereafter called
       x), which must be specified if there is more than one
       independent variable in the equation.
-                    
+
     - ``show_method`` - (optional) if true, then Sage returns pair
       ``[solution, method]``, where method is the string describing
       method which has been used to get solution (Maxima uses the
@@ -124,7 +124,7 @@
         sage: y = function('y', x)
         sage: desolve(diff(y,x) + y - 1, y)
         (c + e^x)*e^(-x)
-    
+
     ::
 
         sage: f = desolve(diff(y,x) + y - 1, y, ics=[10,2]); f
@@ -141,7 +141,6 @@
         sage: de = diff(y,x,2) - y == x
         sage: desolve(de, y)
         k1*e^x + k2*e^(-x) - x
-        
 
     ::
 
@@ -166,7 +165,7 @@
 
     ::
 
-        sage: desolve(de, y, [0,1,pi/2,4]) 
+        sage: desolve(de, y, [0,1,pi/2,4])
         4*sin(x) + cos(x)
 
     ::
@@ -178,7 +177,7 @@
 
         sage: desolve(diff(y,x)^2+x*diff(y,x)-y==0,y,contrib_ode=True,show_method=True)
         [[y(x) == c^2 + c*x, y(x) == -1/4*x^2], 'clairault']
-    
+
     For equations involving more variables we specify independent variable::
 
         sage: a,b,c,n=var('a b c n')
@@ -248,17 +247,17 @@
     condition at x=0, since this point is singlar point of the
     equation. Anyway, if the solution should be bounded at x=0, then
     k2=0.::
-            
+
         sage: desolve(x^2*diff(y,x,x)+x*diff(y,x)+(x^2-4)*y==0,y)
         k1*bessel_j(2, x) + k2*bessel_y(2, x)
-    
+
     Difficult ODE produces error::
 
         sage: desolve(sqrt(y)*diff(y,x)+e^(y)+cos(x)-sin(x+y)==0,y) # not tested
         Traceback (click to the left for traceback)
         ...
         NotImplementedError, "Maxima was unable to solve this ODE. Consider to set option contrib_ode to True."
-        
+
     Difficult ODE produces error - moreover, takes a long time ::
 
         sage: desolve(sqrt(y)*diff(y,x)+e^(y)+cos(x)-sin(x+y)==0,y,contrib_ode=True) # not tested
@@ -269,7 +268,7 @@
         [[y(x) == c + log(x), y(x) == c*e^x], 'factor']
 
     ::
-    
+
         sage: desolve(diff(y,x)==(x+y)^2,y,contrib_ode=True,show_method=True)
         [[[x == c - arctan(sqrt(t)), y(x) == -x - sqrt(t)], [x == c + arctan(sqrt(t)), y(x) == -x + sqrt(t)]], 'lagrange']
 
@@ -377,7 +376,7 @@
         x
 
     ::
-    
+
         sage: desolve( diff(y,x,x) == 0, y, [0,1,1])
         x + 1
 
@@ -395,10 +394,9 @@
         sage: x=var('x'); f=function('f',x); k=var('k'); assume(k>0)
         sage: desolve(diff(f,x,2)/f==k,f,ivar=x)
         k1*e^(sqrt(k)*x) + k2*e^(-sqrt(k)*x)
-    
-        
+
     AUTHORS:
- 
+
     - David Joyner (1-2006)
 
     - Robert Bradshaw (10-2008)
@@ -409,7 +407,7 @@
     if is_SymbolicEquation(de):
         de = de.lhs() - de.rhs()
     if is_SymbolicVariable(dvar):
-        raise ValueError, "You have to declare dependent variable as a function, eg. y=function('y',x)"
+        raise ValueError("You have to declare dependent variable as a function, eg. y=function('y',x)")
     # for backwards compatibility
     if isinstance(dvar, list):
         dvar, ivar = dvar
@@ -417,10 +415,10 @@
         ivars = de.variables()
         ivars = [t for t in ivars if t is not dvar]
         if len(ivars) != 1:
-            raise ValueError, "Unable to determine independent variable, please specify."
+            raise ValueError("Unable to determine independent variable, please specify.")
         ivar = ivars[0]
     def sanitize_var(exprs):
-        return exprs.replace("'"+dvar_str+"("+ivar_str+")",dvar_str)    
+        return exprs.replace("'"+dvar_str+"("+ivar_str+")",dvar_str)
     de00 = de._maxima_()
     P = de00.parent()
     dvar_str=P(dvar.operator()).str()
@@ -428,7 +426,7 @@
     de00 = de00.str()
     de0 = sanitize_var(de00)
     ode_solver="ode2"
-    cmd="(TEMP:%s(%s,%s,%s), if TEMP=false then TEMP else substitute(%s=%s(%s),TEMP))"%(ode_solver,de0,dvar_str,ivar_str,dvar_str,dvar_str,ivar_str)    
+    cmd="(TEMP:%s(%s,%s,%s), if TEMP=false then TEMP else substitute(%s=%s(%s),TEMP))"%(ode_solver,de0,dvar_str,ivar_str,dvar_str,dvar_str,ivar_str)
     # we produce string like this
     # ode2('diff(y,x,2)+2*'diff(y,x,1)+y-cos(x),y(x),x)
     soln = P(cmd)
@@ -437,14 +435,14 @@
         if contrib_ode:
             ode_solver="contrib_ode"
             P("load('contrib_ode)")
-            cmd="(TEMP:%s(%s,%s,%s), if TEMP=false then TEMP else substitute(%s=%s(%s),TEMP))"%(ode_solver,de0,dvar_str,ivar_str,dvar_str,dvar_str,ivar_str)    
+            cmd="(TEMP:%s(%s,%s,%s), if TEMP=false then TEMP else substitute(%s=%s(%s),TEMP))"%(ode_solver,de0,dvar_str,ivar_str,dvar_str,dvar_str,ivar_str)
             # we produce string like this
             # (TEMP:contrib_ode(x*('diff(y,x,1))^2-(x*y+1)*'diff(y,x,1)+y,y,x), if TEMP=false then TEMP else substitute(y=y(x),TEMP))
             soln = P(cmd)
             if str(soln).strip() == 'false':
-                raise NotImplementedError, "Maxima was unable to solve this ODE."    
+                raise NotImplementedError("Maxima was unable to solve this ODE.")
         else:
-            raise NotImplementedError, "Maxima was unable to solve this ODE. Consider to set option contrib_ode to True."
+            raise NotImplementedError("Maxima was unable to solve this ODE. Consider to set option contrib_ode to True.")
 
     if show_method:
         maxima_method=P("method")
@@ -453,7 +451,7 @@
         if not is_SymbolicEquation(soln.sage()):
             if not show_method:
                 maxima_method=P("method")
-            raise NotImplementedError, "Unable to use initial condition for this equation (%s)."%(str(maxima_method).strip())
+            raise NotImplementedError("Unable to use initial condition for this equation (%s)."%(str(maxima_method).strip()))
         if len(ics) == 2:
             tempic=(ivar==ics[0])._maxima_().str()
             tempic=tempic+","+(dvar==ics[1])._maxima_().str()
@@ -480,7 +478,7 @@
             # (TEMP:ic2(ode2('diff(y,x,2)+2*'diff(y,x,1)+y-cos(x),y,x),x=0,y=3,'diff(y,x)=1),substitute(y=y(x),TEMP))
             soln=P(cmd)
             if str(soln).strip() == 'false':
-                raise NotImplementedError, "Maxima was unable to solve this IVP. Remove the initial condition to get the general solution."    
+                raise NotImplementedError("Maxima was unable to solve this IVP. Remove the initial condition to get the general solution.")
         if len(ics) == 4:
             #fixed bc2 command from Maxima - we have to ensure that %k1, %k2 do not depend on variables, should be removed when fixed in Maxima 
             P("bc2_sage(soln,xa,ya,xb,yb):=block([programmode:true,backsubst:true,singsolve:true,temp,%k1,%k2,TEMP_k], \
@@ -490,13 +488,13 @@
                 temp: maplist(lambda([zz], subst(zz,soln)),TEMP_k), \
                 if length(temp)=1 then return(first(temp)) else return(temp))")
             cmd="bc2_sage(%s(%s,%s,%s),%s,%s=%s,%s,%s=%s)"%(ode_solver,de00,dvar_str,ivar_str,P(ivar==ics[0]).str(),dvar_str,P(ics[1]).str(),P(ivar==ics[2]).str(),dvar_str,P(ics[3]).str())
-            cmd="(TEMP:%s,substitute(%s=%s(%s),TEMP))"%(cmd,dvar_str,dvar_str,ivar_str)            
+            cmd="(TEMP:%s,substitute(%s=%s(%s),TEMP))"%(cmd,dvar_str,dvar_str,ivar_str)
             cmd=sanitize_var(cmd)
             # we produce string like this
             # (TEMP:bc2(ode2('diff(y,x,2)+2*'diff(y,x,1)+y-cos(x),y,x),x=0,y=3,x=%pi/2,y=2),substitute(y=y(x),TEMP))
             soln=P(cmd)
             if str(soln).strip() == 'false':
-                raise NotImplementedError, "Maxima was unable to solve this BVP. Remove the initial condition to get the general solution."    
+                raise NotImplementedError("Maxima was unable to solve this BVP. Remove the initial condition to get the general solution.")
 
     soln=soln.sage()
     if is_SymbolicEquation(soln) and soln.lhs() == dvar:
@@ -550,13 +548,12 @@
 #    #return maxima.eval(cmd)
 #    return de0.desolve(vars[0]).rhs()
 
-    
 def desolve_laplace(de, dvar, ics=None, ivar=None):
     """
     Solves an ODE using laplace transforms. Initials conditions are optional.
 
     INPUT:
-    
+
     - ``de`` - a lambda expression representing the ODE (eg, de =
       diff(y,x,2) == diff(y,x)+sin(x))
 
@@ -647,7 +644,7 @@
     if is_SymbolicEquation(de):
         de = de.lhs() - de.rhs()
     if is_SymbolicVariable(dvar):
-        raise ValueError, "You have to declare dependent variable as a function, eg. y=function('y',x)"
+        raise ValueError("You have to declare dependent variable as a function, eg. y=function('y',x)")
     # for backwards compatibility
     if isinstance(dvar, list):
         dvar, ivar = dvar
@@ -655,7 +652,7 @@
         ivars = de.variables()
         ivars = [t for t in ivars if t != dvar]
         if len(ivars) != 1:
-            raise ValueError, "Unable to determine independent variable, please specify."
+            raise ValueError("Unable to determine independent variable, please specify.")
         ivar = ivars[0]
     ## verbatim copy from desolve - end
 
@@ -666,7 +663,7 @@
     cmd = sanitize_var("desolve("+de0.str()+","+str(dvar)+")")
     soln=P(cmd).rhs()
     if str(soln).strip() == 'false':
-        raise NotImplementedError, "Maxima was unable to solve this ODE."    
+        raise NotImplementedError("Maxima was unable to solve this ODE.")
     soln=soln.sage()
     if ics!=None:
         d = len(ics)
@@ -679,7 +676,7 @@
     """
     Solves any size system of 1st order ODE's. Initials conditions are optional.
     
-    Onedimensional systems are passed to :meth:`desolve_laplace`. 
+    Onedimensional systems are passed to :meth:`desolve_laplace`.
 
     INPUT:
     
@@ -739,7 +736,7 @@
     if ivar is None:
         ivars = ivars - set(vars)
         if len(ivars) != 1:
-            raise ValueError, "Unable to determine independent variable, please specify."
+            raise ValueError("Unable to determine independent variable, please specify.")
         ivar = list(ivars)[0]
     dvars = [v._maxima_() for v in vars]
     if ics is not None:
@@ -748,7 +745,7 @@
             dvar.atvalue(ivar==ivar_ic, ic)
     soln = dvars[0].parent().desolve(des, dvars)
     if str(soln).strip() == 'false':
-        raise NotImplementedError, "Maxima was unable to solve this system."
+        raise NotImplementedError("Maxima was unable to solve this system.")
     soln = list(soln)
     for i, sol in enumerate(soln):
         soln[i] = sol.sage()
@@ -757,7 +754,6 @@
         for dvar, ic in zip(dvars, ics[:1]):
             dvar.atvalue(ivar==ivar_ic, dvar)
     return soln
-        
 
 def desolve_system_strings(des,vars,ics=None):
     r"""
@@ -822,7 +818,6 @@
         sage: P2 = parametric_plot((solnx,solny),(0,1))
 
     Now type show(P1), show(P2) to view these.
-                      
 
     AUTHORS: 
 
@@ -918,13 +913,13 @@
     - David Joyner
     """
     if algorithm=="table":
-        print "%10s %20s %25s"%("x","y","h*f(x,y)")
+        print("%10s %20s %25s"%("x","y","h*f(x,y)"))
     n=int((1.0)*(x1-x0)/h)
     x00=x0; y00=y0
     soln = [[x00,y00]]
     for i in range(n+1):
         if algorithm=="table":
-            print "%10r %20r %20r"%(x00,y00,h*f(x00,y00))
+            print("%10r %20r %20r"%(x00,y00,h*f(x00,y00)))
         y00 = y00+h*f(x00,y00)
         x00=x00+h
         soln.append([x00,y00])
@@ -1012,13 +1007,13 @@
     - David Joyner
     """
     if algorithm=="table":
-        print "%10s %20s %25s %20s %20s"%("t", "x","h*f(t,x,y)","y", "h*g(t,x,y)")
+        print("%10s %20s %25s %20s %20s"%("t", "x","h*f(t,x,y)","y", "h*g(t,x,y)"))
     n=int((1.0)*(t1-t0)/h)
     t00 = t0; x00 = x0; y00 = y0
     soln = [[t00,x00,y00]]
     for i in range(n+1):
         if algorithm=="table":
-            print "%10r %20r %25r %20r %20r"%(t00,x00,h*f(t00,x00,y00),y00,h*g(t00,x00,y00))
+            print("%10r %20r %25r %20r %20r"%(t00,x00,h*f(t00,x00,y00),y00,h*g(t00,x00,y00)))
         x01 = x00 + h*f(t00,x00,y00)
         y00 = y00 + h*g(t00,x00,y00)
         x00 = x01
@@ -1082,12 +1077,12 @@
         sage: from sage.calculus.desolvers import desolve_rk4_determine_bounds
         sage: desolve_rk4_determine_bounds([0,2],1)
         (0, 1)
-   
+
     ::
 
-        sage: desolve_rk4_determine_bounds([0,2])  
+        sage: desolve_rk4_determine_bounds([0,2])
         (0, 10)
-   
+
     ::
 
         sage: desolve_rk4_determine_bounds([0,2],[-2])
@@ -1107,7 +1102,6 @@
         return (min(ics[0],end_points[0]),max(ics[0],end_points[0]))
     else:
         return (min(ics[0],end_points[0]),max(ics[0],end_points[1]))
-    
 
 def desolve_rk4(de, dvar, ics=None, ivar=None, end_points=None, step=0.1, output='list', **kwds):
     """
@@ -1115,7 +1109,7 @@
     equation. See also ``ode_solver``.
 
     INPUT:
-    
+
     input is similar to ``desolve`` command. The differential equation can be 
     written in a form close to the plot_slope_field or desolve command
 
@@ -1179,7 +1173,7 @@
 
         sage: x,y=var('x y')
         sage: P=desolve_rk4(y*(2-y),y,ics=[0,.1],ivar=x,output='slope_field',end_points=[-4,6],thickness=3)
-                
+
     ALGORITHM:
 
     4th order Runge-Kutta method. Wrapper for command ``rk`` in
@@ -1191,13 +1185,13 @@
     - Robert Marik (10-2009)
     """
     if ics is None: 
-        raise ValueError, "No initial conditions, specify with ics=[x0,y0]."
+        raise ValueError("No initial conditions, specify with ics=[x0,y0].")
 
     if ivar is None:
         ivars = de.variables()
         ivars = [t for t in ivars if t != dvar]
         if len(ivars) != 1:
-            raise ValueError, "Unable to determine independent variable, please specify."
+            raise ValueError("Unable to determine independent variable, please specify.")
         ivar = ivars[0]
 
     if not is_SymbolicVariable(dvar):
@@ -1210,7 +1204,7 @@
         # consider to add warning if the solution is not unique
         de=solve(de,diff(dvar,ivar),solution_dict=True)
         if len(de) != 1:
-            raise NotImplementedError, "Sorry, cannot find explicit formula for right-hand side of the ODE."
+            raise NotImplementedError("Sorry, cannot find explicit formula for right-hand side of the ODE.")
         de=de[0][diff(dvar,ivar)].subs(dvar==dummy_dvar)
     else:
         dummy_dvar=dvar
@@ -1254,8 +1248,7 @@
             if t<YMIN:YMIN=t
         return plot_slope_field(de,(ivar,XMIN,XMAX),(dummy_dvar,YMIN,YMAX))+R
 
-    raise ValueError, "Option output should be 'list', 'plot' or 'slope_field'."
-
+    raise ValueError("Option output should be 'list', 'plot' or 'slope_field'.")
 
 def desolve_system_rk4(des, vars, ics=None, ivar=None, end_points=None, step=0.1):
     r"""
@@ -1317,7 +1310,7 @@
     """
 
     if ics is None: 
-        raise ValueError, "No initial conditions, specify with ics=[x0,y01,y02,...]."
+        raise ValueError("No initial conditions, specify with ics=[x0,y01,y02,...].")
 
     ivars = set([])
 
@@ -1326,7 +1319,7 @@
     if ivar is None:
         ivars = ivars - set(vars)
         if len(ivars) != 1:
-            raise ValueError, "Unable to determine independent variable, please specify."
+            raise ValueError("Unable to determine independent variable, please specify.")
         ivar = list(ivars)[0]
 
     dess = [de._maxima_().str() for de in des]
@@ -1362,7 +1355,7 @@
 , rtol=None, atol=None, tcrit=None, h0=0.0, hmax=0.0, hmin=0.0, ixpr=0
 , mxstep=0, mxhnil=0, mxordn=12, mxords=5, printmessg=0):
     r"""
-    Solves numerically a system of first-order ordinary differential equations 
+    Solves numerically a system of first-order ordinary differential equations
     using ``odeint`` from scipy.integrate module.
 
     INPUT:
@@ -1378,7 +1371,7 @@
 
     - ``ivar`` -- independent variable, optional.
 
-    - ``compute_jac`` -- boolean. If True, the Jacobian of des is computed and 
+    - ``compute_jac`` -- boolean. If True, the Jacobian of des is computed and
       used during the integration of Stiff Systems. Default value is False.
 
     Other Parameters (taken from the documentation of odeint function from 
@@ -1514,7 +1507,7 @@
                 safe_names = [ 't_' + str(dvars) ]
             ivar = map(var, safe_names)
         else:
-            raise ValueError, "Unable to determine independent variable, please specify."
+            raise ValueError("Unable to determine independent variable, please specify.")
 
     # one-dimensional systems:
     if is_SymbolicVariable(dvars):
@@ -1548,8 +1541,8 @@
             def Dfun(y,t):
                 v = list(y[:])
                 v.append(t)
-                return [[element(*v) for element in row] for row in J]      
-        
+                return [[element(*v) for element in row] for row in J]
+
     sol=odeint(func, ics, times, args=args, Dfun=Dfun, rtol=rtol, atol=atol,
         tcrit=tcrit, h0=h0, hmax=hmax, hmin=hmin, ixpr=ixpr, mxstep=mxstep,
         mxhnil=mxhnil, mxordn=mxordn, mxords=mxords, printmessg=printmessg)
diff --git a/sage/calculus/functions.py b/sage/calculus/functions.py
--- a/sage/calculus/functions.py
+++ b/sage/calculus/functions.py
@@ -32,7 +32,7 @@
                               | f'  g' |
 
     EXAMPLES::
-    
+
         sage: wronskian(e^x, x^2)
         -x^2*e^x + 2*x*e^x
 
@@ -76,7 +76,7 @@
     - Dan Drake (2008-03-12)
     """
     if len(args) == 0:
-        raise TypeError, 'wronskian() takes at least one argument (0 given)'
+        raise TypeError('wronskian() takes at least one argument (0 given)')
     elif len(args) == 1:
         # a 1x1 Wronskian is just its argument
         return args[0]
