Hello, I would be really thankful if I could bother you with two questions. 1. I ran into some problems when I used the code "optim()" in my work. I used it to optimize a function-fn(x,y), where x is a two-dimensional parameter. For y I want to pass the value later when I use optim(), because it needs to be inside of a loop, which changes the value of y every time. "For (point in 100:500){ .... optim(c(0,0.5),fn,p=point) .... }" But it always turned to be "Error in fn(par, ...) : argument "p" is missing, with no default". I'm confused about this, is that caused by optim() has some specific requirements towards the objective function? 2. I'm also confused about "optimize()" actually. My code is like: "optimize(f,c(0,0.99),b=1.0,p=point)". I have nothing wrong when I run it, but the result is not accurate enough. Like I got the $minimum as 0.39 from the interval as above (0,0.99), however, I got 0.87 when I change it to (0.2,0.99), 0.96 for (0.3, 0.99). And the only thing I changed is the interval value, so I'm not sure what I should do to improve it. As above, could you help me with these two problems? I would really appreciate that if you could give me some information. Thank you very much! I look forward for your reply soon. Vicky [[alternative HTML version deleted]]