Hi Aaron, Can you explain the thinking behind the Symbol class? I looked at the doc string but it's not clear how general this kind of object is.
Thanks On Jul 31, 11:16 pm, "Aaron S. Meurer" <asmeu...@gmail.com> wrote: > On Jul 31, 2009, at 8:42 PM, Marco wrote: > > > > > Hi Aaron, > > > The Set class is important to have as a master class for all kinds of > > other classes which should exist, such as Group, Field, Vector space, > > Algebra, etc. As it is in Category theory. > > > A Python set may indeed be a good place to start, but as you suggest, > > it would only be a finite set of objects. There should be a more > > general Set class, so that for example we would have a set called the > > Rationals, which itself is a class, and this set would have properties > > such that 5/6 in Rationals would evaluate as True, even though 5/6 was > > not specifically instantiated beforehand. > > This should be easy. We have a Rational class that is what every > rational number is an instance of. For example, 5/6 as a rational > number in SymPy would be represented as Rational(5, 6). It would be > easy to create a RationalSet class that checks to see if something is > an instance of Rational or if it has Rational assumptions on it in > RationalSet.__contains__(). So for example, > >>> Rational(5, 6) in RationalSet > and > >>> a = Symbol('a', rational=True) > >>> a in RationalSet > > would both return True. This should work very nicely with our new > assumptions system that we are getting. > > > > > In terms of what I have in mind for calculations, there are so many! > > > For example, out of a manifold one creates many vector bundles and > > vector spaces, such as the tangent bundle and the vector space of > > differential forms (these are possibly the most famous but there are > > many others) There are many calculations which can be done with > > forms, taking interior and exterior products, derivatives, etc. Most > > of the time we don't do these calculations in coordinates - they are > > coordinate-free (this is where their main power comes from). Even > > when we work on specific manifolds like spheres or tori, we still do > > not do our calculations in coordinates except in the most necessary > > cases, and in this case we choose coordinates in special ways. > > > As an example, you could calculate the following fact: if X is a > > vector field and a is a 1-form, and p is a differential form (of mixed > > degree) then there is a universal identity > > > (X + a)(X + a)p = a(X) p, > > I am not familiar with the theory of manifolds, but I think I can see > that there really are things to be calculated here. > > > > > > > where the left hand side is interior product by X and exterior product > > by a, done twice, and the right hand side is just multiplication by > > a scalar a(X). > > > This kind of calculation is usually done by hand, without coordinates, > > just using the intrinsic behaviour of the quantities X, a, p. > > > Another issue is that we often combine vector spaces - we take direct > > sums, tensor products, exterior products of vector bundles and of > > vector spaces... To extend all our operations to these spaces should > > be easy if they inherit from the right master classes... usually in > > the maple or mathematica packages i've used, the operations are not > > defined in this object-oriented way and so you have to teach the > > computer all your operations again, even though it should be obvious > > what they mean, because of inheritance. > > I think having a master Set class would even help for some of the > other thing that SymPy does. For example, I would assume that Set > would be able to easily represent that it is the union of two other > sets, either by having that build in to the class or by having a Union > subclass. We could then make Interval a subclass of set and it would > be easy to represent something like [1, 2]U[3, 4]. We could even have > infinite union support and be able to easily represent something like > R - Z as ...U(-1, 0)U(0, 1)U(1, 2)U.... It would fit in nicely if, > for example, an object has the assumptions real=True and > integer=False, if and only if it is a member of that set. > > Great! Looking forward. > > Aaron Meurer --~--~---------~--~----~------------~-------~--~----~ 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 sympy+unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sympy?hl=en -~----------~----~----~----~------~----~------~--~---