Code: Alles auswählen
Traceback (most recent call last):
File "test.py", line 11, in <module>
u, v, w = test(pos, a)
File "test.py", line 6, in test
a = const-pos
ValueError: shape mismatch: objects cannot be broadcast to a single shape
Was mach ich falsch , warum ist das falsch und was ist zu beachten wenn ich mit mgrid etc. arbeite.
Mfg Zero.One
Hier der Code:
Code: Alles auswählen
import math
from numpy import *
from enthought.mayavi.mlab import *
def test(const,pos):
a = const-pos
return a[0], a[1], a[2]
def test0(a):
return a[0], a[1], a[2]
pos = array([1.1, 1, 0])
start = array([1,1,1])
print test(start, pos)
a = mgrid[0:1:20j, 0:1:20j, 0:1:20j]
u, v, w = test(pos, a)
quiver3d(u, v, w)
outline()
show()