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 
Switch to threaded view of this topic 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
  Switch to threaded view of this topic Create a new topic Submit Reply
Previous Topic: Problem with RESOLVE_ROUTINE
Next Topic: Chi square test

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

Current Time: Wed Oct 08 19:05:13 PDT 2025

Total time taken to generate the page: 0.00471 seconds