Sorry I forgot to give the link in my last post - https://github.com/sympy/sympy/pull/7566
On Friday, June 6, 2014 7:14:51 PM UTC+5:30, Sachin Joglekar wrote: > > Hello everyone, > I have been working on a basic vector framework for sympy for some time > now. I am still working on the classes for coordinate systems, so currently > all operations occur in the _same_ frame. The PR for the code is here > <https://github.com/sympy/sympy/pull/7566>. > > To get you started, here is how you would do some basic vector > manipulations using the code (i, j, k are by default base vectors, and x, > y, z are by default base scalars. Better naming ideas?)- > > >>> from sympy.vector import * > >>> u = 4*i - 5*k > >>> from sympy.vector.vector import VectorAdd > >>> isinstance(u, VectorAdd) > True > >>> v = 8*k > >>> u += v > >>> u ^ v > ...output... > > Now I am facing a few problems.. > > 1. How do I ensure methods like 'trigsimp' work with these classes? > Currently, passing a vector like *(sin(a)+cos(a))**2*i - j* to trigsimp > returns the correct answer mathematically, _but_ the instance is of type > Add (instead of the expected VectorAdd). How do I prevent this? > > 2. How do I get 'solve' to work with these classes? For example, consider > a problem solved (in the future) using the module - > > *Do the following vectors form a basis for R^3: {(2,-3,1), (4,1,1), > (0,-7,1)}?* > > To check if the vectors can form a basis, we check if the 3 conventional > basis vectors can be expressed in terms of the given vectors. First, define > b1, b2 and b3 as the vectors in question > > >>> b1 = 2*R.i - 3*R.j + R.k > >>> b2 = 4*R.i + R.j + R.k > >>> b3 = - 7*R.j + R.k > > Define three Symbols as the coefficients of the linear multiples > > >>> a, b, c = symbols('a b c') > > Now check if R.i = x*b1 + y*b2 + z*b3n returns a valid solution. If yes, > do the same for R.j and R.z. If all three have some solution (not > necessarily same), the vectors do form a basis. > > >>> solve(R.i - (a*b1 + b*b2 + c*b3), a, b, c) > >>> > > solve returned None. Hence, solution does not exist. Therefore, the given > vectors cannot define a basis for R^3. > > I think it would involve changing the code for 'solve' itself. Any ideas? > > I guess answering these questions may require a look at my code, so any > help is appreciated. > -- 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. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/b8ce71ad-54f5-4bb9-a7d4-90364d1e5b3b%40googlegroups.com. For more options, visit https://groups.google.com/d/optout.