LoginSignup
1
0

More than 5 years have passed since last update.

numpyを使ってみる

Last updated at Posted at 2018-08-27

計算をかんたんにできるという、「numpy」を使ってみた。
3分でできるお手軽さ。

まずはnumpyモジュールをインストール。pipが入ってない場合。(OSはxubuntuです)

sudo apt install python3-pip
pip3 install numpy

電気科で死ぬほどやる行列のかけ算。
なんだ、この楽さ。

test_numpy.py

import numpy

n_array = numpy.array([[1,2,3],[4,5,6],[7,8,9]])
n_array2 = numpy.array([[2,2,2],[3,3,3],[4,4,4]])

print(n_array)
print("*\n")
print(n_array2)
print("=\n")

print(n_array * n_array2)


1
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
1
0