For symbolic stuff I would use sympy Matrix. Recently the MatrixSymbol
and ImmutableMatrix were added to the code base, so you can do much
more with matrices now.
But this is not done yet: http://code.google.com/p/sympy/issues/detail?id=2759
So for arrays and big numerical matrices - numpy and lambdify (but do
you _really_ need lambdify, I would type small simple expressions by
hand)
For small symbolic matrices - sympy and Matrix
Bear in mind that others may have different advices and generally more
trust in the way sympy and numpy interoperate.
>
> Thanks a lot,
> Hauke
>
> --
> You received this message because you are subscribed to the Google Groups "sympy" group.
> To post to this group, send email to sy...@googlegroups.com.
> To unsubscribe from this group, send email to sympy+un...@googlegroups.com.
> For more options, visit this group at http://groups.google.com/group/sympy?hl=en.
>
On Wed, Feb 22, 2012 at 5:13 PM, krastano...@gmail.com
<krastano...@gmail.com> wrote:
> On 21 February 2012 15:10, Hauke Strasdat <stra...@gmail.com> wrote:
>> Hi,
>>
>> I recently discovered sympy and I must say it is really great! I am
>> mainly interested in matrices (matrix functions)
>> and symbolic derivatives.
>>
>> However, one thing I haven't quite understood yet: What is sympy's
>> relatation to numpy?
> I would say "undefined".
> Check http://code.google.com/p/sympy/issues/detail?id=537
Strictly speaking, they are two independent projects. Neither is a
dependency of the other. However, it is possible, to the extent that
the interoperability works, to use numpy to numerically calculate
SymPy objects, and to put SymPy objects inside of numpy arrays. Note
that most issues with interoperability are bugs on the SymPy side,
rather than the numpy side. We do want things to work well, so if
something doesn't please let us know in our issue tracker.
I would say that it depends on what you want to do. Using numpy is a
clean and fast way to do numerical calculations, especially those
involving arrays. Many people use SymPy to do symbolic minipulation,
and then use lambdify() to get numpy to do numerics.
I should note that mpmath is SymPy's numeric library. So there is no
need to use that separately: if you use .evalf() in SymPy, that is
using mpmath. The advantage of mpmath is that is uses arbitrary
precision arithmetic, so you can represent very large, very small, or
very precise numbers with it. Numpy on the other hand uses machine
arithmetic, so you will always be limited to the dtype. Of course, as
a result, numpy is much faster. This is also the case because numpy
is written in C and mpmath is written in pure Python.
mpmath also has a broader support of special functions--virtually
every one included in SymPy, so if you use a lot of those, you may
have to use SymPy to numerically evaluate them. You can do this
automatically with lambdify by passing module=["numpy", "mpmath",
"sympy"].
Aaron Meurer