OregonStyleのブログ

日々の思いと気づきをどんどん記述していきます。ぜひゆっくりして行ってください。

導関数、線形性、積の微分

本日の学習でした。
tutorials.chainer.org

#問4.1.1
y = x**3
y1 = 3 * x**3

#問4.1.2
def Derivationfunction(x):
    y = x**1/2
    y1 = 1/2 * x**-1*2
    print(y1)
    
Derivationfunction(3)

#問4.2.1
import matplotlib.pyplot as plt
import numpy as np

# -10 < x < 10 
x = np.arange(0, 3, 0.1)
y1_ = 4*x -5

def Derivationfunction(x):
    y1 = 2 * x**2 -5*x +1
    y1_ = 4*x -5
    print(y1_)
Derivationfunction(10)

#グラフへのプロット実行
plt.plot(x, y1_)
plt.show()

#問4.2.2
def Derivationfunction(x):
    y1 = 2*x
    y1_ = 2
    y2 = 5 * x**2
    y2_ = 10*x
    y3 = 10 * x**3
    y3_ = 30 * x**2
    print(y1_)
    print(y2_)
    print(y3_)
Derivationfunction(4)

#問4.3
def Derivationfunction(x):
    for n in range(1, 100):
        y = x * x**n
        print(y)
Derivationfunction(2)