Fitting data to a complementary error function with multiple variables in Python

I am having trouble to fit experimental data to a complementary error function in Python 3.7.4. import matplotlib.pyplot as plt import math import numpy as np from scipy import optimize from scipy …

TypeError: only size-1 arrays can be converted to Python scalars when using trapz method

This is my python code import numpy as np from scipy.integrate import quad, trapz, simps import math def f(x): return math.exp(-(x**2/2))/math.sqrt(2*math.pi) result, error = quad(f, 0, np.inf) …