Created
May 10, 2019 17:16
-
-
Save ilim0t/cedaafa41ca7afb61bd165f12c03009d to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| import matplotlib.pyplot as plt | |
| import numpy as np | |
| # 各座標に対して0となった点をつないで線にする | |
| delta = 0.025 # 点の間隔 | |
| # x, y座標 | |
| xrange = np.arange(-2, 2, delta) | |
| yrange = np.arange(-2, 2, delta) | |
| # (N, N)のx, y座標を記した行列 | |
| X, Y = np.meshgrid(xrange, yrange) | |
| # 軸の描画範囲 設定 | |
| plt.axis([-1, 1, -1, 1]) | |
| plt.gca().set_aspect('equal', adjustable='box') | |
| # 描画 | |
| Z = np.abs(X) ** (2 / 3) + np.abs(Y) ** (2 / 3) - 1 # ここでの計算は各要素ごと | |
| plt.contour(X, Y, Z, [0]) | |
| plt.show() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment