On Fri, Sep 8, 2017 at 6:24 AM, Nikhil Pappu <[email protected]> wrote:
> I wrote a Quaternion class which provides basic quaternion operations > (please see the attachment). > I have never made an open source contribution before so I am sorry if any > of these questions are stupid. > > Here are my queries : > > 1) What module of sympy should I put this file in? > I'm not sure what the best place is. I would look at all the submodules and put it where it fits best for the intended use case. Maybe it needs a new submodule. If you can't find a good place for it, just put it in sympy/functions for now. > > 2) Is my code good enough to be added to sympy? If not, what changes > should I make? > Please open a pull request. It is much easier to suggest changes on GitHub. > > 3) printing issue : > In my code I used 2 classes for printing (CustomStrPrinter and > CustomLatexPrinter) and set the default to CustomStrPrinter. > The issue is that if I set the default to CustomLatexPrinter it works fine > for IPython shell commands but when I call the print function on expressions > it prints the latex form of the expression. > I want shell commands to use the CustomLatexPrinter (if latex is > available) and print statements to use the CustomStrPrinter. > > I guess I am confused about this whole printing thing. > In short, I want the printing to work in the way it works for sympy > matrices (gives a fancy latex matrix in IPython shell commands but gives a > normal string when print is used). > If you want to modify the default printers you need to define the appropriate method on the object, like _latex and _sympystr. See http://docs.sympy.org/latest/modules/printing.html. > 4) I made some functions in the code called diff, integrate, exp and ln > and they can be called on a Quaternion object q as > q.integrate() > q.exp() > q.ln() > > but I also want them to work when sympy.integrate(q), sympy.exp(q), > sympy.ln(q) are used. How should I accomplish this? > For integrate() you should define _eval_integral. For exp() I believe _eval_power will work. For other functions such as ln, there's not currently a way to define the behavior. How do you define the exponential and logarithm of a quaternion by the way? Aaron Meurer > -- > 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 [email protected]. > To post to this group, send email to [email protected]. > Visit this group at https://groups.google.com/group/sympy. > To view this discussion on the web visit https://groups.google.com/d/ > msgid/sympy/5f67df3d-3979-435f-bda9-b96570a295a6%40googlegroups.com > <https://groups.google.com/d/msgid/sympy/5f67df3d-3979-435f-bda9-b96570a295a6%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 the Google Groups "sympy" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at https://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6KK6wnROvs8cA2ebPObU7v6639KrdKkySsVyy87jySiFg%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
