Domain error with QuadGK to derive Caputo derivative

khaledharizb
Fri, 24 Mar 2023 09:55:37 +0000
General Usage

Hi everyone! I’m trying to evaluate caputo derivative using Quadgk. It works unless when t=3 it gives me Domain error. With Mathematica I got the value -3.11522

using QuadGK, ForwardDiff, SpecialFunctions
f(t)=t^2*sin(t);
g= t-> ForwardDiff.derivative(t->f(t) , t)
F(t) = x-> g(x)/(gamma(1/2)* √(t-x))
caputo(t) = quadgk(F(t), 0, t)[1]
caputo(3)

This is the error
DomainError with 2.9999999999999787: integrand produced Inf in the interval (2.9999999999999574, 3.0)

3 posts - 2 participants