Solving nonlinear equations [message #36837] |
Sat, 01 November 2003 14:21  |
Thierry Savin
Messages: 5 Registered: July 2002
|
Junior Member |
|
|
Hi all,
Is it possible to create a function called let's say "solvef":
IDL> x=solvef(a,'f')
that returns x the solution of f(x,a)=0 ?
Thanks for any suggestion.
|
|
|
Re: Solving nonlinear equations [message #36917 is a reply to message #36837] |
Mon, 03 November 2003 10:36  |
Thierry Savin
Messages: 5 Registered: July 2002
|
Junior Member |
|
|
Ok, after a long week-end spend in the IDL6 "stupid PDF" help, I give
myself an answer.
function myfunc,x
common myfunca,a
return,f(x,a)
end
function solvef,b
common myfunca,a
a=b
x=fx_root([0,1,2],'myfunc')
return,x
end
I was missing the common block trick.
Thanks for your answers and procedures,
but they are way too complicated for me.
-T
Thierry Savin wrote:
> Hi all,
>
> Is it possible to create a function called let's say "solvef":
>
> IDL> x=solvef(a,'f')
>
> that returns x the solution of f(x,a)=0 ?
>
> Thanks for any suggestion.
>
|
|
|