473,396 Members | 1,773 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

only length-1 arrays can be converted to Python scalar

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
1 4897
bvdet
2,851 Expert Mod 2GB
math.log() requires a number and you are providing an array.
Mar 14 '13 #2

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

Similar topics

50
by: Edward K. Ream | last post by:
I would like to say a few (actually more than a few) words here about some recent discoveries I have made concerning the interaction of Leo and Python. If you don't want to hear an inventor enthuse...
8
by: Greg | last post by:
In VB6 I made heavy use of control arrays I see they have been 'deprecated' in vb.Net, with a questionable explanation that they are no longer necessary which just addresses the event issue!...
1
by: Carl | last post by:
I have the following problem import Numeric dim = 1 bits = 32 v = Numeric.zeros((dim, bits), 'l') for j in range(bits): v = 1L << bits - j - 1 The problem is the last assignment, which is...
3
by: Kermit Rose | last post by:
From: Kermit Rose Date: 02/10/06 17:36:34 To: python-help@python.org Subject: Arrays Hello. I want to write a program in python using integer arrays.
1
by: Casey Hawthorne | last post by:
Is the only way to connect Python and Lua through a C interface? -- Regards, Casey
0
by: Frank | last post by:
Hi, I use rpy on linux to call R functions. Works fine up to the following problem: How to parse arrays (no vectors, that means 2-dimensional) to R without much effort? The following code...
3
by: goldtech | last post by:
Say I have have an HTML form , the user hits the submit button and I what text they enetered into a HTML form field is written to a file. But I don't have PHP, JAVA the usual client or server...
4
by: attackwarningred | last post by:
Dear All, Hello! I've just started to use Python and its a lovely language! I've previously programmed in Fortran 95 and have just began to use numpy. I'm having a few problems with arrays in...
0
by: datapata | last post by:
Hi I have some C++ code that I need to access from Python. I don't need to access any classes or anything, just a couple of functions that take one array as input and produce another array as...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.