On Mon, 8 Oct 2018, Alan Braslau wrote:

On Mon, 8 Oct 2018 16:00:10 -0400 (EDT)
Aditya Mahajan <adit...@umich.edu> wrote:

On Sun, 7 Oct 2018, Hans Hagen wrote:

On 10/7/2018 7:14 PM, Alan Braslau wrote:
On Sun, 7 Oct 2018 17:25:35 +0200
"Mikael P. Sundqvist" <mic...@gmail.com> wrote:

ContourPlot[2 x^5 + x y + y^5 == 0, {x, 0, 2}, {y, -2, 1/2}]

Brut force:
[...]

as this takes some time here's a cheat:

\starttext

\startbuffer[demo]
[...]
\stopbuffer

\startTEXpage
    \typesetbuffer[demo]
\stopTEXpage
\stoptext

a next run the already prepared buffer will be taken unles it has been
changed.

I thought that this will also be a good usecase of showing Lua+MP
interaction. I wrote the code below following the metafun manual, but I cannot
get it to compile. What am I missing?


You need to put it into the mp namespace:

Thanks. The metafun manual is confusing in this regard and I got the impression that any lua namespace could be used.

(then eps should be made a linear function of xi)

Oh, I missed that. Thanks.

(and, indeed this is much faster than calculating in MP)

Yes. Iterating over 10^6 values on a 1GHz computer should roughly take 1ms in any reasonable programming language. Metapost for loops work with macro expansion, which can be very expensive for large loops.

Aditya
___________________________________________________________________________________
If your question is of interest to others as well, please add an entry to the 
Wiki!

maillist : ntg-context@ntg.nl / http://www.ntg.nl/mailman/listinfo/ntg-context
webpage  : http://www.pragma-ade.nl / http://context.aanhet.net
archive  : https://bitbucket.org/phg/context-mirror/commits/
wiki     : http://contextgarden.net
___________________________________________________________________________________

Reply via email to