actually solved ex1

This commit is contained in:
navid.sassan 2020-09-22 17:54:24 +02:00
parent 3593cb0b0b
commit df0a438ada

View File

@ -4,20 +4,27 @@ import numpy
import matplotlib.pyplot as plt
def funktion():
plt.figure()
plt.xlabel("x")
plt.ylabel("y")
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)
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__":
funktion()
main()