Question: Question about Maple performance

I use Maple 11 on windows (Processor Intel Centrino 1.4 Ghz and 512 Mb RAM).

I have problem with plotting of my function. Time of ploting is about 30-40 seconds. I try to use evalhf in different way for my function, but get different errors. My problem is that function in example is the most simple case in my physics model. It is ideal case, but in other not ideal case time of plotting increasing to 200 or 300 seconds. It's very dramatically for me :(

My example is:

w := (z,g) -> .1469061274e-2*(1/Im((piecewise(z < .1950000000,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.1950000000-z)+.8050000000+.8050000000*z*(-2+2*g)+z],[-2.+2*g,(-2.+2*g)*(.1950000000-z)-.6100000000+1.610000000*g]]),piecewise(z < .2050000000,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.2050000000-z)+.7950000000+.7950000000*z*(-2+2*g)+z],[-2.+2.*g,(-2.+2.*g)*(.2050000000-z)-.5900000000+1.590000000*g]]),piecewise(z < .5,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.5-z)+.5+.5*z*(-2+2*g)+z],[-2.+2.*g,(-2.+2.*g)*(.5-z)+1.0*g]]),Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(1-z)+z],[-2.+2.*g,(-2.+2.*g)*(1-z)+1.]]))))[2,2]-piecewise(z < .1950000000,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.1950000000-z)+.8050000000+.8050000000*z*(-2+2*g)+z],[-2.+2*g,(-2.+2*g)*(.1950000000-z)-.6100000000+1.610000000*g]]),piecewise(z < .2050000000,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.2050000000-z)+.7950000000+.7950000000*z*(-2+2*g)+z],[-2.+2.*g,(-2.+2.*g)*(.2050000000-z)-.5900000000+1.590000000*g]]),piecewise(z < .5,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.5-z)+.5+.5*z*(-2+2*g)+z],[-2.+2.*g,(-2.+2.*g)*(.5-z)+1.0*g]]),Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(1-z)+z],[-2.+2.*g,(-2.+2.*g)*(1-z)+1.]]))))[1,1])/piecewise(z < .1950000000,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.1950000000-z)+.8050000000+.8050000000*z*(-2+2*g)+z],[-2.+2*g,(-2.+2*g)*(.1950000000-z)-.6100000000+1.610000000*g]]),piecewise(z < .2050000000,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.2050000000-z)+.7950000000+.7950000000*z*(-2+2*g)+z],[-2.+2.*g,(-2.+2.*g)*(.2050000000-z)-.5900000000+1.590000000*g]]),piecewise(z < .5,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.5-z)+.5+.5*z*(-2+2*g)+z],[-2.+2.*g,(-2.+2.*g)*(.5-z)+1.0*g]]),Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(1-z)+z],[-2.+2.*g,(-2.+2.*g)*(1-z)+1.]]))))[1,2]+2*I*((1-(1/2*piecewise(z < .1950000000,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.1950000000-z)+.8050000000+.8050000000*z*(-2+2*g)+z],[-2.+2*g,(-2.+2*g)*(.1950000000-z)-.6100000000+1.610000000*g]]),piecewise(z < .2050000000,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.2050000000-z)+.7950000000+.7950000000*z*(-2+2*g)+z],[-2.+2.*g,(-2.+2.*g)*(.2050000000-z)-.5900000000+1.590000000*g]]),piecewise(z < .5,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.5-z)+.5+.5*z*(-2+2*g)+z],[-2.+2.*g,(-2.+2.*g)*(.5-z)+1.0*g]]),Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(1-z)+z],[-2.+2.*g,(-2.+2.*g)*(1-z)+1.]]))))[2,2]+1/2*piecewise(z < .1950000000,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.1950000000-z)+.8050000000+.8050000000*z*(-2+2*g)+z],[-2.+2*g,(-2.+2*g)*(.1950000000-z)-.6100000000+1.610000000*g]]),piecewise(z < .2050000000,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.2050000000-z)+.7950000000+.7950000000*z*(-2+2*g)+z],[-2.+2.*g,(-2.+2.*g)*(.2050000000-z)-.5900000000+1.590000000*g]]),piecewise(z < .5,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.5-z)+.5+.5*z*(-2+2*g)+z],[-2.+2.*g,(-2.+2.*g)*(.5-z)+1.0*g]]),Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(1-z)+z],[-2.+2.*g,(-2.+2.*g)*(1-z)+1.]]))))[1,1])^2)/piecewise(z < .1950000000,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.1950000000-z)+.8050000000+.8050000000*z*(-2+2*g)+z],[-2.+2*g,(-2.+2*g)*(.1950000000-z)-.6100000000+1.610000000*g]]),piecewise(z < .2050000000,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.2050000000-z)+.7950000000+.7950000000*z*(-2+2*g)+z],[-2.+2.*g,(-2.+2.*g)*(.2050000000-z)-.5900000000+1.590000000*g]]),piecewise(z < .5,Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(.5-z)+.5+.5*z*(-2+2*g)+z],[-2.+2.*g,(-2.+2.*g)*(.5-z)+1.0*g]]),Matrix(2, 2, [[1.+z*(-2+2*g),(1.+z*(-2+2*g))*(1-z)+z],[-2.+2.*g,(-2.+2.*g)*(1-z)+1.]]))))[1,2]^2)^(1/2)))^(1/2);

beginTime := time();
for i from 0 by 0.1 to 0.9 do
sprintf("f(%f) = %f", i, Re(f(i)));
end do;
finishTime = time() - beginTime;
                                   503.960
                          "f(0.000000) = 0.000843"
                          "f(0.100000) = 0.000867"
                          "f(0.200000) = 0.000896"
                          "f(0.300000) = 0.000929"
                          "f(0.400000) = 0.000969"
                          "f(0.500000) = 0.001018"
                          "f(0.600000) = 0.001081"
                          "f(0.700000) = 0.001166"
                          "f(0.800000) = 0.001295"
                          "f(0.900000) = 0.001547"
                             finishTime = 6.430

beginTime := time();
plot('f(g)', g=-0.99..0.99, numpoints=20);
finishTime = time() - beginTime;
                                   510.390
                                (here is plot)
                             finishTime = 38.796

evalhf(w(0.5, 0.9));
Error, unable to evaluate expression to hardware floats: [[.9000000000, .9500000000], [-.200000000, .9000000000]]

f := (g) -> evalf[20](Int(w(z, g), z=0.0..1.0));

f(-0.2);
evalhf(f(0.9));


                      0.00080427788849247864994 + 0. I
Error, unable to evaluate function `evalf[20]` in evalhf

evalhf(Int(w(z, 0.9), z=0.0..1.0));
Error, unable to evaluate function `Int` in evalhf
 

Please Wait...