Polynomial Graph using Python

Polynomial Graph

Introduction to Polynomial Graph

Polynomial curve a is smooth and continues line of graph, connected by a series of co-ordinates calculated using a polynomial equation (For example, y = f(x), where f(x) = Ax2 + Bx + C). In this program, I have used a polynomial equation y = 3x2 + 4x + 2 with x values range from 0 to 5. The program generated co-ordinate points (x, y) in the graph will be (0, 2), (1, 9), (2, 22), (3, 41), (4, 66), and (5, 97).

Program Implementation

In this tutorial, I have used Python 3.5.2 (64-bit) software, and 7 modules: MatPlotLib 2.0.2, PyParsing 2.2.0, Python-DateUtil 2.6.1, PyTZ 2017.2, SetupTools 36.2.0, Cycler 0.10.0, and NumPy-MKL 1.13.1 implemented in Windows 10 Enterprise operating system. The 7 modules are chosen based on the compatibility of Python and OS version and bit.

Source Code

import numpy as np
import matplotlib.pyplot as plt

a = 3
b = 4
c = 2
x = np.linspace(0, 10, 256, endpoint = True)
y = (a * (x * x)) + (b * x) + c

plt.plot(x, y, '-g', label=r'$y = 3x^2 + 4x + 2$')

axes = plt.gca()
axes.set_xlim([x.min(), x.max()])
axes.set_ylim([y.min(), y.max()])

plt.xlabel('x')
plt.ylabel('y')
plt.title('Polynomial Curve')
plt.legend(loc='upper left')

plt.show()


Comments

  1. The graph of a polynomial function will also touch the x-axis with multiples. The graph will cross the x-axis at zero with oddities. The sum of the multiplications is the degree of the polynomial function. Learning maths is really interesting. Getting into a problem and then finding its solution is a fun. Maths used to be one of my favourite subject in school. Thanks for this questions for practice. This e-learning site is very helpful for the students. As mathematics is tricky but at the same time this is interesting too. By solving this students can practice for the further mathematics based exams. There are also a best guides where you can learn mathematics. With the help of h1 math tuition you can get easy tricks and methods related to maths.

    ReplyDelete
  2. Wow! Thank you! I constantly wanted to write on my site something like that. Can I take a portion of your post to my website? Best python string methods service provider.

    ReplyDelete
  3. Wow! Thank you! I constantly wanted to write on my site something like that. Can I take a portion of your post to my website? Best ai course in hyderabad service provider.

    ReplyDelete

Post a Comment

Most Popular Posts

Technical Questions

Simple Server and Client Chat using Python

RNA to Protein Translation in PERL