#Python DeepLearning Basics (Mathematics 1/4)

1. Sigma

Sigma ($ \ Sigma $): Sum of multiple numbers

\sum_{k=1}^n a_k = a_1 + a_2 + \cdots + a_n
\sum_{k} a_k = a_1 + a_2 + \cdots + a_n
import numpy as np

a = np.array([1, 2, 3, 4, 5])
print(np.sum(a))

Execution result


15

2. Number of napiers

Napier number $ e $

e = 2.71828 18284 59045 23536 02874 71352 …
y=e^x=\exp(x)

This formula has a very convenient feature that the formula does not change even if it is differentiated.

import numpy as np

def get_exp(x):
    return np.exp(x)
    
print(get_exp(1))

Execution result


2.718281828459045

graph display

↓ Please refer to the article I wrote earlier for graph display. #Python basics (#matplotlib)

import numpy as np
import matplotlib.pyplot as plt

def get_exp(x):
    return np.exp(x)

x = np.linspace(-3, 3, num=100)
y = get_exp(x)

#Axis label
plt.xlabel("x val")
plt.ylabel("y val")

#axis
plt.axhline(0, color = "gray")
plt.axvline(0, color = "gray")

#plt.hlines(y=[0], colors='b', linestyles='dashed', linewidths=1)
#Graph title
plt.title("Graph Name")

#Specify plot legend and line style
plt.plot(x, y, label="y")
plt.legend() #Show legend

plt.show()

image.png

3. Natural logarithm

x = e^y

When $ y = \log_{e} x $


import numpy as np

def get_log(x):
    return np.log(x)
    
print(get_log(1))
# 0.0

graph display

import numpy as np
import matplotlib.pyplot as plt

def get_log(x):
    return np.log(x)

x = np.linspace(0.001, 3, num=1000)
y = get_log(x)

#Axis label
plt.xlabel("x val")
plt.ylabel("y val")

#axis
plt.axhline(0, color = "gray")
plt.axvline(0, color = "gray")

#Graph title
plt.title("Graph Name")

#Specify plot legend and line style
plt.plot(x, y, label="y")
plt.legend() #Show legend

plt.show()

image.png

Recommended Posts

#Python DeepLearning Basics (Mathematics 1/4)
Python basics ⑤
Python basics
Python basics ④
Python basics ③
Python basics
Python basics
Python basics
Python basics ③
Python basics ②
Python basics ②
Python basics memorandum
#Python basics (#matplotlib)
Python CGI basics
Basics of Python ①
Basics of python ①
Python slice basics
#Python basics (scope)
#Python basics (#Numpy 1/2)
#Python basics (#Numpy 2/2)
#Python basics (functions)
Python array basics
Python profiling basics
Python #Numpy basics
Python basics: functions
#Python basics (class)
Python basics summary
Python basics ② for statement
Python: Unsupervised Learning: Basics
Basics of Python scraping basics
Python basics 8 numpy test
Errbot: Python chatbot basics
Python basics: Socket, Dnspython
# 4 [python] Basics of functions
Basics of python: Output
Python Mathematics Series ① Transpose
Python Mathematics Series ③ Determinant (replacement)
python: Basics of using scikit-learn ①
Python basics: conditions and iterations
Paiza Python Primer 4: List Basics
Basics of Python × GIS (Part 1)
Basics of Python x GIS (Part 3)
Paiza Python Primer 5: Basics of Dictionaries
SNS Python basics made with Flask
Python
Review of the basics of Python (FizzBuzz)
Basics of Python x GIS (Part 2)
[High school mathematics + python] Logarithmic problem
About the basics list of Python basics
(python) Deep Learning Library Chainer Basics Basics
Learn the basics of Python ① Beginners
Basics of binarized image processing with Python
Python: Basics of image recognition using CNN
Statistical basics and Python, graphing, etc. (memo)
[Learning memo] Basics of class by python
[Python3] Understand the basics of Beautiful Soup
Learn the basics while touching python Variables
Python learning basics ~ What is type conversion? ~
I didn't know the basics of Python
Getting Started with Python for PHPer-Super Basics
The basics of running NoxPlayer in Python