[R] solving equations with several variables

Josh Schmidt
Thu, 19 Feb 2004 21:32:18 -0000

>===== Original Message From Spencer Graves <spencer.graves at pdf.com>
====>Please "reply to all".  Others on r-help may have more time
than I do.
>spencer graves
>
>Josh Schmidt wrote:
>
>>I have tried optim, but I keep getting an error message.  I am quite new
to
>>this, so perhaps I am inputting something incorrectly?
>>
>> f<-function
>>(max,b1,precip,b2){(sum(cos(theta+2.33474-2(atan(b1*max+b2*precip)))))}
>>
>>I used read.table to store the values for max, precip, and theta in
those
>>variables.
>>
>>
>>
>>>optim(10, f, gr = NULL,
>>>
>>>
>>+ method = c(),
>>+ lower = -Inf, upper = Inf,
>>+ control = list(), hessian = FALSE)
>>
>>Error in sum(cos(theta + 2.33474 - 2(atan(b1 * max + b2 * precip)))) :
>>        attempt to apply non-function
>>In addition: Warning message:
>>one-diml optimization by Nelder-Mead is unreliable: use optimize in:
optim(10,
>>f, gr = NULL, method = c(), lower = -Inf, upper = Inf,
>>
>>Josh Schmidt
>>Department of Biology and Wildlife
>>University of Alaska Fairbanks
>>474-7006 (office)
>>
>>
>>

Josh Schmidt
Department of Biology and Wildlife
University of Alaska Fairbanks
474-7006 (office)