There is a flag to the printer order='none', which you can use for printers like pprint() or sstr(), which can speed up the printing of very large expressions.
Aaron Meurer On Tue, Sep 2, 2014 at 10:08 AM, Jason Moore <[email protected]> wrote: > This is typical behavior. Solving a 9 x 9 linear system will result in long > expressions. If you want to print them it will take time to parse the tree > because the expression is huge. Also, running the simplication routines on > very large expressions will also take a long time and may never even finish > depending on your computer's specs, the algorithm, etc. > > > Jason > moorepants.info > +01 530-601-9791 > > > On Tue, Sep 2, 2014 at 10:42 AM, gundamlh <[email protected]> wrote: >> >> Hi Aaron, >> >> I use Sympy to compute the solution of an inverse problem (Ax = b) >> symbolically, where A is a 9-by-9 symbolic matrix. The computation is quite >> fast, however the out-printing of the solution ''x'' vector is very slow, >> even the first entry x[0] takes longer than 2 minutes. And the >> sympy.ratsimp(x[0]) is also very slow.. I am confused... >> >> Hope for your kind response. Thanks in advance! >> Hong >> >> >> >> 在 2012年3月4日星期日UTC+1下午9时49分06秒,Aaron Meurer写道: >>> >>> On Wed, Feb 29, 2012 at 9:28 AM, Vinzenz Bargsten <[email protected]> >>> wrote: >>> > Am 28.02.2012 06:41, schrieb Ondřej Čertík: >>> > >>> >> Hi Vinzenz, >>> >> >>> >> On Mon, Feb 27, 2012 at 4:27 PM, Vinzenz Bargsten<[email protected]> >>> >> wrote: >>> >> [...] >>> >>> >>> >>> Thank you very much. I think I get the point, but I will need some >>> >>> time >>> >>> to >>> >>> implement it. >>> >>> If this is working, I can finally get rid of Mathematica and the >>> >>> complete >>> >>> modeling procedure as well as the required model transformations >>> >>> for a 7-axes robot (Kuka LWR) are carried out by sympy. >>> >> >>> >> That'd be really cool. Yes, the trigonometric simplification is pretty >>> >> hard. >>> >> Besides that, how is SymPy doing otherwise in terms of speed compared >>> >> to Mathematica for your problem? >>> >> >>> >> >>> >> Ondrej >>> > >>> > Hi Ondrej, >>> > >>> > your question is not easy to answer. It depends on the actual task and >>> > how >>> > you implement it / the algorithm. The simplification problem is an >>> > example: >>> > Using the expand()-replace()-solution is probably slower compared to >>> > Mathematica's Simplify[], but using the monomial-based solution may be >>> > faster. >>> > On average, I would say sympy is at least as fast as Mathematica for my >>> > application. >>> >>> Well, in general, you should be able to just call simplify() (or >>> trigsimp()), and it should just work. So simplification (especially >>> trig simplification) is one area where we can definitely use >>> improvement. >>> >>> > >>> > The advantages of sympy in my eyes compared to Mathematica are that >>> > sympy is >>> > deterministic and you get error messages and the messages point to the >>> > problem. >>> >>> This is the first time I've heard this particular reason for SymPy >>> being better. How is Mathematica non-deterministic? I've never used >>> it, except for WolframAlpha, because, as you noted, it's not free, and >>> I don't own a copy. >>> >>> I suppose the better error messages are a result of Python including >>> the traceback? >>> >>> > Besides the math functions (in many cases superior or unique) >>> >>> Cool. What functions are unique? I only know of one that I'm pretty >>> sure is unique (or at least I couldn't find it in their docs), but >>> it's part of the polys module. I guess maybe the code generation >>> stuff? >>> >>> > it >>> > has many convenient functions (such as the printing functions to >>> > generate >>> > c-code of your expressions) and one can use all other python functions. >>> > -- >>> > and sympy is free ;) >>> > >>> > Regards, >>> > Vinzenz >>> >>> 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 http://groups.google.com/group/sympy. >> To view this discussion on the web visit >> https://groups.google.com/d/msgid/sympy/65cd2d04-84ff-4eac-8a69-93c144061d83%40googlegroups.com. >> 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 http://groups.google.com/group/sympy. > To view this discussion on the web visit > https://groups.google.com/d/msgid/sympy/CAP7f1Ahie8z6jX_%3DkXYNaD9BnP9o5ReUV9tz58xgmqB3pf%3D4jQ%40mail.gmail.com. > > 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 http://groups.google.com/group/sympy. To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/CAKgW%3D6L8Fc5f%3D5N0WEfc%3DyoVrVCAQ6sVGBP1TNQmWSoHbRXERQ%40mail.gmail.com. For more options, visit https://groups.google.com/d/optout.
