<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><DIV id=yiv490172214>
<DIV>Hi Karl, </DIV>
<DIV> </DIV>
<DIV>Thank you for your response.</DIV>
<DIV> </DIV>
<DIV>It's just a simple recursion drawing. </DIV>
<DIV> </DIV>
<DIV>numeric n, m, x,y,z,aa,bb;<BR>picture h, h[], g, g[];<BR>path p,p[];<BR>pair a,a[],b,b[];</DIV>
<DIV> </DIV>
<DIV>beginfig(1)<BR>n:=8;</DIV>
<DIV>u:=.6cm;</DIV>
<DIV>for i=0 upto n-1:<BR>a[i]:=u*dir(360*i/n);<BR>endfor;<BR>p0:=a[0] for i:=1 upto n-1: --a[i] endfor --cycle;</DIV>
<DIV>a:=u*dir(360/n) shifted a1;<BR>y:=arclength ((0,0)--a);<BR>y:=1.2y;</DIV>
<DIV><BR>def froct(expr m)=<BR> if m=0:<BR> fill p0 scaled ((y+u)/u) withcolor red;<BR> else:<BR> fill p0 withcolor red;<BR> h0:=currentpicture;<BR> currentpicture:=nullpicture;<BR> for j=1 upto m:<BR> for i=0 upto n-1:<BR> b[i]:=y*dir(360*i/n);<BR> draw h0 shifted b[i];<BR> endfor;<BR> h:=currentpicture;<BR> currentpicture:=nullpicture;<BR> h0:=h scaled (u/(y+u));<BR> endfor;<BR> draw h;<BR> fi; <BR>enddef;<BR> <BR>froct(1);<BR>h1:=currentpicture;<BR>currentpicture:=nullpicture;</DIV>
<DIV><BR>froct(2);<BR>h2:=currentpicture;<BR>currentpicture:=nullpicture;</DIV>
<DIV>froct(4);<BR>h3:=currentpicture;<BR>currentpicture:=nullpicture;</DIV>
<DIV>draw h1;<BR>draw h2 shifted (8u,0);<BR>draw h3 shifted (16u,0); </DIV>
<DIV>endfig;<BR>end</DIV>
<DIV> </DIV>
<DIV><BR>If you change froct(5) in picture 3, then the capacity is exceeded 800000 already, which is strange because 8^5 is only 32768, even though the growth is exponential, it will exceed any memory capacity with a few more iteration, I admit.</DIV>
<DIV> </DIV>
<DIV>I don't know anything about what you described below, because I am a novice in programming and computer. </DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV>Another strange thing for me is at the beginning of the definition of a function,</DIV>
<DIV> </DIV>
<DIV>def froct(expr m)=<BR> if m=0:<BR> <FONT style="BACKGROUND-COLOR: #ffff40">fill p0 scaled ((y+u)/u) withcolor red;<BR></FONT> else:<BR> <FONT style="BACKGROUND-COLOR: #ffff00">fill p0 withcolor red;<BR></FONT> h0:=currentpicture;<BR> currentpicture:=nullpicture;</DIV>
<DIV> </DIV>
<DIV>these two highlighted sentences look redundant, so I pull them outside of function froct such as:</DIV>
<DIV> </DIV>
<DIV> <FONT style="BACKGROUND-COLOR: #c3be71">fill p0 withcolor red;<BR> h0:=currentpicture;<BR> currentpicture:=nullpicture;</FONT></DIV>
<DIV><FONT style="BACKGROUND-COLOR: #c3be71"></FONT> </DIV>
<DIV><FONT style="BACKGROUND-COLOR: #c3be71">def froct(expr m)=<BR> if m=0:<BR> draw h0 scaled ((y+u)/u);<BR> else:<BR> draw h0;</FONT></DIV>
<DIV> </DIV>
<DIV> </DIV>
<DIV><FONT style="BACKGROUND-COLOR: #ffffbf">this looks more efficient to me, but in this case, it cannot even perform 4 iterations. So, obviously, it is less efficient than the original one.</FONT></DIV>
<DIV><FONT style="BACKGROUND-COLOR: #ffffbf"></FONT> </DIV>
<DIV><FONT style="BACKGROUND-COLOR: #ffffbf">I am just a beginner of programming (this is basically my first), I would appreciate it very much if any experts can give some insight.</FONT></DIV>
<DIV> </DIV>
<DIV><FONT style="BACKGROUND-COLOR: #ffffbf"></FONT> </DIV>
<DIV>Thanks,</DIV>
<DIV>Steve</DIV>
<DIV><FONT style="BACKGROUND-COLOR: #ffffbf"></FONT> </DIV>
<DIV><BR><BR>--- On <B>Sat, 2/7/09, Karl Berry <I><karl@freefriends.org></I></B> wrote:<BR></DIV>
<BLOCKQUOTE style="PADDING-LEFT: 5px; MARGIN-LEFT: 5px; BORDER-LEFT: rgb(16,16,255) 2px solid">From: Karl Berry <karl@freefriends.org><BR>Subject: Re: [<SPAN>metapost</SPAN>] ! MetaPost capacity exceeded<BR>To: hmc0907@yahoo.com, metapost@tug.org<BR>Date: Saturday, February 7, 2009, 3:37 PM<BR><BR><PRE> > If you want your change to affect only metapost, add or change
> main_memory.mpost only
I'm curious what kind of graph you are generating that the current
main_memory is insufficient for! My knee-jerk reaction to such reports
is always to just increase the defaults, since if you're running into
it, probably others are too. It's not just an infinite recursion or
some such?
texlive ...and therefore I am uncertain what the 'best' command is.
Er, well, it all depends on what one wants to do :). It's already done,
but for the record ...
As you already mentioned, fmtutil generates stuff per-user; fmtutils-sys
generates it for the "system" install. In this case, I gather there
was
no permission to write in the system dirs.
As for the options, here are the principal ones:
--all recreate all format files
--missing create all missing format files
--refresh recreate only existing format files
--byfmt formatname (re)create format for `formatname'
So, fmtutil --byfmt mpost would have been my first suggestion,
since it didn't seem desired to remake the tex or metafont formats here.
Happy formatting,
karl
</PRE></BLOCKQUOTE></DIV></td></tr></table><br>