Week 3

June 2017 ยท 2 minute read

In the last week I focused mainly on finishing tasks related Lame coefficients. During this time two PR were merged. In my previous post I described how we can calculate gradient, curl and divergence in different type of coordinate system, so now I described only new thing which was already add to mainline. We decided to remove dependency between Del class and CoordSysCartesian. From mathematical point of view it makes sense, because nabla operator is just an entity which acts on vector or scalar and his behavior is independent from coordinate system. Now, when we want to use them, we need to call directly Del class. It was rather smooth change except, situation when we are dealing with object which is not created in CoordSysCartesian, Vector.zero. In that situation we can’t obtain information about coordinate system, because neither Del nor object doesn’t have them. The consequence of that fact is inability of leaving unevaluated value from such object. For example, previously, we could calculate curl and get result in following manner:

delop ^ Vector.zero (Derivative(0, C.y) - Derivative(0, C.z))*C.i + (-Derivative(0, C.x) + Derivative(0, C.z))*C.j + (Derivative(0, C.x) - Derivative(0, C.y))*C.k

Now we cannot do that, so we need to automatically return 0. Below I demonstrate present usage of nabla operator on SymPy:

C = CoordSysCartesian('C') delop = Del() delop.dot(C.x*C.i) Derivative(C.x, C.x) v = x*i + y*j + z*k delop & v Derivative(C.x, C.x) + Derivative(C.y, C.y) + Derivative(C.z, C.z))