From 98cd3a8d1ecadd2ab6b2ad9e71909c33ebb6bb22 Mon Sep 17 00:00:00 2001 From: Imbus <> Date: Mon, 20 May 2024 22:19:59 +0200 Subject: [PATCH] IDK --- lab4.py | 37 +++++++++++++++++++++++++++++++++++++ 1 file changed, 37 insertions(+) create mode 100644 lab4.py diff --git a/lab4.py b/lab4.py new file mode 100644 index 0000000..10587bc --- /dev/null +++ b/lab4.py @@ -0,0 +1,37 @@ +# https://www.youtube.com/playlist?list=PLFQBXZP95PWh1sDMZRHsu7P8maiUS0MTi +import numpy +import matplotlib.pyplot as plt + +# Our polynomials in factored form +p1 = numpy.poly1d([1, 3, 2]) +p2 = numpy.poly1d([1, 2, 4, 1]) + +p3 = numpy.polymul(p1, p2) +print(p3) + +pl = numpy.poly1d([1, 5, 13, -1]) + +print(pl) +print(numpy.roots(pl)) + +T = 1 +s = numpy.poly1d([1, 0]) +#?? + +# Vectors +v1 = numpy.array([1, 2, 3]) +v2 = numpy.array([4, 5, 6]) + +# Convolve v1 and v2 +v3 = numpy.convolve(v1, v2) + +# Valid convolution +v4 = numpy.convolve(v1, v2, 'valid') + +print(v3) +print(v4) + +# Roots +# r1 = numpy.roots(p1) + +# print(r1)