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.

Here is my code:

x0 = -50; 
f[xe_] := 
 NIntegrate[-1/(k^6 x1^4)
    48 (k x1 Cos[k x1] - 
     Sin[k x1]) (-1/
       x0^3 (-6 k x0 Cos[2 k x0 - k x1] + 3 k x1 Cos[2 k x0 - k x1] + 
        2 k^3 x0 x1^2 Cos[2 k x0 - k x1] + 
        k^3 x0^3 CosIntegral[
          2 k x0] ((-3 + k^2 x1^2) Cos[k x1] - 3 k x1 Sin[k x1]) + 
        3 Sin[2 k x0 - k x1] + 6 k^2 x0 x1 Sin[2 k x0 - k x1] - 
        k^2 x1^2 Sin[2 k x0 - k x1] + 
        k^3 x0^3 (3 k x1 Cos[k x1] + (-3 + k^2 x1^2) Sin[
             k x1]) SinIntegral[2 k x0]) + 
     1/x1^3 (-3 k x1 Cos[k x1] + 2 k^3 x1^3 Cos[k x1] + 3 Sin[k x1] + 
        5 k^2 x1^2 Sin[k x1] + 
        k^3 x1^3 CosIntegral[
          2 k x1] ((-3 + k^2 x1^2) Cos[k x1] - 3 k x1 Sin[k x1]) + 
        k^3 x1^3 (3 k x1 Cos[k x1] + (-3 + k^2 x1^2) Sin[
             k x1]) SinIntegral[2 k x1])), {x1, xe , x0}, 
  AccuracyGoal -> 20, WorkingPrecision -> 200]
k = 1; 
Plot[f[xe]/(24 Log[E, -xe]^2) , {xe, -10^-45, -10^-50}, PlotRange -> Full]

My problem is that solving and plotting takes a long time with this code. Could someone please help me to find a method to speed it up?

share|improve this question
    
Please edit your question for readability. Instructions can be found here. –  Sjoerd C. de Vries Oct 9 '13 at 12:29
    
What's x2? Also, your function f doesn't seem to use xe? –  wxffles Oct 9 '13 at 20:05
    
sorry x2 should be xe! –  moslem Oct 10 '13 at 13:46
1  
And should x0 be -50 or 10^-50? –  wxffles Oct 10 '13 at 19:01
    
I changed x2 to xe for you. To encourage people to help you, it is better to have code they can copy and paste as is. –  Michael E2 Oct 12 '13 at 21:19
show 3 more comments

Your Answer

 
discard

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

Browse other questions tagged or ask your own question.