# Integrating an integral

Hi community.

I'm interested in manipulating a formal expression

$$\int \mathrm{d}t \; e^{- 2 \int \mathrm{d}t \; h(t)}.$$

My notebook contains the following code

var('t')
h = function('h')(t)
integrate(exp(integrate(-2*h,t)),t)


but the result is +Infinity.

QUESTION(S):

• Why I am getting a result if the function h is not explicit?
• Where does the +Infinity come from?
edit retag close merge delete

1

The culprit is giac:

sage: integrate(exp(integrate(-2*h,t)),t,algorithm='giac')
+Infinity

( 2022-10-09 16:20:11 +0100 )edit
1

Interestingly :

sage: integrate(e^(-2*integrate(h(t), t, algorithm="sympy")), t, algorithm="sympy")
integrate(e^(-2*integrate(h(t), t)), t)
sage: mathematica.Integrate(e^(-2*mathematica.Integrate(h(t), t)), t)
Integrate[exp[-2*Integrate[H[t], t]], t]
sage: mathematica.Integrate(e^(-2*mathematica.Integrate(h(t), t)), t).sage()
Integrate(e^(-2*Integrate(h(t), t)), t)


Enhanceable ?

sage: mathematica.Integrate(e^(-2*mathematica.Integrate(h(t), t)), t).sage(locals={("Integrate", 1):integrate})
// Giac share root-directory:/usr/share/giac/
// Giac share root-directory:/usr/share/giac/
+Infinity


Indeed, Giac misbehaves.

( 2022-10-10 11:13:12 +0100 )edit

And :

sage: integrate(e^(-2*integrate(h(t), t, algorithm="maxima")), t, algorithm="maxima")
integrate(e^(-2*integrate(h(t), t)), t)


Maxima is correct.

Would you mind filing a ticket ?

( 2022-10-10 11:14:49 +0100 )edit

Sort by » oldest newest most voted

Thanks to the comment by @fredericc I found the answer! The solution is to use the algorithm='maxima' flag, e.g.

var('t')
h = function('h')(t)
integrate(exp(integrate(-2*h,t)),t, algorithm='maxima')


With the above, I can also manipulate the expression... differentiate or other:

var('t')
h = function('h')(t)
HH = function('HH')(t)
HH = exp(integrate(2*h,t))*(Cg + k*integrate(exp(integrate(-2*h,t)),t, algorithm='maxima'))
diff(HH,t)


The above result is compatible with the by-hand calculation and the result by Mathematica

more