Hello
I have made some experimentations, but I can't find
where is a bug in a simple piece of code
I represent a polynome by a list of its
coefficents
(I know that there is a more efficient way to do
this calculation (P(x) in fact), but it is just an
expermimentation)
let horner p x =
let v= Array.of_list p
in
let n = Array.length v in
let r = ref n in
let
f = ref (function u ->u ) in
while !r <> 0
do
f := (function u -> !f( v.(!r)+
x*u));
r := !r -1 ;
done;
!f(0)
;;
In theory, the !f(0) call shall give me
P(x)...
But it seems that the computer crash, and can't
handle this line of code...
Someone has an idea?
Thank you