       why 312/100 and 3.12 different

• To: mathgroup at smc.vnet.net
• Subject: [mg7988] why 312/100 and 3.12 different
• From: "H.J. Wang" <hungjen at umich.edu>
• Date: Wed, 30 Jul 1997 23:57:39 -0400
• Organization: University of Michigan
• Sender: owner-wri-mathgroup at wolfram.com

```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 = 1-CDF[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 (1-c)+ei Y2,n2]*logpdf[W], {W,0,e}]+ rho
Integrate[ U[ e-c W+ei Y2,n2] logpdf[W], {W,e,wtilde}] + rho
Integrate[ U[ W+Y2-b (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?