Adding c functions into gnuplot

View: New views
3 Messages — Rating Filter:   Alert me  

Adding c functions into gnuplot

by emilio :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

Hello everbody,

I need to use some functions of the GSL library (Jacobi functions) as a
builtin function of gnuplot.

Does anyone know if there exists an easy way to define a new function
that couldn't be express as a combination of elementary operations?

Re: Adding c functions into gnuplot

by Lutz Maibaum-3 :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

On Monday 07 July 2008 15:59:13 emilio wrote:
> I need to use some functions of the GSL library (Jacobi functions) as a
> builtin function of gnuplot.

Here is a workaround: write a simple C program that takes a single command
line argument x, calculates the function value and writes it to stdout.
Let's say this program is called jacobi, then you can define the function

  jacobi(x)=0+system(sprintf("jacobi %f",x))

inside gnuplot, which you can use like any other function (from what I
remember the "0+" notation is necessary to force the conversion from a
string to a number). It is very slow, though.

It would be nice if the GSL functions were available natively, but there
seem to license issues (see feature request 968727 on SourceForge).

Hope this helps,

  Lutz

-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
gnuplot-beta mailing list
gnuplot-beta@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-beta

Re: Adding c functions into gnuplot

by Daniel J Sebald :: Rate this Message:

Reply to Author | View Threaded | Show Only this Message

emilio <emilio38 <at> yahoo.com> writes:

>
>
> Hello everbody,
>
> I need to use some functions of the GSL library (Jacobi functions) as a
> builtin function of gnuplot.
>
> Do anyone know if there exists an easy way to define a new function
> that couldn't be express as a combination of elementary operations?

What exactly is it that you need emilio?  Elliptical functions?  Theta function?
 sn(), cn(), dn()?  I'm wondering if this function couldn't simply be added to
the list of special functions.  This paper

www.jucs.org/jucs_4_1/reliable_computation_of_elliptic/Luther_W.pdf

has an arithmetic-geometric mean algorithm I was going to try.  However, I then
noticed that Andras Pal added some elliptical functions fairly recently.  Type
"help elliptic" for info.  Is that what you are looking for?

Dan



-------------------------------------------------------------------------
Sponsored by: SourceForge.net Community Choice Awards: VOTE NOW!
Studies have shown that voting for your favorite open source project,
along with a healthy diet, reduces your potential for chronic lameness
and boredom. Vote Now at http://www.sourceforge.net/community/cca08
_______________________________________________
gnuplot-beta mailing list
gnuplot-beta@...
https://lists.sourceforge.net/lists/listinfo/gnuplot-beta
LightInTheBox - Buy quality products at wholesale price