On Sat, 21 Jan 2023 at 14:34, Georgi Guninski <ggunin...@gmail.com> wrote: > > I got an integral, which fails the derivative check. > > For real positive x, define > f(x)=2^(x - 1/2*I*log(-e^(-2*I*pi*x))/pi - 1/2) > f(x) is just an obfuscation of 2^floor(x) and > for all positive x, f(x) is integer. > Let g(x) be the indefinite integral of f(x) > and let gder(x)=g'(x). > Assuming correct computations, we should have > > gder(x)=g'(x)=f(x) (*) > > According to sage, gder is the constant $1$ > and (*) fails. > > Some questions: > 1. What other CASes say about g(x)?
In this case SymPy gives: In [34]: f = 2**(x-S(1)/2*I*log(-E**(-2*I*pi*x))/pi-S(1)/2) In [35]: print(f.integrate(x)) sqrt(2)*2**x*x/(2*2**(I*log(-exp(-2*I*pi*x))/(2*pi))) In [36]: print(f.integrate(x).diff(x)) sqrt(2)*2**x/(2*2**(I*log(-exp(-2*I*pi*x))/(2*pi))) In [37]: print(expand(f.integrate(x).diff(x) - f)) 0 In [38]: print(f.diff(x)) 0 In [39]: print(simplify(f.integrate(x)/f)) x > 2. Why the derivative test fails? Antiderivatives are not well defined for functions with jump discontinuities. A true antiderivative only exists for functions having the intermediate value property: https://en.wikipedia.org/wiki/Darboux%27s_theorem_(analysis) Since a true antiderivative does not exist the question is what can integrate do or what guarantees should be expected of the result that it returns? Generally symbolic antiderivatives of discontinuous functions should be understood as being only defined up to a piecewise constant function. Another way to think about this is that when you add a constant of integration like +C to your antiderivative it should be +C(x) where C(x) is a function whose derivative is zero almost everywhere but that might be discontinuous at the same places as the integrand. Algorithms for finding antiderivatives rely on differentiation which should also be understood as being well defined only where a function actually is differentiable. It is not possible for those algorithms to guarantee that what is returned is a symbolic expression for an antiderivative that always matches the integral of a function over *any* chosen interval [a,b] if the function is not continuous in all of [a,b]. > 3. Besides the jumps at integer, do branches of log() > give instability? > > Some comments suggest discontinuous functions > cause integral problems. There are built-in > discontinuous functions like tan() which are > widely used. > > 4. Why tan() integrals are used without problems (?) > when this fails the derivative check? In the case of `tan` you still need to understand any antiderivative as being limited to intervals of width pi. You could not for example use the expression of an antiderivative for tan to compute the integral of tan(x) between 0 and 2*pi. -- Oscar -- You received this message because you are subscribed to the Google Groups "sage-devel" group. To unsubscribe from this group and stop receiving emails from it, send an email to sage-devel+unsubscr...@googlegroups.com. To view this discussion on the web visit https://groups.google.com/d/msgid/sage-devel/CAHVvXxT%3DmernUer71ZAabNUhc%3DFL5kWoMNi%3Dg-cK8ViH6gvOvg%40mail.gmail.com.