IDK
This commit is contained in:
parent
40e84c0ab1
commit
98cd3a8d1e
1 changed files with 37 additions and 0 deletions
37
lab4.py
Normal file
37
lab4.py
Normal file
|
@ -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)
|
Loading…
Reference in a new issue