[SciPy-user] shape mismatch: objects cannot be broadcast to a single shape

Nils Wagner nwagner at iam.uni-stuttgart.de
Thu Jun 22 12:58:48 EDT 2006


On Thu, 22 Jun 2006 11:37:55 -0500
  Robert Kern <robert.kern at gmail.com> wrote:
> Nils Wagner wrote:
>> Hi all,
>> 
>>>>> k = arange(0,4)
>>>>> r = linspace(0,3,10)
>>>>> special.jn(k,r)
>> Traceback (most recent call last):
>>   File "<stdin>", line 1, in ?
>> ValueError: shape mismatch: objects cannot be broadcast 
>>to a single shape
>> 
>> It would be nice if special.jn(k,r) returns a 
>>two-dimensional array
>> corresponding to the length of k and r.
>> 
>> How can I resolve this problem ?
> 
> Pass in the right arguments. Make k a column vector.
> 
> -- 
> Robert Kern
> 
> "I have come to believe that the whole world is an 
>enigma, a harmless enigma
>  that is made terrible by our own mad attempt to 
>interpret it as though it had
>  an underlying truth."
>   -- Umberto Eco
> 
> _______________________________________________
> SciPy-user mailing list
> SciPy-user at scipy.net
> http://www.scipy.net/mailman/listinfo/scipy-user

Thank you.
Please can you run the script

from scipy import *
k = arange(1,10)
r = reshape(linspace(0,3,10),(len(linspace(0,3,10)),1))
H = special.jn(k,r)
print H[0,:]



Am I missing something ?




More information about the SciPy-User mailing list