Re: [R] Solving equations with optim

2008-03-16 Thread Prof Brian Ripley
On Sat, 15 Mar 2008, ianfiske wrote: > > If you want to find the value of x such that f(x) = 0, then you can minimize > f^2 or abs(f) using optim. Hope this helps, For all but the (default) Nelder-Mead method you will be better off with f^2 or some other differentiable function than abs(f), sin

Re: [R] Solving equations with optim

2008-03-15 Thread Bill.Venables
+61 7 3286 7700 mailto:[EMAIL PROTECTED] http://www.cmis.csiro.au/bill.venables/ -Original Message- From: [EMAIL PROTECTED] [mailto:[EMAIL PROTECTED] On Behalf Of francogrex Sent: Sunday, 16 March 2008 3:24 AM To: r-help@r-project.org Subject: [R] Solving equations with optim Hello, optim

Re: [R] Solving equations with optim

2008-03-15 Thread ianfiske
If you want to find the value of x such that f(x) = 0, then you can minimize f^2 or abs(f) using optim. Hope this helps, Ian francogrex wrote: > > Hello, optim searches for min (or max) of a function, but is it possible > to solve for a specific value? I mean, I want to find the value of a a

[R] Solving equations with optim

2008-03-15 Thread francogrex
Hello, optim searches for min (or max) of a function, but is it possible to solve for a specific value? I mean, I want to find the value of a and b that give the function value closest to ZERO (and not min or max) in the below. is it possible? thanks test=function(x){ a=x[1] b=x[2] if (all(x>0))(