ntg-context - mailing list for ConTeXt users
 help / color / mirror / Atom feed
From: Alan Braslau <alan.braslau@cea.fr>
To: mailing list for ConTeXt users <ntg-context@ntg.nl>
Subject: Re: Plotting a graph of a function f, like f(x) = e^x, with MetaPost
Date: Wed, 12 Oct 2011 07:36:42 +0200	[thread overview]
Message-ID: <20111012053642.GA53825@iram-hb-003386.extra.cea.fr> (raw)
In-Reply-To: <1318373112.3726.35.camel@mattotaupa>

Paul,

Metapost can now perform calculations in double precision floating point.
At this time, it is in the svn version and does not work yet as
such integrated in ConTeXt (through mplib). Taco promises this for soon...

The graph package is pretty clever, and I am working on proposals on
how to extend/rewrite this taking advantage of the new metapost
handling of large and small numbers.

To plot a function, you can create a path, as in
path p ; p := 
	for i=0 upto 1000:
		hide (x := i/1000 ;) 
		if (i>0) -- fi (x,exp(x))
	endfor ;
gplot p ;

One proposal will be to make this even easier with new macros.

Alan

On Wed, Oct 12, 2011 at 12:45:12AM +0200, Paul Menzel wrote:
> Dear ConTeXt folks,
> 
> 
> I finally chose MetaPost/MetaFun [1] because of the native integration
> with ConTeXt and hopefully easy font handling. I want to use that
> throughout my document.
> 
> Of course I hit the first problem. Wanting to draw a “simple” function f
> like f(x) = e^x, seems hard to accomplish. I guess I should stress that
> MetaPost does not have a high accuracy so it might not be the best
> solution [5].
> 
> There seem to be quite a lot of solutions (mostly macros) on the Web for
> this problem so I am wondering if one of them is integrated in MetaFun.
> 
> Here are some of my findings.
> 
> 1. Reading about the graph package by John D. Hobby [2] and which is
> also included in ConTeXt [3]. Especially I liked the automatic
> coordinate systems. The package seems to only be able to plot graphs
> with data points saved in files. So one solution would be to manually
> create data files with data points of the relevant function.
> 
> 2. There is an example in the Drexel Physics Wiki [4].
> 
> 3. Anthony Phan has also created some macros in his `mps` [5 (currently
> not accessible)].
> 
> 4. André Heck uses the macro packages `courbes` and `grille` from
> Jean-Michel Sarlat to show some nice examples in his tutorial »Learning
> Metapost by Doing« [6].
> 
> 
> So what do you suggest?
> 
> 
> Thanks,
> 
> Paul
> 
> 
> [1] http://www.ntg.nl/pipermail/ntg-context/2011/058527.html
> [2] http://tug.org/docs/metapost/mpgraph.pdf
> [3] http://wiki.contextgarden.net/Metapost
> [4] http://einstein.drexel.edu/liki/index.php/Metapost#Graphing_Functions
> [5] http://www-math.univ-poitiers.fr/~phan/downloads/metapost/statsman.pdf
> [6] http://staff.science.uva.nl/~heck/Courses/mptut.pdf



> ___________________________________________________________________________________
> 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://tex.aanhet.net
> archive  : http://foundry.supelec.fr/projects/contextrev/
> wiki     : http://contextgarden.net
> ___________________________________________________________________________________


-- 
Alan Braslau
CEA DSM-IRAMIS-SPEC
CNRS URA 2464
Orme des Merisiers
91191 Gif-sur-Yvette cedex FRANCE
tel: +33 1 69 08 73 15
fax: +33 1 69 08 87 86
mailto:alan.braslau@cea.fr
___________________________________________________________________________________
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://tex.aanhet.net
archive  : http://foundry.supelec.fr/projects/contextrev/
wiki     : http://contextgarden.net
___________________________________________________________________________________

  parent reply	other threads:[~2011-10-12  5:36 UTC|newest]

Thread overview: 12+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2011-10-11 22:45 Paul Menzel
2011-10-11 22:56 ` Paul Menzel
2011-10-11 22:58 ` Mojca Miklavec
2011-10-12  5:36 ` Alan Braslau [this message]
2011-10-12 22:13   ` Paul Menzel
2011-10-12 22:28     ` Mojca Miklavec
2011-10-12 23:19       ` Paul Menzel
2011-10-13  0:30         ` Mojca Miklavec
2011-10-13  7:32           ` Hans Hagen
2011-10-13  7:59           ` Alan Braslau
2011-10-13  8:04             ` luigi scarso
2011-10-12  6:40 ` luigi scarso

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20111012053642.GA53825@iram-hb-003386.extra.cea.fr \
    --to=alan.braslau@cea.fr \
    --cc=ntg-context@ntg.nl \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).