Skip to content

Commit

Permalink
Piecewise: Fixed piecewise integration error
Browse files Browse the repository at this point in the history
Before this change, when attempting to integrate a
piecewise function (or a function that internally
gets converted to a piecewise function
(like 1/Abs(x)), if some part of the
function on some interval evaluates to
some type of infinity at an endpoint of
the interval it could result in the indefinite
integral containing an added infinity or being nan
on that interval. This change fixes this issue.

Example

In [1]: from sympy import *

In [2]: x = Symbol('x', real=True)

In [3]: integrate(1/Abs(x))

Out [3]: Piecewise((-log(x), x <= 0), (log(x), True))

Before this change, integrate(1/Abs(x)) resulted in
Piecewise((-log(x), x <= 0), (nan, True))
  • Loading branch information
NikhilSDate committed Nov 22, 2021
1 parent 2523e2b commit d462325
Showing 1 changed file with 337 additions and 342 deletions.
Loading

0 comments on commit d462325

Please sign in to comment.