[R] help with optimize statement

From: tom wright <tom_at_maladmin.com>
Date: Sat 25 Feb 2006 - 00:43:07 EST

Can some help me spot what I'm doing wrong here. I have two equations, one a michalis-menton eqn and one a straight line. I need to work out where they cross.

I created the function:


> optim(c(200,500),solveEqn,vals=c(2.4591201,-0.4015233,5.924e-5,3.437))
Error in optim(c(200, 500), solveEqn, vals = c(2.4591201, -0.4015233, :

        objective function in optim evaluates to length 2 not 1

If i replace return(diff) with sum(diff) then the optim function runs but returns the wrong value (which should be about 290).

Many thanks

R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Sat Feb 25 05:49:17 2006

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:42:45 EST