Help us understand the problem. What is going on with this article?

【Python】2次関数をグラフにプロットする

More than 1 year has passed since last update.

やりたいこと

2次関数をグラフにプロットする。

※準備するものは以下のURLを参照してください。
https://qiita.com/Cesaroshun/items/69c9fad0cd24322559b2

手順

  • 2次関数を取得する
  • 2次関数をグラフにプロット実行

まとめて結論

以下のように記述する。

math_traning.py
import matplotlib.pyplot as plt
import numpy as np

/* -10 < x < 10 */
x = np.arange(-10, 10, 0.1)

/* y = x^2 + 10x + 1*/
y = x**2 + 10*x + 1

/*グラフへのプロット実行*/
plt.plot(x, y)
plt.show()

実行すると、以下のグラフが出力される。
スクリーンショット 2018-01-02 23.49.42.png

Why do not you register as a user and use Qiita more conveniently?
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away
Comments
Sign up for free and join this conversation.
If you already have a Qiita account
Why do not you register as a user and use Qiita more conveniently?
You need to log in to use this function. Qiita can be used more conveniently after logging in.
You seem to be reading articles frequently this month. Qiita can be used more conveniently after logging in.
  1. We will deliver articles that match you
    By following users and tags, you can catch up information on technical fields that you are interested in as a whole
  2. you can read useful information later efficiently
    By "stocking" the articles you like, you can search right away