Search All of the Math Forum:
Views expressed in these public forums are not endorsed by
NCTM or The Math Forum.



why 312/100 and 3.12 different
Posted:
Jul 30, 1997 3:27 AM


Hi,
I observed a very strange behavior of Mma 2.2.3 when trying to evaluate the following program in Win95.
(******** begin of the program ***********) <<Statistics`ContinuousDistributions`; ldist =LogNormalDistribution[m,s]; logpdf[W_] = PDF[ldist, W]; pa =CDF[ldist, e]; pc = 1CDF[ldist, wtilde]; pb = CDF[ldist, wtilde]  CDF[ldist, e]; wtilde = (e+b (1+r))/(1+c); U[X_,L_] = Log[X] +0.0003*L^11; Y2=312/100 n2; Y1=312/100 n1; Ux[X_,L_] = D[U[X,L],X];
funEU = U[w+Y1+b,n1] + rho Integrate[ U[ W (1c)+ei Y2,n2]*logpdf[W], {W,0,e}]+ rho Integrate[ U[ ec W+ei Y2,n2] logpdf[W], {W,e,wtilde}] + rho Integrate[ U[ W+Y2b (1+r),n2] logpdf[W], {W,wtilde,Infinity}];
(****** end of the program ****************)
The strange thing is observed when I change the 9th and the 10th lines from Y2 = 312/100 n2; Y1 = 312/100 n1; to Y2 = 3.12 n2; Y1 = 3.12 n1;
. With the "312/100" coefficients, the execution time is short and the memory usage is (relatively) minimal. However, with the "3.12" coefficients, Mma used up all the RAM (about 25 MB available for it) and has to resort to virtual memory. I don't know whether it will eventually produce results since I interrupted the process.
Any idea of why this might happen and how could we avoid it? Thank you in advance!
H.J. Wang



