Opened 14 years ago
Closed 14 years ago
#921 closed defect (fixed)
[with patch] Exception error for divergent integral looks bad
Reported by: | jason | Owned by: | mhansen |
---|---|---|---|
Priority: | major | Milestone: | sage-2.8.9 |
Component: | calculus | Keywords: | |
Cc: | Merged in: | ||
Authors: | Reviewers: | ||
Report Upstream: | Work issues: | ||
Branch: | Commit: | ||
Dependencies: | Stopgaps: |
Description
When asking for a divergent integral, a big exception backtrace is printed. This seems like it would be intimidating for students when a simple statement like at the end, "Integral is divergent" suffices.
sage: integrate(1/x^3,x,0,1) --------------------------------------------------------------------------- <type 'exceptions.TypeError'> Traceback (most recent call last) /home/grout/<ipython console> in <module>() /home/grout/sage/local/lib/python2.5/site-packages/sage/calculus/functional.py in integral(f, *args, **kwds) 173 """ 174 try: --> 175 return f.integral(*args, **kwds) 176 except AttributeError: 177 pass /home/grout/sage/local/lib/python2.5/site-packages/sage/calculus/calculus.py in integral(self, v, a, b) 1663 return self.parent()(self._maxima_().integrate(v)) 1664 else: -> 1665 return self.parent()(self._maxima_().integrate(v, a, b)) 1666 1667 integrate = integral /home/grout/sage/local/lib/python2.5/site-packages/sage/interfaces/maxima.py in integral(self, var, min, max) 1389 if max is None: 1390 raise ValueError, "neither or both of min/max must be specified." -> 1391 return I(var, min, max) 1392 1393 integrate = integral /home/grout/sage/local/lib/python2.5/site-packages/sage/interfaces/expect.py in __call__(self, *args) 885 886 def __call__(self, *args): --> 887 return self._obj.parent().function_call(self._name, [self._obj] + list(args)) 888 889 def help(self): /home/grout/sage/local/lib/python2.5/site-packages/sage/interfaces/expect.py in function_call(self, function, args) 832 if not isinstance(args[i], ExpectElement): 833 args[i] = self.new(args[i]) --> 834 return self.new("%s(%s)"%(function, ",".join([s.name() for s in args]))) 835 836 def call(self, function_name, *args): /home/grout/sage/local/lib/python2.5/site-packages/sage/interfaces/expect.py in new(self, code) 734 735 def new(self, code): --> 736 return self(code) 737 738 ################################################################### /home/grout/sage/local/lib/python2.5/site-packages/sage/interfaces/maxima.py in __call__(self, x) 374 def __call__(self, x): 375 import sage.rings.all --> 376 return Expect.__call__(self, x) 377 378 def __init__(self, script_subdirectory=None, logfile=None, server=None): /home/grout/sage/local/lib/python2.5/site-packages/sage/interfaces/expect.py in __call__(self, x) 679 return x 680 if isinstance(x, basestring): --> 681 return cls(self, x) 682 try: 683 return self._coerce_from_special_method(x) /home/grout/sage/local/lib/python2.5/site-packages/sage/interfaces/expect.py in __init__(self, parent, value, is_name) 920 except (TypeError, KeyboardInterrupt, RuntimeError, ValueError), x: 921 self._session_number = -1 --> 922 raise TypeError, x 923 self._session_number = parent._session_number 924 <type 'exceptions.TypeError'>: Error executing code in Maxima CODE: sage22 : integrate(sage19,sage1,sage20,sage21)$ Maxima ERROR: Integral is divergent
Attachments (1)
Change History (6)
comment:1 Changed 14 years ago by
- Owner changed from was to mhansen
- Summary changed from Exception error for divergent integral looks bad to [with patch] Exception error for divergent integral looks bad
Changed 14 years ago by
comment:2 Changed 14 years ago by
- Milestone changed from sage-2.9 to sage-2.8.9
comment:3 Changed 14 years ago by
Looks good to me.
comment:4 Changed 14 years ago by
applied to 2.8.9.alpha1
comment:5 Changed 14 years ago by
- Resolution set to fixed
- Status changed from new to closed
Note: See
TracTickets for help on using
tickets.
I'm attaching a patch which catches the divergence error and moves it farther up the chain so that the user isn't presented with such a huge error.
Here is the behavior after the patch: