# Scipy.optimize curve_fit problem

Isn't able to estimate the covariance of the parameter, thus raising the OptimizeWarning below

Scipy Curve_fit

Today's lab ran into a problem that when people try to fit a function with

exponential and square root in it, the results is either off, or the

prameter does not work.

The problem is that if the fitting function tries to go through `undefined`

points in your function, it throws out the warning above.

The importance of guessing is discussed in this thread, but the gist of it is, when fitting, use `p0`

argument to give initial point for fitting.

```
popt, pcov = curve_fit(func2, np.arange(10), np.arange(10), p0=(0, 0))
```

### Subscribe to The WOrLd

Get the latest posts delivered right to your inbox