Hi,

On Thu, Jul 30, 2009 at 12:15 AM, Aaron S. Meurer<[email protected]> wrote:
>
> Hi.  Ondrej will probably have better answers to your questions when
> he replies, but here is my take

Aaron's replies are excellent. Some comments below:

> On Jul 29, 2009, at 9:57 PM, Marco wrote:
>
>>
>> I was very impressed by the description of SymPy here:
>>
>> http://www.euroscipy.org/presentations/slides/index.html
>>
>> and especially slide 14 "Internals: Object oriented model".
>>
>> I have a couple of general questions about how Object-oriented SymPy
>> is. I'm a mathematician and would like to use or extend SymPy to do
>> abstract differential geometry.
>>
>> 1. Where/how can I see a diagram of the structure of the classes in
>> SymPy?
>
> You could just download the source and look at the directory structure
> of sympy/.  You could also do
>  >>> import sympy
>  >>> dir(sympy)
> in a Python shell.  All of the classes will start with uppercase
> letters (except for some functions like sin and cos).
>
>> 2. Is SymPy at all modeled after category theory, which organizes
>> mathematics in an essentially object-oriented way?
> I am not familiar with category theory, so I cannot answer for sure,
> but Python is an object oriented language, so SymPy is object
> oriented.  However, the core is not organized in a highly abstract
> object oriented way.  You also might take a look at the SymPyCore
> project, which is based on SymPy, which I think is closer to what you
> are talking about here.  You should look into the code yourself to see
> if it is.
>
> Also, for core objects, like Add, Mul, and Pow, the most important
> thing is speed, so if a more abstract model would be slower, we
> probably wouldn't use it.  I personally think it could be improved
> some, so don't think that the way it is now is the way it has to
> stay.  For example, we are hoping to get a Cython core at some point.
>> 3. Is there a SymPy approach to, for example, vector spaces?  I do
>> *not* mean matrix algebra or computations in components.  I mean an
>> actual abstract vector space, where objects would be vectors and one
>> could take linear combinations of vectors.  I'm asking this question
>> as an example of a more general question - whether SymPy has been used
>> to do "abstract" computations on mathematical objects such as vector
>> spaces, manifolds, etc. (as mathematicians often do) rather than
>> explicit ones in numbers or polynomials.
> I do not know the answer for vector spaces.  You might look at the
> Geometric Algebra module, which implements a separate algebra from the
> rest of SymPy.  We also have support for things like non-commutative
> Symbols, though it isn't the greatest, but you could for example
> represent a matrix as a non-commutative Symbol, with scalars as
> commutative symbols.  I think SymPyCore again might have more on that
> front, but you will have to check it out for yourself (or wait until
> someone more knowledgeable replies).


We use Python classes to represent mathematical objects, so it depends
how abstract you want to go, I suggest you design a simple set of
classes that would represent what you want, e.g. a vector space +
acting on it. And then you create methods for these classes to do
useful manipulation of your objects. And you can use the full of sympy
to do useful stuff, e.g create some matrices for the base
transformations etc., if you wanted, or you can stay totally abstract,
if you wanted too.

So I can imagine something like this:

space = VectorSpace(<maybe add some more information about the space
here, like a dimension>)

base = space.base()  #this would return a set of base vectors

so it would return a set of Vector() instances. Tell us your
particular application, I can help you design it.

>
> We would love to have you help develop SymPy.  Are you already
> familiar with Python/Git?  The best way to get involved is to just
> start submitting patches and having your work reviewed.  I do not
> think differential geometry is supported yet, though I am not positive
> as I am not familiar with differential geometry.

The only thing from differential geometry that we have so far is the
calculation of the Schwarzschild metric in the general relativity, see
the examples/advanced/relativity.py example how to do that.

Ondrej

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sympy" group.
To post to this group, send email to [email protected]
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