Ondrej Certik wrote:
> On Jan 1, 2008 1:48 PM, Ondrej Certik <[EMAIL PROTECTED]> wrote:
>   
>> On Jan 1, 2008 9:11 AM, Pearu Peterson <[EMAIL PROTECTED]> wrote:
>>     
>>>
>>> On Jan 1, 12:26 am, Alan Bromborsky <[EMAIL PROTECTED]> wrote:
>>>       
>>>> Do we have a problem here?
>>>> Can we make a numpy array of sympy symbols?
>>>>
>>>>  >>> import swiginac
>>>>  >>> import numpy
>>>>  >>> a = swiginac.symbol('AB')
>>>>  >>> a
>>>> AB
>>>>  >>> A = numpy.array([a])
>>>>  >>> A
>>>> array([AB], dtype=object)
>>>>  >>> import sympy
>>>>  >>> a = sympy.Symbol('AB')
>>>>  >>> a
>>>> AB
>>>>  >>> A = numpy.array([a])
>>>>  >>> A
>>>> array([], shape=(1, 0), dtype=float64)
>>>>         
>>> This is because all sympy objects are iterable.
>>> You'll need to use dtype=numpy.object option for now.
>>> sympy should implement __array__ method to
>>> Basic classes.
>>>       
>> Thanks for the answer. If we implement "__array__",
>> it will start working with numpy? Yes, let's do that.
>>
>> http://code.google.com/p/sympy/issues/detail?id=532
>>     
>
> In SymPy hg now:
>
> In [1]: import numpy
>
> In [2]: import sympy
>
> In [3]: a = sympy.Symbol('AB')
>
> In [4]: A = numpy.array([a])
>
> In [5]: A
> Out[5]: array([AB], dtype=object)
>
> Is this what you wanted?
>
> Ondrej
>
> >
>
>   
Will it work if
a = sympy.Rational(1,2)

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to sympy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at http://groups.google.com/group/sympy?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to