Help us understand the problem. What is going on with this article?

# [Pythonによる科学・技術計算] 3次スプライン補間，scipy

More than 3 years have passed since last update.

scipy.interpolateのinterp1dメソッドを利用して3次スプライン補間を行う。

### 内容

この関数は，ラグランジュ補間ではうまくいかない(Qiita記事を参照)。

```from scipy.interpolate import interp1d
import numpy as np
import matplotlib.pyplot as plt

x =np.linspace(-5,5,num=11)
y = 1.0/(1.0+x**2)
f_line = interp1d(x, y)
f_CS = interp1d(x, y, kind='cubic')  #3次スプライン補間実行！

#for plot

xnew =np.linspace(-5,5,num=51)
plt.plot(x, y, 'o',   xnew, f_CS(xnew), '-')
plt.legend(['Raw data','Lagrange', 'Cubic spline'], loc='best')
plt.xlim([-6, 6])
plt.ylim([0, 1.4])
plt.show()

```

### [補遺]

Why not register and get more from Qiita?
1. We will deliver articles that match you
By following users and tags, you can catch up information on technical fields that you are interested in as a whole
2. you can read useful information later efficiently
By "stocking" the articles you like, you can search right away