Processing math: 100%
Ask Your Question
3

How do I understand the result of symbolic integrals

asked 14 years ago

Philipp Schneider gravatar image

updated 2 years ago

tmonteil gravatar image

So now I know how to integrate, but when I type in

sage: deriv=diff((exp(x)-1)/x,x); deriv
e^x/x - (e^x - 1)/x^2
sage: deriv.integrate(x)
-1/x + Ei(x) - gamma(-1, -x)

why don't I get back (exp(x)-1)/x +C?

Preview: (hide)

7 Answers

Sort by » oldest newest most voted
1

answered 13 years ago

updated 13 years ago

Incomplete Gamma function and the Ei function are indeed related. See the following pages for example.

http://en.wikipedia.org/wiki/Exponent... http://en.wikipedia.org/wiki/Incomple...

In this sense, the result of the integration is correct.

There is indeed a subtly of brunch cut. Maxima / Sage defines the brunch cut of the function differently from Mathematica. I tested the Maxima result "-1/x + Ei(x) - gamma(-1, -x)" is indeed continuous on the complex plane (i.e. the result has no problem). But the same function in Mathematica is not continuous.

Preview: (hide)
link

Comments

Yeah, see http://trac.sagemath.org/sage_trac/ticket/11164 for another example of how this relationship causes trouble in Maxima/Sage.

kcrisman gravatar imagekcrisman ( 13 years ago )
1

answered 14 years ago

William Stein gravatar image

updated 14 years ago

Maxima is responsible for default symbolic integration in Sage, and nobody understands how Maxima's integration code works. I just tried continuing your example above as follows:

   sage: deriv=diff((exp(x)-1)/x,x); deriv
   sage: f = integrate(deriv, x)
   sage: g = f - (exp(x)-1)/x
   sage: CDF(g(5))
   -1.7776787288 + 2.08166817117e-17*I
   sage: CDF(g(10))
   -4.43650184726 + 2.22044604925e-16*I
   sage: CDF(g(20))
   -0.530325316824 + 2.27373675443e-12*I

So it doesn't even look like f differs from (exp(x)-1)/x by a constant. Branch cuts are probably relevant. I can't wait until we have our symbolic integration code that we actually understand.

Preview: (hide)
link

Comments

Is there any work on rewriting the whole integration functions in sage?

mmarco gravatar imagemmarco ( 13 years ago )
1

answered 13 years ago

achrzesz gravatar image

sage: maxima('gamma_expand:true') true sage: maxima('deriv:diff((exp(x)-1)/x,x)') %e^x/x-(%e^x-1)/x^2 sage: maxima('factor(integrate(deriv,x))') (%e^x-1)/x

Preview: (hide)
link
1

answered 14 years ago

Robert Dodier gravatar image

updated 4 years ago

slelievre gravatar image

Maxima 5.21.1 gives

-1/x-gamma\_incomplete(0,-x)-gamma\_incomplete(-1,-x)

for

integrate(diff((exp(x) - 1)/x, x), x)

which is correct from what I can tell (agrees numerically with the original expression and has the same derivative).

The result isn't as simple as it could be because the integration algorithm is phrased in more general terms, such that the integrand you specified is a special case of some general form. Often that's the most effective way to calculate integrals, since you can cover a lot of special cases with one general form.

Preview: (hide)
link
0

answered 3 years ago

This is a really old question, but the answers omit a significant fact.

Let us say that w = %e^x/x-(%e^x-1)/x^2. As computed here (DERIV ...)

From the given construction we know that ONE anti-derivative of w is (exp(x)-1)/x; but there are an infinite number of anti-derivatives. remember your calculus ... + a constant.

From Maxima we know (in the absence of bugs etc) that another anti-derivative is

-1/x-gamma_incomplete(0,-x)-gamma_incomplete(-1,-x)

They don't have to be the same.

They can differ by a constant. As it happens, they don't. But they could.

Preview: (hide)
link
0

answered 13 years ago

achrzesz gravatar image

In one line:

sage: maxima('integrate(diff((exp(x)-1)/x,x),x),gamma_expand:true,factor').sage()

(e^x - 1)/x

Preview: (hide)
link

Comments

Sounds like we might need to look at `gamma_expand:true` a little more closely!

kcrisman gravatar imagekcrisman ( 13 years ago )
0

answered 14 years ago

kcrisman gravatar image

I wouldn't blame the integration code; these are really hard problems. The problem is that simplification of the integral doesn't work because of logs, so it's left alone. Wolfram Alpha, for instance, simplifies this expression to something that definitely only would work in certain circumstances. Maybe this is another symptom of whether we assume variables are real in our Maxima?

Preview: (hide)
link

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

Stats

Asked: 14 years ago

Seen: 1,387 times

Last updated: Jan 21 '21