Numpy: poly1d mutable oder immutable?
Verfasst: Montag 21. April 2014, 13:38
Hey 
Gibt es so etwas wie "half-mutable", weil numpys poly1d arbeitet meiner Meinung so
Bsp.:
Ist das ok oder inkonsistent?
Gruss
YKnot
Gibt es so etwas wie "half-mutable", weil numpys poly1d arbeitet meiner Meinung so
Bsp.:
Code: Alles auswählen
import numpy as np
a = np.poly1d([1,2,3])
b = a
a[0] = 2
print(a, b, sep='\n')
# 1x^2 + 2x + 2
# 1x^2 + 2x + 2
a += 1
print(a, b, sep='\n')
# 1x^2 + 2x + 3
# 1x^2 + 2x + 2 # IMHO sollte b doch immer noch == a sein (?)
Gruss
YKnot