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


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

Function defined by a while loop

Path csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!news.albasani.net!feeder.news-service.com!postnews.google.com!28g2000yqu.googlegroups.com!not-for-mail
From Antonio Lo Turco <antonio.lo.turco@gmail.com>
Newsgroups comp.graphics.apps.gnuplot
Subject Function defined by a while loop
Date Mon, 27 Jun 2011 02:50:05 -0700 (PDT)
Organization http://groups.google.com
Lines 20
Message-ID <b935110d-6f8d-4b0d-919c-3151effdf59f@28g2000yqu.googlegroups.com> (permalink)
NNTP-Posting-Host 147.162.219.242
Mime-Version 1.0
Content-Type text/plain; charset=ISO-8859-1
X-Trace posting.google.com 1309168206 5556 127.0.0.1 (27 Jun 2011 09:50:06 GMT)
X-Complaints-To groups-abuse@google.com
NNTP-Posting-Date Mon, 27 Jun 2011 09:50:06 +0000 (UTC)
Complaints-To groups-abuse@google.com
Injection-Info 28g2000yqu.googlegroups.com; posting-host=147.162.219.242; posting-account=bFF5QgoAAAB4t72DyJJXYtDLbNDBrNOe
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-Header-Order HUALESNKRC
X-HTTP-UserAgent Mozilla/5.0 (Windows NT 6.1; WOW64; rv:5.0) Gecko/20100101 Firefox/5.0 GTBA,gzip(gfe)
Xref x330-a1.tempe.blueboxinc.net comp.graphics.apps.gnuplot:402

Show key headers only | 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