Scale up as you grow — whether you're running one virtual machine or ten thousand.

From GPU-powered inference and Kubernetes to managed databases and storage, get everything you need to build, scale, and deploy intelligent applications.

You have errors at 4. Performing Vector division operation There was mixed operator / and * The following example would have more sense. >>> lst1 = [10, 20, 30, 40, 50] >>> lst2 = [1, 2, 3, 4, 5] >>> vctr1 = np.array(lst1) >>> vctr2 = np.array(lst2) >>> vctr_div1 = vctr1/vctr2 >>> vctr_div1 array([10., 10., 10., 10., 10.]) >>> vctr_div2 = vctr2/vctr1 >>> vctr_div2 array([0.1, 0.1, 0.1, 0.1, 0.1]) >>> vctr_mul_div = vctr_div1*vctr_div2 >>> vctr_mul_div array([1., 1., 1., 1., 1.])
- Jarmo Lammi
Hi, would be interesting also the case of vector cross product There seems to be also numpy.cross I tried just it and found it doesn’t work with syntax similar to dot product. This will cause error: >>> alst = [4, 1] >>> blst = [-1, 4] >>> avctr = np.array(alst) >>> bvctr = np.array(blst) >>> avctr.cross(bvctr) Traceback (most recent call last): File “”, line 1, in AttributeError: ‘numpy.ndarray’ object has no attribute ‘cross’ However, this works giving only the sum of the squares, i.e the squares of the vector lengths: >>> cvtr = np.cross(avctr, bvctr) >>> cvtr array(17) Changing order of the vectors: >>> cvtr = np.cross(bvctr, avctr) >>> cvtr array(-17) One thing is still missing! How do you get the resulting vector, a 3D array[i, j, k]? It should be in this example the vectors [0, 0, 17] or [0, 0, -17], perpendicular to the vectors avctr and bvctr.
- Jarmo Lammi