Question: error with in diff

dear all

am trying to do a task that Find all the roots of the equation (or three roots if there are more than three roots in the equation) by Newton's method f(x) = e^x^2 sin(x-5) accuracy = 10^-5 maple

and i wrote this code on maple 

f := x -> exp(x^2)*sin(x - 5);
df := x -> evalf(diff(f(x), x));
x0 := -1.0;
tol := 0.00001;
for i to 3 do
    x := x0;
    n := 0;
    while tol < abs(f(x)) do
        x := x - f(x)/df(x);
        n := n + 1;
    end do;
    printf("Root %d: %.5f (found in %d iterations)\n", i, x, n);
    x0 := x + 1.0;
end do;
f := proc (x) options operator, arrow; exp(x^2)*sin(x-5) end proc

 df := proc (x) options operator, arrow; evalf(diff(f(x), x)) 

    end proc


                           x0 := -1.0

                         tol := 0.00001

                           x := -1.0

                             n := 0

 

am getting an error message

" Error, (in df) invalid input: diff received -1.0, which is not valid for its 2nd argument "

hope you can help me with this issue

Please Wait...