By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
464,761 Members | 1,050 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 464,761 IT Pros & Developers. It's quick & easy.

only length-1 arrays can be converted to Python scalar

P: 1
Hi all!
Could somebody help me. I have error: only length-1 arrays can be converted to Python scalar
Expand|Select|Wrap|Line Numbers
  1. import math
  2. k=6*(10**-8)
  3. Q=100
  4. h=50
  5. a=7
  6. zp=-a
  7. zi=a
  8. z=0
  9. E=Q/2*math.pi*k*h
  10. import numpy as np
  11. def func(x,y):
  12.     return z
  13. W = np.arange(10)
  14. x = np.arange(10)
  15. y = np.arange(10)
  16. z=x+y*1j
  17. W=E*math.log((z-zp)/(z-zi))
  18. print func(W)
in this programm. Thanks for attention
Mar 14 '13 #1
Share this Question
Share on Google+
1 Reply

bvdet
Expert Mod 2.5K+
P: 2,851
math.log() requires a number and you are providing an array.
Mar 14 '13 #2

Post your reply

Sign in to post your reply or Sign up for a free account.