using a function name as a function argument?

From: Will Hobbs <Will.Hobbs_at_nyahnyahspammersnyahnyah>
Date: Tue Jun 10 2014 - 22:24:53 MDT

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 04:25:09 2014

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