0

I get this error. I should note that in my utility file "funcbarsq" is a function defined as a four vector dot product between another function funcbar and itself funcbar. Which uses another definition of a four vector dot product. So a four d dot product operation is defined, funcbar is defined, and funcbarsq is defined as the 4D dot product of funcbar*funcbar = funcbarsq.

C:\utilityfile in function(x, y, z, q, r, l, m, n)
    116 
    117 def function(x,y,z, q, r, l, m, n):
--> 118     val = np.abs(funcbarsqr/(float(q**2))
    119     return val
    120 

TypeError: only size-1 arrays can be converted to Python scalars

1 Answer 1

2

You are passing q**2 to float(). As the error message says, this value (and consequently q) should be an array with only one element. In your case it is not, and that's where the error comes from.

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

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.