Dr. Stein: The assume() command worked. Thanks. Tim: Thanks for your reply, too. I noticed that I was integrating wrt y twice after I sent off the email, but the result was still the same if you change the outermost integration to be wrt x.
Thanks On Dec 4, 3:07 pm, "William Stein" <[EMAIL PROTECTED]> wrote: > On Thu, Dec 4, 2008 at 12:57 PM, Vijay <[EMAIL PROTECTED]> wrote: > > > Hi: I am trying to evaluate a double integral (since I cannot put > > LaTeX, the 'S' below > > stands for the integral sign:) > > > 1 sqrt(x) > > S S 4xy - y^3 dy dx > > 0 x^3 > > > This is what I put into sage: > > > sage: var('x,y') > > (x, y) > > sage: f=4*x*y-y^3 > > sage: print f > > 3 > > 4 x y - y > > > sage: print integrate(integrate(f,y,x^3,x^0.5),y,0,1) > > --------------------------------------------------------------------------- > > TypeError Traceback (most recent call > > last) > > > /home/vkg/sage-3.1.1/<ipython console> in <module>() > > > /home/vkg/sage-3.1.1/local/lib/python2.5/site-packages/sage/calculus/ > > functional. > > py in integral(f, *args, **kwds) > > 252 """ > > 253 try: > > --> 254 return f.integral(*args, **kwds) > > 255 except ValueError, err: > > 256 raise err > > > /home/vkg/sage-3.1.1/local/lib/python2.5/site-packages/sage/calculus/ > > calculus.py > > in integral(self, v, a, b) > > 2523 raise ValueError, "Integral is divergent." > > 2524 else: > > -> 2525 raise TypeError, error > > 2526 > > 2527 > > > TypeError: Computation failed since Maxima requested additional > > constraints (use > > assume): > > Is x positive or negative? > > > Am I doing something wrong here? > > Use the assume command to get past this. Here's a complete session that shows > what to do: > > sage: var('x,y') > sage: f=4*x*y-y^3 > sage: print f > 3 > 4 x y - y > sage: print integrate(integrate(f,y,x^3,x^0.5),y,0,1) > boom > sage: forget(); assume(x>0) > sage: print integrate(integrate(f,y,x^3,x^0.5),y,0,1) > 12 7 2.0 2 > x - 8 x x - 8 x > ---------- - ----------- > 4 4 > sage: forget(); assume(x<0) > sage: print integrate(integrate(f,y,x^3,x^0.5),y,0,1) > Traceback (most recent call last): > ... > TypeError: Error executing code in Maxima > > Do you think it would be better if instead of > > sage: print integrate(integrate(f,y,x^3,x^0.5),y,0,1) > ... Is x positive or negative? > > one saw: > ... Is x positive or negative? (Try using the assume command.) > > William --~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---