Hello again Rick, Thank you gain, I thought that your program worked for my generic problem , but I am having some trouble . In my problem one of the terms is of the form: x/(x*(1+x)##12) For these type of problems, when x appears also multiplying in the denominator, it seems that the program cannot find the solution. For instance, in your example, below, slightly modified (I changed the first number from 48 to 3.3058, and added the x multiplying in the denominator), the solution, a zero, is x= 0.1, but the program seems to have problems finding it. : data parms; eqNo + 1; input p1-p5; datalines; 3.3058 0.3 2 1 2 ; proc iml; /* Define objective function */ start fn(x) global( p ); return( (p[2]-x)*p[3]/x*(p[4]+x)##p[5] - p[1] ); finish; varNames="p1":"p5"; use parms; read all var varNames into m; close parms; root = j(nrow(m), 1, .); do i = 1 to nrow(m); p = m[i,]; /* store i_th row into global variable */ /* Optional: Call function that computes interval that has root */ interval = {-0.9 2}; root = froot("fn", interval); /* find a root in the interval [0,1] */ end; print root;
... View more