Take the 2-minute tour ×
Mathematica Stack Exchange is a question and answer site for users of Mathematica. It's 100% free, no registration required.

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?

share|improve this question
    
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). –  Szabolcs Mar 24 at 15:22
    
@Szabolcs I have edit it. –  luming Mar 26 at 1:30
add comment

2 Answers 2

up vote 3 down vote accepted

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.

share|improve this answer
    
This is best way to do so I think! Thanks! –  luming Mar 26 at 1:38
add comment

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.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

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