Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Differentiating and integrating sums #14211

Open
ghost opened this issue Feb 14, 2018 · 0 comments
Open

Differentiating and integrating sums #14211

ghost opened this issue Feb 14, 2018 · 0 comments
Labels

Comments

@ghost
Copy link

ghost commented Feb 14, 2018

>>> diff(Sum(x**k, (k,0,oo)).doit(), x)
⎧    1                  
⎪─────────   for │x│ < 1
⎪        2              
⎪(-x + 1)               
⎪                       
⎪  ∞                    
⎪ ____                  
⎨ ╲                     
⎪  ╲      k             
⎪   ╲  k⋅x              
⎪   ╱  ────   otherwise 
⎪  ╱    x               
⎪ ╱                     
⎪ ‾‾‾‾                  
⎩k = 0                  
>>> diff(Sum((-1)**n*sin(n*x)/n, (n,1,oo)).doit(), x)
  ∞                 
 ___                
 ╲                  
  ╲       n         
  ╱   (-1) ⋅cos(n⋅x)
 ╱                  
 ‾‾‾                
n = 1                            
>>> integrate(Sum((-1)**k*x**k, (k,0,oo)).doit(), (x,0,1))
Traceback (most recent call last):

  File "<ipython-input-29-af18c14c7097>", line 1, in <module>
    integrate(Sum((-1)**k*x**k, (k,0,oo)).doit(), (x,0,1))

  File ".\sympy\integrals\integrals.py", line 1295, in integrate
    risch=risch, manual=manual)

  File ".\sympy\integrals\integrals.py", line 486, in doit
    conds=conds)

  File ".\sympy\integrals\integrals.py", line 767, in _eval_integral
    return f._eval_integral(x)

  File ".\sympy\functions\elementary\piecewise.py", line 200, in _eval_integral
    return self.func(*[(integrate(e, x), c) for e, c in self.args])

  File ".\sympy\functions\elementary\piecewise.py", line 200, in <listcomp>
    return self.func(*[(integrate(e, x), c) for e, c in self.args])

  File "C:\Users\Roland\Anaconda3\lib\site-packages\sympy\integrals\integrals.py", line 1295, in integrate
    risch=risch, manual=manual)

  File ".\sympy\integrals\integrals.py", line 486, in doit
    conds=conds)

  File ".\sympy\integrals\integrals.py", line 919, in _eval_integral
    result = manualintegrate(g, x)

  File ".\sympy\integrals\manualintegrate.py", line 1223, in manualintegrate
    return _manualintegrate(integral_steps(f, var))

  File ".\sympy\integrals\manualintegrate.py", line 1013, in integral_steps
    fallback_rule)(integral)

  File ".\sympy\strategies\core.py", line 85, in do_one_rl
    result = rl(expr)

  File ".\sympy\strategies\core.py", line 85, in do_one_rl
    result = rl(expr)

  File ".\sympy\strategies\core.py", line 65, in null_safe_rl
    result = rule(expr)

  File ".\sympy\integrals\manualintegrate.py", line 747, in trig_substitution_rule
    b_positive = ((b.is_number and b > 0) or b.is_positive)

  File ".\sympy\core\expr.py", line 301, in __gt__
    raise TypeError("Invalid NaN comparison")

TypeError: Invalid NaN comparison
>>> integrate(Sum((-1)**k*x**k, (k,0,oo)).doit(), (x,0,1))
Traceback (most recent call last):

  File "<ipython-input-33-af18c14c7097>", line 1, in <module>
    integrate(Sum((-1)**k*x**k, (k,0,oo)).doit(), (x,0,1))

  File ".\sympy\integrals\integrals.py", line 1295, in integrate
    risch=risch, manual=manual)

  File ".\sympy\integrals\integrals.py", line 553, in doit
    evalued = Add(*others)._eval_interval(x, a, b)

  File ".\sympy\functions\elementary\piecewise.py", line 272, in _eval_interval
    int_expr = self._sort_expr_cond(sym, a, b)

  File ".\sympy\functions\elementary\piecewise.py", line 343, in _sort_expr_cond
    lower, upper = cond.lts, cond.gts  # part 1: initialize with givens

AttributeError: 'And' object has no attribute 'lts'
>>> Sum(integrate((-1)**k*x**k, (x,0,1)), (k,0,oo)).doit()
  ∞                
_____              
╲                  
 ╲          1      
  ╲         ⌠      
   ╲      k ⎮  k   
   ╱  (-1) ⋅⎮ x  dx
  ╱         ⌡      
 ╱          0      
╱                  
‾‾‾‾‾              
k = 0              
@ghost ghost changed the title Differentiating and integrating sums Differentiating sums Feb 14, 2018
@ghost ghost changed the title Differentiating sums Differentiating and integrating sums Feb 14, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant