I see your point. But in that case, would the API remain the same? What you suggest, would involve either-
A. modifying the code for trigsimp itself or B. having a 'trigsimp' method in Vector itself (already done this) On Sun, Jun 8, 2014 at 11:26 AM, Matthew Rocklin <mrock...@gmail.com> wrote: > 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? > > I ran into this when I was building MatrixExprs which have the same issues > (We have a MatrixAdd but wanted to use core SymPy utilities, which use > Add). For a while I got away with using the core functions and then > calling "matrixify", which walked through the tree changing all Adds to > MatrixAdds, etc. if the tree contained any matrices. This worked for a > while but eventually became too much of a pain. MatrixExprs now avoid > interacting with Exprs as much as possible. Expr code assume that it deals > with scalars. This is everywhere in the code. > > My suggestion would be to subs out all of your vectors for scalars, call > trigsimp, subs back the scalars to vectors, then do some sort of > Add-to-VectorAdd operation. Maybe you can generalize this to any SymPy > scalar operation. > > 2. Regarding bases > > I agree with Franz that, if possible, it is good to leverage existing work. > > > On Fri, Jun 6, 2014 at 8:40 AM, F. B. <franz.bona...@gmail.com> wrote: > >> >> >> On Friday, June 6, 2014 3:44:51 PM UTC+2, Sachin Joglekar wrote: >>> >>> >>> 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? >>> >>> >> Maybe this is a bug. I would look for the place where the Add object is >> constructed. Maybe it's a bug in your code, maybe it's a bug in trigsimp. >> >> >> >>> 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)}?* >>> >> >> Why don't use matrix determinant? >> >> -- >> 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/9242d264-961c-407e-a6c5-3a8dc604aae7%40googlegroups.com >> <https://groups.google.com/d/msgid/sympy/9242d264-961c-407e-a6c5-3a8dc604aae7%40googlegroups.com?utm_medium=email&utm_source=footer> >> . >> >> For more options, visit https://groups.google.com/d/optout. >> > > -- > You received this message because you are subscribed to a topic in the > Google Groups "sympy" group. > To unsubscribe from this topic, visit > https://groups.google.com/d/topic/sympy/6iK_KpRnHvA/unsubscribe. > To unsubscribe from this group and all its topics, 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/CAJ8oX-F%3DsDqDtH5qcq4V8V0fAYdqadC_1HFzBAr34U%2BM-O7bqw%40mail.gmail.com > <https://groups.google.com/d/msgid/sympy/CAJ8oX-F%3DsDqDtH5qcq4V8V0fAYdqadC_1HFzBAr34U%2BM-O7bqw%40mail.gmail.com?utm_medium=email&utm_source=footer> > . > > For more options, visit https://groups.google.com/d/optout. > -- 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/CALMMyxaYCOY5OSO8r3U8mw6qJufeVQh0r7kA_-ZJeRONrPyZEA%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.