from IPython.display import HTML
HTML('''
<script>
code_show=true;
function code_toggle() {
if (code_show){
$(\'div.input\').hide();
} else {
$(\'div.input\').show();
}
code_show = !code_show
}
$( document ).ready(code_toggle);
</script>
<form action="javascript:code_toggle()">
<input type="submit" value="Toggle code">
</form>
''')
import numpy as np
import pandas as pd
import matplotlib.pyplot as plt
import seaborn as sns
%matplotlib inline
plt.rcParams['font.size']=15
def plt_legend_out(frameon=True):
plt.legend(bbox_to_anchor=(1.05, 1), loc='upper left', borderaxespad=0, frameon=frameon)
Linearer Ausdruck
def f(x):
return x
x = np.linspace(-10,10,100)
plt.plot(x,f(x))
plt.axvline(x=0,color='gray',lw=0.5)
plt.axhline(y=0,color='gray',lw=0.5)
plt.show()
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/278468/9a41305b-3849-0b2a-499f-bed247a22369.png)
Quadratische Formel
def f(x):
return -x**2
x = np.linspace(-10,10,100)
plt.plot(x,f(x))
plt.axvline(x=0,color='gray',lw=0.5)
plt.axhline(y=0,color='gray',lw=0.5)
plt.show()
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/278468/5387d12f-d4e5-27fb-0532-f2be673972e1.png)
Vierfachformel
def f(x):
return x**4
x = np.linspace(-10,10,100)
plt.plot(x,f(x))
plt.axvline(x=0,color='gray',lw=0.5)
plt.axhline(y=0,color='gray',lw=0.5)
plt.show()
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/278468/6219a873-07fe-aea4-1cd5-6675d26a755f.png)
Kombination
def f(x):
return 0.9*x**4 - (50*x**2) + 50*x + 200
x = np.linspace(-10,10,100)
plt.plot(x,f(x))
plt.axvline(x=0,color='gray',lw=0.5)
plt.axhline(y=0,color='gray',lw=0.5)
plt.show()
![image.png](https://qiita-image-store.s3.ap-northeast-1.amazonaws.com/0/278468/d46ba387-f398-f73f-ba03-bb97c86fc657.png)