help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: fsolve inside fsolve


From: Geordie McBain
Subject: Re: fsolve inside fsolve
Date: Mon, 06 Feb 2006 11:18:12 +1100

Hello.  The problem is that fsolve calls on old Fortran subprogram and
(old) Fortran doesn't allow recursion.

I don't think a root-finder really needs to be written in Fortran (i.e.
one written in Octave could be just as efficient), and I suspect fsolve
only calls a Fortran subprogram because a good Fortran root-finder was
available, but I may be missing something.  

I have an Octave function that works just fine for your problem.  I'll
send it to you off-list because I'm not sure of it's copyright status.
(It's my translation to Octave of the Algol 60 procedure listed by Brent
in The Computer Journal 14(4):422--425, 1971)  It's also not a candidate
to replace fsolve elsewhere as it only handles the scalar case.

Geordie McBain
www.aeromech.usyd.edu.au/~mcbain


On Sat, 2006-02-04 at 15:58 -0500, Brian Bucher wrote:
> Greetings,
> 
> I'm attempting to use fsolve to solve for something inside a function 
> that was itself called with fsolve.  I'm getting
> 
> error: fsolve: invalid recursive call
> 
> 
> The playing field:
> OS: Mac OS X 10.3.9
> Octave version: 2.1.53-1 installed via Fink (FinkCommander)
> 
> 
> octave:11> call_bname2
> yguess = 0.50000
> xguess = 0.50000
> error: fsolve: invalid recursive call
> error: called from `bname2' in file `/Users/blah/octave_playing/bname2.m'
> error: fsolve: evaluation of user-supplied function failed
> error: near line 5 of file `/Users/blah/octave_playing/call_bname2.m'
> octave:11>
> 
> 
> 
> --- file call_bname2.m ---
> yguess = 0.5
> [y, binfo] = fsolve('bname2', yguess)
> 
> 
> --- file bname2.m ---
> function g = bname2(yin)
>       xguess = 0.5
>       [x, info] = fsolve('bname', xguess)
>       g = 0.7 - yin
> endfunction
> 
> 
> --- file bname.m ---
> function f = bname(xin)
>       f = 0.8 - xin
> endfunction
> 
> 
> 
> Is there any way to do this?
> 
> Thank you,
> Brian
> 
> 
> 
> -------------------------------------------------------------
> Octave is freely available under the terms of the GNU GPL.
> 
> Octave's home on the web:  http://www.octave.org
> How to fund new projects:  http://www.octave.org/funding.html
> Subscription information:  http://www.octave.org/archive.html
> -------------------------------------------------------------
> 



-------------------------------------------------------------
Octave is freely available under the terms of the GNU GPL.

Octave's home on the web:  http://www.octave.org
How to fund new projects:  http://www.octave.org/funding.html
Subscription information:  http://www.octave.org/archive.html
-------------------------------------------------------------



reply via email to

[Prev in Thread] Current Thread [Next in Thread]