Numeric solution for Volterra equation

Hello. Can you please help me, can’t figure out how to use NDSolveValue function.
Sorry, I don’t know how to insert function, so I use latex

\int_0^xcos(x-t)y(t)dt = sin(x)

Screenshot_134.jpg

Exact solution: y(x) = 1.


So how can I use NDSolveValue function to solve this equation numerically?

Sorry if I make post in wrong place. Thanks!

To my knowledge, NDSolve doesn’t do integro-differential equations.

Solution with NIntegrate:

At first we convert Volterra equation of the first kind to the second kind:

y[x] == D[Sin[x], x]*1/(Cos[x - t] /. x -> t) + 
  Integrate[D[Cos[x - t], t]/(Cos[x - t] /. x -> t)*y[t], {t, 0, x}](*If (Cos[t,t] is not a Zero*)

(*y[x] == Cos[x] + Integrate[-(Sin[t - x]*y[t]), {t, 0, x}]*)

Then:

  a = -3; b = 3; Z = 10;(*On range: -3 to 3*)
  Clear[ifunc]
  kernel[x_] := Sin[x]
  func[x_, 0] := kernel[x]
  ifunc[0][x_] := kernel[x]
  
  func[x_?NumericQ, n_Integer] := 
   Cos[x] - NIntegrate[kernel[y - x]*ifunc[n - 1][y], {y, 0, x}, 
     MinRecursion -> 4, AccuracyGoal -> 10]
  
  ifunc[j_Integer /; j >= 1] := 
   ifunc[j] = 
    Module[{vals}, vals = Table[{x, func[x, j]}, {x, a, b, 1/Z}];
     Interpolation[vals]]

 Plot[{1, Evaluate[Table[ifunc[j][x], {j, 0, Z}]][[-1]]}, {x, a, b}, 
  PlotStyle -> {Black, {Dashed, Red}}, 
  PlotRange -> {Automatic, {0, 2}}]
Plot[{1 - Evaluate[Table[ifunc[j][x], {j, 0, Z}]][[-1]]}, {x, a, b}, 
 PlotStyle -> {Black, {Dashed, Red}}](*residuals error*)

Big Thanks!