@Gilbert: I have been thinking along the lines of the mechanics module and
as Stefan mentioned, I plan (at least right now) to take this idea forward
with component wise operations on vectors. For component independent vector
algebra, any numerical operation on any vector will inevitably get reduced
to operations on scalars (individual components). Therefore, I believe,
that a large part of component dependent vector operations will form a
subset to a more complete component independent vector algebra. So
definitely, in the long term, we will be able to extend this vector module
to play nice with component free vector algebra, just as Raoul mentioned.
I will, at this stage, like to point out that my knowledge of mathematics
is limited to vector calculus in R3; at least for the time being. The
course I have done for vector calculus was only for vectors on R3. I have a
working knowledge of vector spaces, linear transformation, some matrix
theory but nothing from abstract algebra. I have started reading tensor
analysis to have some idea about implementing vector operations on Rn (for
example, the curl is defined in terms of permutation tensor). Right now, I
will have no problems implementing the vector module on R3 but obviously,
it would be great if it can be extended to Rn and, indeed, that is what I
am trying to accomplish.
Also, and just as you mentioned, Vector in mechanics can be extended
because the user does not directly interact with vector objects. This means
that, at least for mechanics, we won't have too many problems as far as
integration with the new module is concerned. Of course, this problem
remains for other modules (quantum, electricity-magnetism modules proposed
by Sachin). For those, I will interact with people in the community for
their requirements and hopefully, decide on an idea that keeps everyone
happy, or at least, which keeps most of the people happy.
Now, let us talk a bit about the requirement of reference frames. The
reference frames will, I think, be required only for R3 (as in case of
mechanics). I wish to abstract the idea of a reference frame as implemented
in mechanics, albeit in a bit different way. The discussion on world based
coordinate system is what I wish to point out here in this respect.
Currently, we need to have a RefrenceFrame for any vector. World
coordinates will allow vectors that just work and I think that it is a very
important feature to have from a user's point of view.
The current implementation that I have in mind will allow the user to
directly instantiate a Vector. As an example, say I want to just initialize
a vector and find out its curl. So, the user should be able do something
like (just an example of how things could function):
>>> from vector import *
>>> from sympy.abc import x, y, z
>>> coord = CoordSystem('rect')
>>> v = Vector((-y, x, 0), (x, y, z), coord=coord)
>>> div(v)
0
>>> curl(v)
2*ez
Taking a clue from diffgeom, we are defining a coordinate system first
(with 'rect' providing the basic cartesian coordinates, the definitions of
which are inbuilt. We can have similar functionality for other commonly
used coordinate systems). Then, we instantiate a vector and give it symbols
to use for coordinates. The dimension of the vector can be calculated
internally using the second n-tuple. The basis for any Rn space will be
just the standard basis. Then, we can have component-wise operations that
produce the result; in this case divergence and curl of the given vector
field.
Also, for the n-dimension case, we can have something like:
>>> v = Vector(dim=7, symbol=y, coord=coord)
Here, the coord object will carry the relations with one of the standard
coordinate systems and that will be used to define all the operations of
vector calculus.( The coord object can be generated by performing
operations on CoordSystem object of some standard coordinate system
perhaps?)
This will generate a vector (unbound?) where the coordinates wrt to the
standard basis (e1, ... , e7) are just (y1, y2, y3 ... y7).
Anyway, my ideas at this stage are sketchy at best - without knowing the
requirements of the community, this speculation on the API would be little
more than fruitless.
As should be obvious, this example represents nothing concrete; just a
glimpse of some things I'd like to see.
To conclude, my point is that we should have direct interaction of the user
with vectors, and not via reference frames. Also, the vector operations
should be defined so that everything is just intuitive.
Again, as I am mentioned above, I am currently reading a book on tensor
analysis. While I read the subject matter, I will like to gather opinions
of others (specially people related with modules that will use/already use
some form of vector calculus) on how best to implement this so that it will
be sustainable in the long run, would be easily extensible, would be
consistent with rest of SymPy codebase, and, so that it has a very
generalized API that any other module can easily use.
One more thing. If there seems to be any mathematical inconsistency with my
arguments, you can attribute that to my lack of knowledge of the requisite
subject matter; as I mentioned before. Please feel free to correct any such
inconsistencies you may find.
I shall be back again with some more reading. Until then, if you gentlemen
have any comments/suggestions, please post them here.
Thanks.
--
You received this message because you are subscribed to the Google Groups
"sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/sympy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.