[metapost] Plotting a Gaussian Distribution in MetaPost
Hartmut Henkel
hartmut_henkel at gmx.de
Fri Nov 9 19:55:41 CET 2007
On Thu, 8 Nov 2007, Kevin Liu wrote:
> Do you know of any solutions to this problem? Could this be a symptom
> of the very small numbers involved?
maybe. Don't forget that the mexp() function uses its argument divided
by 256, mexp(256) = 2.718..., so you have to scale things accordingly.
Here is a simple example:
prologues:=3;
beginfig(1)
def log(expr i) = (i,100*mexp(-i*i))enddef;
drawarrow left*60--right*60;
drawarrow origin--up*105;
draw log(-55)
for i=-54 upto 55:
.. log(i)
endfor;
show(mexp(256));
endfig;
end
Regards, Hartmut
More information about the metapost
mailing list