[R] Find a zero of a composition of functions

enrico.foscolo2 at libero.it enrico.foscolo2 at libero.it
Thu Apr 9 14:42:18 CEST 2009


Good morning to all,

I should find the zero of a specific function,

	func(x,f.
me,c,t)=x+f.me*c-t

where 'c' and 't' are constants and 'f.me' is an other 
function of 'x'.
Actually, I am interested in considering 'f.me' as an 
expression().

Namely,

	uniroot.me<-function(f.me,c,t){

	
		func<-function(x,
f.me,c,t) x+eval(f.me)*c-t

	

		uniroot(func,c(0,1),f.me=f.me,c=c,t=t)$root

	


	}

	
	uniroot.me(expression(x*(1-x)),c=1,t=1)

For instance, let me suppose 
that 'f.me=expression(x^a*(1-x))'. How should I do in order to introduce the 
new constant 'a' in function 'uniroot.me'?

Thank you very much,

Enrico 
Foscolo




More information about the R-help mailing list