Question: commands outside proc() does not give the same inside the proc()

Hi,,

Here is what I am doing outside a proc()

> r := 1 .. 3;
                                 r := 1 .. 3
> borne := map(x -> round(x*10^Digits), evalf(r));
                     borne := 10000000000 .. 30000000000
> f := rand(borne):

> f();
                                 16402031176
> seq((evalf@ f))()/10^Digits, i = 1 .. 5);

       2.378774299, 1.880990746, 1.175548697, 2.485195033, 2.068402719

Now, I do i t in a proc()

restart:
uniform := proc (r::(constant .. constant))
local borne, f;
borne := map(x -> round(x*10^Digits), evalf(r));
f := rand(borne):
(evalf@f)()/10^Digits;
end proc:

and here is what I have as a result

 

> U := uniform(1 .. 3);
> seq(U(), i = 1 .. 5);
       2.776173849, 2.776173849, 2.776173849, 2.776173849, 2.776173849
> U();
                                 2.776173849

In the advanced programming guide page 12, the command

(evalf@f)()/10^Digits;

is replace by

(evalf@eval(f))/10^Digits;

I would like to know how this make such a difference.

 

Mario

 

Please Wait...