In my previous blog post, I had mentioned that I had begun working somewhat on a new branch for the vector module. This week was spent in polishing that work. But more importantly, I spent time confirming that my last week’s idea – of implementing the Vector framework, BaseScalar class, and the Del operator before implementing coordinate systems – does make sense. What this essentially means is that all the operations will occur in one frame only (for now).
I have implemented the Vector framework to a great extent by now, the BaseScalar class is done, and so is the Del operator. I have tried keeping the API of the Del class as ‘easy’ as possible, mainly so that the expressions typed out in code, would be very simple to read even for a non-fluent programmer.
To confirm that the one-system-framework does work, I tried proving all of the product rules of vector differential calculus (using the constructed API).
Here is a snippet of (actual) Python-Shell session proving the last product rule-
Rule says :
Shell session (i, j and k denote base vectors, while x, y and z denote base scalars)-
>>> u = x**2 * i + 4 * j - y**2*z * k
>>> v = 4 * i + x*y*z * k
>>> lhs = delop ^ (u ^ v)
>> rhs = u * (delop & v) - v * (delop & u) + (v & delop) * u - (u & delop) * v
>>> simplify(lhs) == simplify(rhs)
I guess intensive coding will begin this week onwards. The first priority would be to ensure that the Vector framework is foolproof, by writing unit tests and some long ones. I would also like SymPy functions like the solve one, to work with vector too (To solve problems like – given 3 vectors, prove that they can be used as a valid basis for 3D space). Then, I will most likely send a PR with the work done till now. On a different branch, I’ll start working on the CoordSys class. Thats all for now! Have a great wek!