Q: compiling causes problems in evaluating functions?
Subject: Q: compiling causes problems in evaluating functions?
From: Richard Fateman
Date: Sun, 22 Apr 2007 16:31:21 -0700
You should probably set T_C to 264.0d0 rather than 264.
Also I suggest you set twopi:2*?pi
And use that, to improve speed.
Is it a compiler error?
Maybe if you think that the compiled code should check for incorrect types
of numeric data.
RJF
> -----Original Message-----
> From: maxima-bounces at math.utexas.edu
> [mailto:maxima-bounces at math.utexas.edu] On Behalf Of Robert Gloeckner
> Sent: Sunday, April 22, 2007 3:54 PM
> To: maxima at math.utexas.edu
> Subject: Q: compiling causes problems in evaluating
> functions?
>
> Hello,
>
> I really hope this is my fault...
> [maxima 5.9.10 on Linux]
>
> my code:
> --------------------------------
> A_N:1e+21;
> B_N:30;
> T_C:264;
> eq4_7_(T, _p) := (A_N / sqrt(2.0 * %pi * B_N * B_N)) *
> exp(-0.5 * ((T - T_C) / B_N)^2 );
> ---------------------------------
>
>
> (%i95) eq4_7_(T, _p) := (A_N / sqrt( 2.0 * %pi * B_N * B_N)) *
> exp(-0.5 * ((T - T_C) / B_N)^2 );
>
> A_N T - T_C 2
> (%o95) eq4_7_(T, _p) := --------------------- exp((- 0.5) (-------) )
> sqrt(2.0 %pi B_N B_N) B_N
> (%i96) eq4_7_(xx,yy);
>
> 2
> - 5.555555555555556E-4 (xx - 264)
> 2.357022603955158E+19 %e
> (%o96)
----------------------------------------------------------
> sqrt(%pi)
> (%i97) compile(eq4_7_);
>
> Compiling gazonk0.lsp.
> End of Pass 1.
> End of Pass 2.
> OPTIMIZE levels: Safety=2, Space=3, Speed=2
> Finished compiling gazonk0.lsp.
> (%o97) [eq4_7_]
> (%i98) eq4_7_(xx,yy);
>
> (%o98)
>
> 2
> - 5.555555555555556E-4 (xx -
> 2.121995921398603E-314)
> 2.357022603955158E+19 %e
>
> --------------------------------------------------------------
> ---------------
> sqrt(%pi)
> (%i99)
>
>
> How can that be? I need to use compile, because otherwise evaluation
> functions (numerical integration) take much too long. What is the
> problem in this case?
> Can somebody verify this behaviour?
> If it is a bug - is this fixed in more recent versions of maxima?
>
> Thanks
> Robert
> _______________________________________________
> Maxima mailing list
> Maxima at math.utexas.edu
> http://www.math.utexas.edu/mailman/listinfo/maxima
>