import pandas as pd
import math
import numpy as np
from scipy.optimize
import curve_fit
L_data = np.array([0.856, 0.451])
t_data = np.array([0.398, 0.507])
y_data = np.array([0.63, 0.5])
def model(x, c1, c2):
x = ([L, t])
return ((480 / c2) * (math.sqrt(((1 + (c1 ** 2)) / 3)) * np.cos((L * math.pi) / 6)) + c1 * (t + (1 / 3) * np.sin((L * math.pi) / 6))) ** (-1 / 0.19741)
xd = [L_data, t_data]
p0 = 0.003, 231
popt, pcov = curve_fit(model, xd, y_data, p0)
I am trying to curve fit a multivariable model with 2 parameters without any luck. The documentation I found focuses mostly on a single variable. I tried to follow the other posts about linking and unpacking but I keep getting this error message "TypeError: can't multiply sequence by non-int of type 'float'" The error is linked to the last line of code. Other than this error is there anything I need to change in my code to get a better solution.
y is the output of the model.
I am new to python so any help is appreciated. Thanks
I tried changing the input tonp.array
but that did not solve the issue