Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.graphics.apps.gnuplot > #402

Function defined by a while loop

From Antonio Lo Turco <antonio.lo.turco@gmail.com>
Newsgroups comp.graphics.apps.gnuplot
Subject Function defined by a while loop
Date 2011-06-27 02:50 -0700
Organization http://groups.google.com
Message-ID <b935110d-6f8d-4b0d-919c-3151effdf59f@28g2000yqu.googlegroups.com> (permalink)

Show all headers | View raw


Hello everybody!
I would like to take advantage of the new construct while (<expr>)
{<commands>} in gnuplot to define a function something like that
f(x,<parameters>,x0 (initial guess of x), eps (maximum error), niter
(maximum no of iterations) =
x=x0;i=1; while (abs(x-x0)>eps && i<niter) {x=some function of x and
parameters;i=i+1}

Obviously I tried and it doesn't work!

The only way I managed to obtained some sensible result is to use the
instruction "call dummy.plt <parameters> x0 eps niter" where
"dummy.plt" script contains the while loop.

However I would like (and I'm not able) to implement such solution as
a user defined function.

I look forward to having your always valued suggestions

Antonio

Back to comp.graphics.apps.gnuplot | Previous | NextNext in thread | Find similar


Thread

Function defined by a while loop Antonio Lo Turco <antonio.lo.turco@gmail.com> - 2011-06-27 02:50 -0700
  Re: Function defined by a while loop James Waldby <not@valid.invalid> - 2011-06-27 16:21 +0000
    Re: Function defined by a while loop Mauro <pippo@hotmail.com> - 2011-06-28 11:48 +0200
  Re: Function defined by a while loop Hans-Bernhard Bröker <HBBroeker@t-online.de> - 2011-06-27 22:00 +0200
    Re: Function defined by a while loop Mauro <pippo@hotmail.com> - 2011-06-28 11:56 +0200

csiph-web