R/vecFuncMaker.R

Defines functions vecFuncMaker

#
# vim:set ff=unix expandtab ts=2 sw=2:
vecFuncMaker=function# creates a vector valued function from the functions for the components
### The function is a helper to create a vector valued function of two arguments which is very useful to create systems of ode
(
funcs,	##<< The list of functions computing the vector components
arg1,   ##<< The first argument of the component functions
arg2	##<< The second argument of the component functions
)
{
	function(arg1,arg2){
		matrix(byrow=TRUE,
			nrow=length(funcs),
			mapply(
				function(fun){fun(arg1,arg2)},
				funcs
			)
		)
	}
	### A vector valued function with the vector size equal to the number of 
	### functions in the first argument
}

Try the SoilR package in your browser

Any scripts or data that you put into this service are public.

SoilR documentation built on May 4, 2017, 9:08 p.m.