comp.lang.idl-pvwave archive
Messages from Usenet group comp.lang.idl-pvwave, compiled by Paulo Penteado

Home » Public Forums » archive » Re: Passing more than an initial guess to a function used by NEWTON
Show: Today's Messages :: Show Polls :: Message Navigator
E-mail to friend 
Return to the default flat view Create a new topic Submit Reply
Re: Passing more than an initial guess to a function used by NEWTON [message #75353 is a reply to message #75351] Thu, 24 February 2011 12:32 Go to previous message
penteado is currently offline  penteado
Messages: 866
Registered: February 2018
Senior Member
Administrator
On Feb 24, 5:13 pm, fgg <fabioguimaraesgoncal...@gmail.com> wrote:
> I'd like to solve an equation from within a procedure using Newton's method. e.g.
>
> pro my_procedure
> ...
> c1 = 3
> x_guess = 2
> result = newton(x_guess, 'my_function', itmax=100)
> print, result
> ...
> end
>
> ... but I'd like to pass to my_function (i.e. the equation to be solved by NEWTON) not only the initial guess, x_guess, but also a few constants that are being defined within my_procedure (e.g., c1). Is that possible? Here's an example of my_function:
>
> function my_function, x
>       return, x^2 + 5*x - c1
> end

I encountered this issue in the past, and would be interested in a way
better than system or global variables. It would be so easy if
newton() had something like the uvalues used by widgets, or it called
a method on an object.
[Message index]
 
Read Message
Read Message
Read Message
Read Message
Read Message
Read Message
Previous Topic: scripted object graphics question
Next Topic: Re: License manager troubles

-=] Back to Top [=-
[ Syndicate this forum (XML) ] [ RSS ] [ PDF ]

Current Time: Sun Nov 30 20:25:05 PST 2025

Total time taken to generate the page: 0.48275 seconds