0
$\begingroup$

I am do a symbolic definite integral, I am doing it like this:

Integrate[1/Sqrt[(ϵ + u)^2 + Δ^2], ϵ] // FullSimplify

It gives an output:

Log[u + ϵ + Sqrt[Δ^2 + (u + ϵ)^2]]

then I copy this output and define a function respect to the integrate variable:

F2[ϵ_] := Log[u + ϵ + Sqrt[Δ^2 + (u + ϵ)^2]]

Finally I can substitute the upper and lower limit to F2 and obtain my results:

F2[ξ - u] - F2[m]

I don't like the manually copy step. So how do you do this automatically?

$\endgroup$
2
  • $\begingroup$ You ask different questions in the title and body of the post. Please make them the same. It's confusing as it stands. For a definite integral use the syntax Integrate[ 1/Sqrt[(\[Epsilon] + u)^2 + \[CapitalDelta]^2], {\[Epsilon], \[Xi] - u, m}] as described in the documentation. It will take longer and will result in a conditional expression because Mma will try to make sure that the function is not doing anything funny inbetween the integration bounds (which is the most difficult step of symbolic definite integration). $\endgroup$
    – Szabolcs
    Mar 24, 2014 at 15:22
  • $\begingroup$ @Szabolcs I have edit it. $\endgroup$ Mar 26, 2014 at 1:30

2 Answers 2

3
$\begingroup$

Maybe you would like to automate the process even more, by defining a function that does all the steps in your calculation at once:

definiteIntegral[integrand_, {x_, xMin_, xMax_}] := 
 Module[{antiDerivative = Integrate[integrand, x]}, 
  Simplify[Subtract @@ (antiDerivative /. x -> {xMax, xMin})]]

definiteIntegral[
 1/Sqrt[(ϵ + u)^2 + Δ^2], {x, m, ξ - u}]

(* ==> (-m - u + ξ)/Sqrt[Δ^2 + (u + ϵ)^2] *)

As the name implies, definiteIntegral does the definite integral of the expression in the first argument, but unlike Mathematica's built-in integration algorithm, it doesn't get slowed to a crawl by attempting to analyze the integration limits (given as the second argument together with the integration variable).

I took this approach from this answer.

$\endgroup$
1
  • $\begingroup$ This is best way to do so I think! Thanks! $\endgroup$ Mar 26, 2014 at 1:38
3
$\begingroup$

You can do this:

In[20]:= Integrate[1/Sqrt[(ϵ + u)^2 + Δ^2], ϵ] // FullSimplify

Out[20]= Log[u + ϵ + Sqrt[Δ^2 + (u + ϵ)^2]]

In[21]:= F2[ϵ_] = %

Out[21]= Log[u + ϵ + Sqrt[Δ^2 + (u + ϵ)^2]]

Note that I used =, not := to make sure % gets expanded before the definition is recorded.

$\endgroup$

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.