31 lines
685 B
Python
Executable File
31 lines
685 B
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import numpy
|
|
import matplotlib.pyplot as plt
|
|
|
|
|
|
def main():
|
|
x = numpy.arange(-10, 10)
|
|
y = (x ** 5 - 5 * x ** 4 - 30 * x ** 3 + 110 * x ** 2 + 29 * x - 105)
|
|
plt.xlim(-6, 8)
|
|
plt.ylim(-2000, 2000)
|
|
plt.grid()
|
|
plt.plot(x, y, label="f(x)")
|
|
|
|
f_deriv = (5 * x**4 - 20 * x**3 - 90 * x**2 + 220 * x + 29)
|
|
plt.plot(x, f_deriv, label="Derivative f'(x)")
|
|
|
|
c = 0
|
|
f_int = (((x - 2) * x * (x ** 4 - 4 * x ** 3 - 53 * x ** 2 + 114 * x + 315)) / 6) + c
|
|
plt.plot(x, f_int, label="Integral F(x)")
|
|
|
|
plt.title("Exercise 1")
|
|
plt.xlabel("x")
|
|
plt.ylabel("y")
|
|
plt.legend()
|
|
plt.show()
|
|
|
|
|
|
if __name__ == "__main__":
|
|
main()
|