ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
* [NTG-context] Metapost limitation ?
@ 2024-05-12 13:57 Fabrice Couvreur
  2024-05-12 15:26 ` [NTG-context] " Hans Hagen
  0 siblings, 1 reply; 6+ messages in thread
From: Fabrice Couvreur @ 2024-05-12 13:57 UTC (permalink / raw)
  To: mailing list for ConTeXt users


[-- Attachment #1.1: Type: text/plain, Size: 2470 bytes --]

Hi,
When I want to draw the curve which corresponds to n=60 (blue curve), it
doesn't seem possible: I don't understand.
Thanks
Fabrice

 \startMPpage[offset=1DK]

          numeric u;
          u = 6cm;

          interim linejoin := mitered;
          interim ahangle := 30;

          path xx, yy;
          xx = ( (-0.3,0) -- 1.4 right) scaled u;
          yy = ( (-0.1,0) -- 1.8 right) rotated 90 scaled u;

          def compute_curve(suffix f)(expr xmin, xmax, xinc) =
              ((xmin,f(xmin))
              for x=xmin+xinc step xinc until xmax:
                   .. (x,f(x))
              endfor)
          enddef;


          for i = 1 upto 4:

          vardef f(expr x) =x+exp(-i*x) enddef;

          path curve;

          curve = compute_curve(f,-0.4,1.4,0.0001) scaled u;

          draw curve;

          endfor;

          vardef f(expr x) =x+exp(-6*x) enddef;

          path curve;

          curve = compute_curve(f,-0.4,1.4,0.0001) scaled u;

          draw curve;

          vardef f(expr x) =x+exp(-15*x) enddef;

          path curve;

          curve = compute_curve(f,-0.4,1.4,0.0001) scaled u;

          draw curve;


          vardef f(expr x) =x+exp(-60*x) enddef;

          path curve;

          curve = compute_curve(f,-0.4,1.4,0.0001) scaled u; ->>>>> not
drawn

          draw curve withcolor blue;


          drawarrow (0,0) -- (u,0) withpen pencircle scaled 1.5bp;
          drawarrow (0,0) -- (0,u) withpen pencircle scaled 1.5bp;


          label.urt("A",(0,1u));

          draw xx;
          draw  yy;

          draw (1u,0) -- (1u,1.8u);


          label.llft("0",(0,0));

           vardef mark_y_axis(expr value, name) =
            save p; pair p; p = value * u * up;
            draw (left--right) scaled 1 shifted p;
            label.lft(name, p shifted 2 left);
          enddef;

          for a = 1 upto 1:
            mark_y_axis(a, "");
          endfor

           mark_y_axis(1, "$1$");


         vardef mark_x_axis(expr value, name) =
           save p; pair p; p = value * u * right;
           draw (up--down) scaled 1 shifted p;
           label.bot(name, p shifted 2 down);
         enddef;

         for a = 1 upto 1:
           mark_x_axis(a, "");
         endfor

         mark_x_axis(1, "$1$");


          path rectangle;
          rectangle = (-0.3u,-0.4u) -- (1.3u,-0.4u) -- (1.3u,-0.4u) --
(1.3u,1.4u) -- (-0.3u,1.4u)--cycle;

          clip currentpicture to rectangle;
         \stopMPpage

[-- Attachment #1.2: Type: text/html, Size: 3686 bytes --]

[-- Attachment #2: Type: text/plain, Size: 511 bytes --]

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

maillist : ntg-context@ntg.nl / https://mailman.ntg.nl/mailman3/lists/ntg-context.ntg.nl
webpage  : https://www.pragma-ade.nl / https://context.aanhet.net (mirror)
archive  : https://github.com/contextgarden/context
wiki     : https://wiki.contextgarden.net
___________________________________________________________________________________

^ permalink raw reply	[flat|nested] 6+ messages in thread

end of thread, other threads:[~2024-05-12 17:36 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2024-05-12 13:57 [NTG-context] Metapost limitation ? Fabrice Couvreur
2024-05-12 15:26 ` [NTG-context] " Hans Hagen
2024-05-12 15:36   ` Fabrice Couvreur
2024-05-12 15:48     ` Hans Hagen
2024-05-12 16:21       ` Fabrice Couvreur
2024-05-12 17:36         ` Mikael Sundqvist

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).