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

Robert Kern robert.kern at gmail.com
Thu Jun 22 11:37:55 CDT 2006


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



More information about the SciPy-user mailing list