I have a problem when I want to solve this integro-differential equation where the $\chi' (U)$ appears in the integrand. If statement gives the $chiIntegral=0$ for $umax=20$ since the upper bound of the integral becomes smaller than the lower bound so it properly solves a homogeneous differential equation.
However when i set $umax$ to higher values $10^8-10^{10}$, I get error, because then if statement tries to calculate the integral which does not work due to the following message:
NIntegrate::inumr: The integrand (chiPrime[U] SphericalBesselJ[2,1126.62 -U])/(1126.62 -U)^2 has evaluated to non-numerical values for all sampling points in the region with boundaries {{1125.74,1126.62}}.
My humble guess is that it does not understand maybe how to handle $\chi'$ inside the integral since knowing $\chi'$ requires the priori of $\chi$
Here is the code:
(Initial conditions and plot range)
umin = 10^-15; umax = 20; Clear[chiPrime]; (Initial condition is chi(umin)=1 and chi'(umin)=0)
chiInitCond = {chi[umin] == 1, chi'[umin] == 0}; (Define epsilon to have no singularity when U -> u in chiIntegral)
epsilon = 10^-25; (Kernel:j2/(u-U)^2)
j2[x_] := SphericalBesselJ[2, x]; kernel[u_, U_] := j2[u - U]/(u - U)^2; (Memoized integral function using chiPrime)
Clear[chiIntegral] chiIntegral[u_?NumericQ] := If[u > uNuDec + epsilon, NIntegrate[kernel[u, U]*chiPrime[U], {U, uNuDec, u - epsilon}, Method -> "GaussKronrodRule", MaxRecursion -> 20, AccuracyGoal -> 6, PrecisionGoal -> 6], 0] (Define the first-order system)
chiEqSystem = {chi'[u] == chiPrime[u], chiPrime'[u] == -2 aURatioscaled[u] chiPrime[u] - chi[u] - 24 fNuScaled[u]*(aURatioscaled[u]^2)*chiIntegral[u]}; (Initial conditions)
chiInitCond = {chi[umin] == 1, chiPrime[umin] == 0}; (Solve)
chiSolutionNonHomog = NDSolve[Join[chiEqSystem, chiInitCond], {chi, chiPrime}, {u, umin, umax}, Method -> "StiffnessSwitching", MaxSteps -> Infinity, AccuracyGoal -> 8, PrecisionGoal -> 8]; My question is: how to fix this issue?


a'[u]/a! Are you using the same symbol for function and parameter? $\endgroup$