I'm trying to evaluate an integral (which is a part of Caputo fractional derivative). Because it depends on both x and t I usually have a function wrapper that chooses a concrete x and things get going. I found that it's usually okay but when q is 0.7-9 or 1.7-9 for certain x's the NIntegrate does not converge. (Here I put x as a rational because I found it helps in evaluation for some reason.)

Here is one random instance of this:

q = 0.8;
NIntegrate[D[Sech[t],{t, Ceiling[q]}] (x-t)^(Ceiling[q]-q-1), {t,0,x}] /. x->241/50

Another x to try can be 103/50.

I've tried changing AccuracyGoal, MaxRecursion, Method but not with much luck. I have feeling that with proper Method it will find a good answer. It's been giving me some answers that are unstable -- they depend on the chosen Method, other times it gives me a complex answer which shouldn't be true.

I also plotted the integrand for when x is 241/50 and up to that x it looks convergent so I don't know where the problem is.


  • $\begingroup$ Try changing variables to u = x-t $\endgroup$
    – Carl Woll
    Jun 7 '17 at 6:25
  • $\begingroup$ There is an integrable singularity at the right endpoint (x, that is) so it is not surprising there might be convergence issues. $\endgroup$ Jun 7 '17 at 15:00

Maybe you can just change variables from t to u = x - t? For example:

q = .8;
foo[x_] := NIntegrate[
    {u, 0, x}




  • $\begingroup$ That's beautiful and it works! One question: why do the bounds go from 0 to x instead of x to 0? When t = 0, u = x, when t = x, u = 0 $\endgroup$
    – Buddhapus
    Jun 7 '17 at 6:58
  • $\begingroup$ du = -dt so I included this sign change in the limits $\endgroup$
    – Carl Woll
    Jun 7 '17 at 7:00

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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