public inbox for gsl-discuss@sourceware.org
 help / color / mirror / Atom feed
* Re: Root function
@ 2003-12-03 21:20 M Atakan Gurkan
  0 siblings, 0 replies; 3+ messages in thread
From: M Atakan Gurkan @ 2003-12-03 21:20 UTC (permalink / raw)
  To: GSL Discussion List

help-gsl seems to have problems, so I am (re)sending this to gsl-discuss.

ato

Date: Wed, 3 Dec 2003 11:13:04 -0600
From: M Atakan Gurkan <ato@northwestern.edu>
To: "lauradiara@libero.it" <lauradiara@libero.it>
Cc: GSL Help <help-gsl@gnu.org>
Subject: Re: Root function
User-Agent: Mutt/1.2.5.1i
In-Reply-To: <HPBPEL$632688B6CD5BDB7346FF8AD27B1CD0FB@libero.it>; from lauradiara@libero.it on Wed, Dec 03, 2003 at 03:25:33PM +0100

On Wed, Dec 03, 2003 at 03:25:33PM +0100, lauradiara@libero.it wrote:
> Hi,
> 
> I'd like to write a function which finds all the roots of a funcion y=f(x)
> provided by the user.
> 
> I have read the chapter one dimensional root finding: I have some questions.
> 
> The concept expressed is that you use root bracketing or root polishing: with
> the first you have to provide an initial intervalwitha root inside, while with
> the second you have to provide a guess root.
> 
> The first question is: both metods find only a root: if the function has more
> roots what happen?
> 
> The second question is that the initial condition (guess or interval with a
> root) is not simple, it's difficult to provide a good value.
> 
> All the examples are quite simple with a function provided athe start and not
> inserted by the user: so the guess or the interval is simple. But in the real
> applications, what can you do?
> 
> I think there is a solution, otherwise the functions in gsl_roots,h are not
> usable in real situations.
> 
> 
> Can you give me some advice?
Hi,
In real life applications you start with plotting your function and guess 
the roots, at least for a given interval. If you have a family of functions
then you try to parametrize the roots. This latter can be very hard. I 
recently spent a week on a parametrization problem.
There is no single method that will work for all functions. "Numerical
Methods That Work" is nice book on numerical techniques with a special emphasis
on what you should expect and how you can select a method based on the
problems at hand. I suggest you take a look at it.

Good luck,

ato

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

* Re: Root function
@ 2003-12-04  7:58 lauradiara
  0 siblings, 0 replies; 3+ messages in thread
From: lauradiara @ 2003-12-04  7:58 UTC (permalink / raw)
  To: gsl-discuss, help-gsl help-gsl

Ok,

I have understood the problem: this morning I have solved my problem in this way.

The user has to insert an interval (and the function): I split my interval in
small pieces and valuate the value of the function, with libmatheval, in each
piece (only the extreme points of each sub interval).
I register the intervals (and then the points) in which user function changes
sign: at the end I apply the brent solver in each interval registered (infact I
know that if the interval is [a,b], sign(f(a)) is different from sign(f(b))).

This method is more accurate more pieces is diveded user interval.

This method is not suitable for infinite intervals, but for my case I think it
is ok.


What do you think?

Cheers

--Laura


---------- Initial Header -----------

From      : "Karsten Howes" karsten@videotron.ca
To          : "lauradiara@libero.it" lauradiara@libero.it
Cc          :
Date      : Wed, 03 Dec 2003 14:36:16 -0500
Subject : Re: Root function

> Laura,
>
> There is not much you can do in general.  Any root finder, no matter how
> clever, can be stumped by some choice of function.  Its not a problem
> with gsl.  It's just an issue of how general the set of functions
> specified by the user can be.  (Just try finding the roots of f(a) == 0
> , f(x) == 1 for x!=a).  Even smooth (analytical) functions can cause 
> arbitrarily difficult problems especially in the vicinity of an
> essential singularity.  Your problem is only well posed in the context 
> some particular restricted set of functions.
>
> Karsten
>
> lauradiara@libero.it wrote:
>
> >Hi,
> >
> >I'd like to write a function which finds all the roots of a funcion y=f(x)
> >provided by the user.
> >
> >I have read the chapter one dimensional root finding: I have some questions.
> >
> >The concept expressed is that you use root bracketing or root polishing: with
> >the first you have to provide an initial intervalwitha root inside, while with
> >the second you have to provide a guess root.
> >
> >The first question is: both metods find only a root: if the function has more
> >roots what happen?
> >
> >The second question is that the initial condition (guess or interval with a
> >root) is not simple, it's difficult to provide a good value.
> >
> >All the examples are quite simple with a function provided athe start and not
> >inserted by the user: so the guess or the interval is simple. But in the real
> >applications, what can you do?
> >
> >I think there is a solution, otherwise the functions in gsl_roots,h are not
> >usable in real situations.
> >
> >
> >Can you give me some advice?
> >
> >
> >Thanks
> >
> >
> >--Laura
> >
> >
> >
> >
> >
> Karsten Howes
> National Bank of Canada
>
>

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

* Root function
@ 2003-12-03 14:25 lauradiara
  0 siblings, 0 replies; 3+ messages in thread
From: lauradiara @ 2003-12-03 14:25 UTC (permalink / raw)
  To: gsl-discuss, help-gsl help-gsl

Hi,

I'd like to write a function which finds all the roots of a funcion y=f(x)
provided by the user.

I have read the chapter one dimensional root finding: I have some questions.

The concept expressed is that you use root bracketing or root polishing: with
the first you have to provide an initial intervalwitha root inside, while with
the second you have to provide a guess root.

The first question is: both metods find only a root: if the function has more
roots what happen?

The second question is that the initial condition (guess or interval with a
root) is not simple, it's difficult to provide a good value.

All the examples are quite simple with a function provided athe start and not
inserted by the user: so the guess or the interval is simple. But in the real
applications, what can you do?

I think there is a solution, otherwise the functions in gsl_roots,h are not
usable in real situations.


Can you give me some advice?


Thanks


--Laura


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

end of thread, other threads:[~2003-12-04  7:58 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2003-12-03 21:20 Root function M Atakan Gurkan
  -- strict thread matches above, loose matches on Subject: below --
2003-12-04  7:58 lauradiara
2003-12-03 14:25 lauradiara

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 read-only IMAP folder(s) and NNTP newsgroup(s).