[R] solving equations with several variables

Josh Schmidt ftjhs2 at uaf.edu
Thu Feb 19 22:32:18 CET 2004


>===== 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)




More information about the R-help mailing list