0

I don't know what is the problem here and I didn't realize how to find a way to resolve it. Actually, it gives the error ZeroDivisionError: division by zero. However there is nothing to be zero to divide to it, as far as I divided to 180 and it's not zero.

C1 = np.array([AA, north1, north1, north1, north1, D1, north1, north1, north1, north1]);
z = np.zeros((len(C1), 1));
C1 = np.concatenate([np.array(C1)[:,None], np.array(z)],axis=1);
B1 = C1 * [np.arange(np.cos(-90*np.pi/180), 0,np.sin(-90*np.pi/180)),np.arange(0, 1,0), np.arange(-np.sin(-90*np.pi/180),0,np.cos(-90*np.pi/180))];

P.S. Here I tried to do cosd:

np.cos(-90*np.pi/180)
1
  • np.arange(0, 1,0) does not work. Just change it to e.g. np.arange(0, 1, 0.1) Commented Jun 23, 2017 at 13:57

2 Answers 2

2

Your error is coming from np.arange(0, 1,0) which is trying to generate an array of values from 0 to 1 separated by 0. The function signature is numpy.arange([start, ]stop, [step, ]dtype=None) so you should have a nonzero step.

Sign up to request clarification or add additional context in comments.

1 Comment

Actually, I wanted to multiple my matrix with this new matrix with cos and sin . in matlab it looks like B1=C1*[ cosd(-90) 0 sind(-90); 0 1 0; -sind(-90) 0 cosd(-90)];
0

This is happening because of below statement

np.arange(0, 1, 0)

The documentation of numpy.arange() does not say anything about having non-zero step.

https://docs.scipy.org/doc/numpy/reference/generated/numpy.arange.html

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.