Question: Solve integral equation numerically by int(numeric) or evalf(Int)

Hello

The problem is translate Mathematica code to Maple to find  numerical solution using int(numeric).

I have a more complicated example and here I gives a very simplified version.

I use  successive approximations to solve integral-equation with symbolic int it's easy to do,but with numeric int  I'm failed

MMA code:

func[x_, 0] := x
ifunc[0][x_] := x
func[x_?NumericQ, n_Integer] := x + NIntegrate[(x - y)*ifunc[n - 1][y], {y, 0, x}]
ifunc[j_Integer] := ifunc[j] = Interpolation[Table[{x, func[x, j]}, {x, -3, 3, 0.2}]]

Plot[{Sinh[x], ifunc[n][x] /. n -> 4}, {x, -3, 3}]


My first attempt to translate:

ifunc := proc (n, x) options operator, arrow; x end proc;

ifunc(0, x) := x;

func(x, 0) := x;

func := proc (x, n) x+int((x-t)*ifunc(n-1, t), t = 0 .. x, numeric) end proc;

T := proc (j) option remember;

Interpolation:-Interpolate([seq(x, x = -2 .. 2, .1)], [seq(func(x, j), x = -2 .. 2, .1)], method = cubic)

end proc;

plot([sinh(x), (T(4))(x)], x = -2 .. 2);

See attached file for more info.

Thanks.

test_numeric_volterra.mw

EDITED :----------------------------------------------------------

Third attempt:

func(x, 0) := x;

(ifunc(0))(x) := x:

func := proc (x, n) option remember; x+int((x-t)*(ifunc(n-1))(t), t = 0 .. x, numeric) end proc;

ifunc := proc (j) local f; option remember;

ifunc(0) := proc (t) options operator, arrow; t end proc;

f := proc (t) options operator, arrow;

CurveFitting:-Spline([seq(x, x = -3 .. 3, .1)], [seq(func(x, j), x = -3 .. 3, .1)], x, degree = 1) end proc end proc;

n := 4; plot([sinh(x), (ifunc(n))(x)], x = -3 .. 3)# for n=4 diverge !!!

Please Wait...