Re: using a function name as a function argument?

From: Rick Brownrigg <brownrig_at_nyahnyahspammersnyahnyah>
Date: Wed Jun 11 2014 - 09:52:01 MDT

Hi Will,

Maybe someone else can chime in here, but I tried a quick experiment to
define a function and pass it to a second function to be called, and it
looks like this is not possible.

Rick


On Tue, Jun 10, 2014 at 10:24 PM, Will Hobbs <Will.Hobbs@utas.edu.au> wrote:

> NCL'ers
>
> I need to write a function that uses the Newton-Raphson iterative method
> to solve a mathematical function,
>
> e.g. find x for which f(x) = 0, which is solved iteratively by the
> Newton Raphson method thus
>
> do while (dx.le.del) ;where 'del' is some acceptable level of
> convergence e.g. 0.01
>
> x1 = x0 + f(x0)/ f'(x0)
>
> dx = (x1-x0)^2/x0^2
>
> x0 = x1
>
> end do
>
>
> Is it possible to define a function with arguments that call other
> functions, i.e.
>
> function Newt-Rap(f, fdash, x0)
>
> If not, is there another way of writing a generic subroutine that can
> reference other functions?
>
> Will
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>

Received on Wed Jun 11 03:52:12 2014

This archive was generated by hypermail 2.1.8 : Wed Jul 23 2014 - 15:33:46 MDT