First, sorry for replying so late. Had some assignments to complete (still 
do :P )
Second, thanks a lot for elucidating everything in such detail. I am 
constantly amazed by the wonderful community response here. Thank you all 
for that.

Now, getting back to the topic of discussion,
On Tuesday, March 12, 2013 12:43:28 AM UTC+5:30, Stefan Krastanov wrote:
>
> First of all, I think it would be nice to start writing a wiki page 
> with the proposal as the general idea seems clear enough. 
>
 
 Yes. I'll start with the proposal shortly; I still need to coordinate with 
Sachin for his proposed electrodynamics module.

Second (and most important in this message), I would vote for 
> completely forgetting about anything outside 3D. Implementations of 
> vector calculus in Rn should be done (and are done to some extend) in 
> the geometrical algebra and differential geometry modules (and the 
> tensor canonicalization pull request by Pernici). The whole idea of a 
> vector calculus module, in my opinion, is that when working in R3 you 
> do not need all these generalized notions of, e.g, curl or vector 
> product in terms of completely antisymmetric tensors. 
>
> Obviously, we would love to have `rewrite_as` methods to couple it to 
> the diffgeom/ga/tensor modules but that does not mean it is a good 
> idea to use, for instance, the diffgeom module as a basis for your 
> project. It can be done and for puritans it will indeed be a deep 
> example of code deduplication/reuse and object oriented blah blah. 
> However, the code will be harder to understand and the obvious notions 
> of R3 calculus will be hidden behind their generalizations. 
>

Implementing in R3 reduces quite a bit of my work - Now I don't have to 
read Tensor Analysis. And yes, keeping in line with my objectives, 
implementing in R3 will definitely be more accessible to the typical user. 
The rewrite_as method, as you mentioned, sounds really good to me for 
module interoperability. 
 

> And simply from a practical standpoint, the mechanics module is 
> already based around R2/R3. It is more important to abstract that away 
> than to generalize it to cases that will not be used. 
>
> The rest of my comments are below, annotating your message. 
>
> > @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. 
>
> It is a bit unclear what you mean by "component dependent". Here are 
> the two ways this can be understood: 
>
> 1. Simply using matrices without "metadata". I consider this a very 
> bad idea as a matrix is just a representation of the geometrical 
> entity vector and all that can be done this way is already in the 
> matrix module. 
> 2. Using some symbolic object containing 
>    - reference to the "world" in which we work 
>    - reference to the reference/basis in which we represent the vector 
>    - the coordinates in this basis, which is a matrix 
>
> EDIT: I see that you actually use the second approach. Great! 
>
 
As you said, I am using approach number 2.

> 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. 
>
> I would say, leave quantum away. Hilbert spaces in quantum mechanics 
> are sufficiently different from R3 to necessitate their own 
> implementation. On the other hand, I strongly suggest that this 
> project you are preparing be the basis for the electrodynamics project 
> by Sachin. You should definitely work together on this. 
>
> Alright then. In any case, I seem to be lacking the appropriate maths 
required for full-fledged treatment of quantum physics anyway.
 

> > 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. 
>
> Reference Frame makes sense outside mechanics (and for any dimension, 
> but as I said, I would like to see this project restricted to 3D done 
> right). 
>
> You might be confusing the following notions (or maybe you do not, but 
> in any case let's just spell them out): 
>
>  - vector space vs affine space (or flat manifold): Physics and vector 
> analysis is __not__ done on vector spaces. Just look at your example 
> below: you have components of the vector (the vector space part) and 
> the coordinates of the point where this vector is (the manifold part). 
>  - the basis is what you use to express the components of the vector 
> (the vector space part). 
>  - the coordinate system is what you use to express the point in space 
> you are using. 
>  - you can very well have two different cartesian coordinate systems 
> (centered at the same point but rotated wrt to each other or instead 
> parallel but with different origins). In the same way you can have two 
> different spherical coordinate systems. 
>  - you may have noticed that the basis you use for the vectors can 
> change from point to point. For instance, the usual basis you use when 
> dealing with spherical coordinates is radial/longitudinal/latitudinal 
> vectors. However they change from point to point. This defines a 
> _frame_: having a frame is having a basis at each point of your space. 
>

Yes of course. As a matter of fact, I had, at one point, considered the 
idea of implementing a RefranceFrame by using an origin of coordinates 
w.r.t. to world coordinates and using a basis defined at that origin (my 
point might not have come across very clearly here, I admit).
Also, the fact that basis changes from point to point is taken care of by 
CoordSystem object passed to Vector (the way I see it as of yet). The 
operations (grad, curl, div etc) on a Vector will again be defined based on 
the CoordSystem object.

 - importantly, there is a canonical frame for each coordinate system 
> (the one you obtain by having unit vectors in the directions in which 
> coordinates change). 
>  - A reference frame can be (depending on textbook): the coordinate 
> system, the frame, or both taken together. I do not know which is in 
> the mechanics module. Just stick to it, and refactor it out into your 
> own module.  

I think it would be good to refactor the above list, fix the 
> terminology you will be using and add it in your wiki page 
> application. 
>
> > 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 
>
> This seems sensible. You may want to abstract (x, y, z) out into a 
> Point class, as in diffgeom, however this might be excessive, 
> especially given that we do not mix coordinate systems with frames of 
> other coordinate systems
>
 
A Point class sound like a good idea to me. This way, we can define methods 
on the class which would help out a lot. As an example, we can have a 
method to rewrite the point coordinates for a different reference frame.


> > 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) 
>
> Mostly agree, but drop dim!=3. And I have a lot of technical comments 
> concerning the  the `symbol` argument, but they can wait for later.

 
Okay. Since we are going ahead with R3, so, dim will be 3 by default. 

> 
> > 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). 
>
> Concerning the very important "unbound?" question. In your first 
> example `Vector` is actually a vector field, i.e. bound vector for 
> physicists (there is a difference between vector field and a bound 
> vector but drop it for the moment). In your second example `Vector` is 
> actually a vector, not a vector field. Vector analysis cares about 
> vector fields, so just completely drop the unbounded vectors from your 
> proposal. They have place in linear algebra module, in matrix 
> expressions module and in hilbert spaces module (the quantum module), 
> not here. 
>

Okay. I was just experimenting a bit so, yeah, will drop the idea of 
unbound vectors. 

>  
>

> PS 
>
> By the way, this question show an issue that must be discussed a lot 
> before we are clear about how to proceed. The mechanics module deals 
> with bounded vectors, not vector fields. The electrodynamics module 
> and your vector analysis module would deal with vector fields. How can 
> these two notions can be combined (is it possible/practical)? I would 
> like to see this discussed in your proposal. 
>
> Here is an example of the issue: 
>
> 1. a field 
> some_vortex_field = Vector((-y, x, 0), (x, y, z)) 
>
> 2. a bounded vector 
> some_force_on_some_point = Vector((1,2,0), (p_x, p_y, p_z)) 
>
> The first example is what one will do in electrodynamics do define 
> some field. You can calculate its curl for instance. 
>
> The second example is something from the mechanics module. The point 
> is for instance some joint that we are studying and the vector is the 
> force at that point. 
>
> Does it make sense to represent both these objects with the same class? 


I haven't thought of this in detail yet. But, at a first glance, my answer 
is yes. We can just have a property Vector.is_field that can be used to 
differentiate between the two different types. Also, if it's just a 
constant vector, then curl, div are both zero.
Another way to go about this is inherent in the initialization of the 
vector. The second 3-tuple is actually used for getting the 'variables' 
that must be used in taking, say, the curl of the vector field. If we don't 
give out these variables explicitly, then the data members of Vector object 
that holds that 3-tuple is just going to be None. That way too, we can 
distinguish between vector fields and constant vectors.

Anyway, as I mentioned before, things are very sketchy right now. Let me 
first talk with Sachin and try out mechanics a bit as well. I plan to make 
refinements in layers, fine tuning things till they are right. So, I'll 
begin writing a proposal soon, but I won't necessarily put it on the wiki 
just yet. Once I have something concrete, *then* I'd post it on the wiki. 
In the meanwhile, let's keep this thread for all discussions concerning the 
vector module.

Again, thanks a ton for all the help.

-- 
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 sympy+unsubscr...@googlegroups.com.
To post to this group, send email to sympy@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to