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

Home » Public Forums » archive » 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
Passing more than an initial guess to a function used by NEWTON [message #75354] Thu, 24 February 2011 12:13
fgg is currently offline  fgg
Messages: 67
Registered: April 2010
Member
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

Thanks
[Message index]
 
Read Message
Previous Topic: Problem with RESOLVE_ROUTINE
Next Topic: Chi square test

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

Current Time: Fri Oct 10 01:44:11 PDT 2025

Total time taken to generate the page: 1.63295 seconds