Question: Why are args being changed to integers?

The following code is part of my attempt to answer the recent Question about the bifurcation of the map f:= x-> exp(x^2*(a-x)). Two very weird things are happening. They can be seen by applying trace to f. The first is that the input argument to f seems to be changed to a very large integer. The second is that for some real values of a and x, I get imaginary results from this obviously real-valued function. Why are these things happening?

restart:

f:= x-> exp(x^2*(a-x)):

trace(f):

Iterate:= proc(a, x0:= 1., n:= 2000)
local A:= hfarray(1..n, [x0]), f:= subs(:-a= a, eval(:-f));          
     #evalhf(
          proc(f, A, n)
          local k;
               for k from 2 to n do A[k]:= f(A[k-1]) end do
          end proc
          (f, A, n);
     #);
     evalf[4]~(convert(A[1000..], set))
end proc:

Iterate(1.05);

{--> enter f, args = 4607182418800017408

 

HFloat(1.0512710963760241)

 

<-- exit f (now in unknown) = 4607413323290551347}
{--> enter f, args = 4607413323290551347

 

HFloat(0.9985962074909431)

 

<-- exit f (now in unknown) = 4607169774561176020}
{--> enter f, args = 4607169774561176020

 

HFloat(1.0525960836530153)

 

Warning,  computation interrupted

 

Iterate(.75);

{--> enter f, args = 4607182418800017408

 

.754589752755861+.192678397202388*I

 

<-- exit f (now in unknown) = HFloat(0.7545897527558614)+HFloat(0.19267839720238844)*I}

Error, (in unknown) unable to store 'HFloat(0.7545897527558614)+HFloat(0.19267839720238844)*I' when datatype=float[8]

 

 

 

Download bifurcation.mw

Please Wait...