library(BB)
library(nleqslv)
library(reprex)
library(ktsolve)
yfunc<-function(x){
y<-vector()
y[1]<-a+b*sin((238.61/365)+c)-(39393*0.00341802+149-273.15)
y[2]<-a+b*sin((1821.2/365)+c)-(38795*0.00341802+149-273.15)
y[3]<-a+b*sin((1946.8/365)+c)-(38875*0.00341802+149-273.15)
y[4]<-a+b*sin((2072.4/365)+c)-(39231*0.00341802+149-273.15)
y[5]<-a+b*sin((2111.36/365)+c)-(38505*0.00341802+149-273.15)
y[6]<-a+b*sin((2223.12/3650)+c)-(37962*0.00341802+149-273.15)
y
}
guess=list(a=8,b=15,c=30)
solv1<-ktsolve(yfunc,guess = guess)
#> Error in ktsolve(yfunc, guess = guess): Fewer guesses than equations. System is underdefined.
I want to use multiple equations to find the optimal solution of a nonlinear equation. How should I configure the function? Created on 2021-09-01 by the reprex package (v2.0.1)