Dear All,

please provide insights into the following problem;

this part is the reproducible example:

library(nleqslv)

S1 <-0.5
S2 <-0.5
Z <-7.2598
M1 <--5.7831
M2 <-24.597
mk501 <-1.2827
mk502 <-4.7964
AL <--0.5623 

f <- function(H1){

  1 - (S1/(mk501*((H1/(Z-H1))^(1/M1)))+S2/(mk502*((H1/(Z-H1))^(1/M2)))+(AL*S1*S2)/(mk501*mk502*((H1/(Z-H1))^(0.5/M1+0.5/M2))))
}

then I run:

H1 <-nleqslv(4,f)$x

which gives me the value for H1 I am looking for... I am trying to run the code nleqslv(4,f)$x on the following data frame G:

S1 <-seq(0.5,7.6,by=0.2)
S2 <-seq(0.5,4,by=0.1)
G <-data.frame(S1,S2)

so I write:

apply(G,1,nleqslv(4,f)$x)


and I get error: Error in nleqslv(4, f) : Length of fn result <> length of x!, which I believe tells me that the starting value of nleqslv is too short, ie: 1 instead of 36 like the number of rows in G. At the end of the day I would like to get the H1 value for all rows of G, where the starting value of 4 should be reasonable for solving the problem. Your input is appreciated as always,

Andras
	[[alternative HTML version deleted]]

