# Ticket #6816: trac_6816-tuples-in-integral.patch

File trac_6816-tuples-in-integral.patch, 2.1 KB (added by kcrisman, 10 years ago)

Based on 4.2.alpha0

• ## sage/calculus/calculus.py

```# HG changeset patch
# User Karl-Dieter Crisman <kcrisman@gmail.com>
# Date 1256019703 14400
# Node ID 8f79b8b62ff68fcdaf6f5c9611894cc0d38889a8
# Parent  59d26b2eff2d5d112b6dfb04f6390ab63eb89876
Allow tuple input for integration - trac 6816.

diff -r 59d26b2eff2d -r 8f79b8b62ff6 sage/calculus/calculus.py```
 a sage: res.subs(y=.5).n() -0.669511708873 Check if #6816 is fixed:: sage: var('t,theta') (t, theta) sage: integrate(t*cos(-theta*t),t,-oo,oo) 0 sage: integrate(t*cos(-theta*t),(t,-oo,oo)) 0 sage: integrate(t*cos(-theta*t),(t)) (t*theta*sin(t*theta) + cos(t*theta))/theta^2 sage: integrate(t*cos(-theta*t),(-oo,oo)) # probably shouldn't be allowed to work, but for now we let it 0 sage: integrate(x^2,(x)) # this worked before 1/3*x^3 sage: integrate(x^2,(x,)) # this didn't 1/3*x^3 sage: integrate(x^2,(1,2)) # this case should always be allowed to work 7/3 sage: integrate(x^2,(x,1,2)) 7/3 sage: integrate(x^2,(x,1,2,3)) Traceback (most recent call last): ... ValueError: (x, 1, 2, 3) is not valid input to integral() Check if #6189 is fixed (which, by the way, also demonstrates it's not always good to expand):: expression = expression(v) elif not is_SymbolicVariable(v): if type(v) is tuple: if len(v)==1: # just a variable return integral(expression,v) elif len(v)==2: # just endpoints, no variable; could be dangerous return integral(expression,v,v) elif len(v)==3: # endpoints and variable return integral(expression,v,v,v) else: raise ValueError, "%s is not valid input to integral()"%repr(v) v = var(repr(v)) #raise TypeError, 'must integrate with respect to a variable'