Simplify taking a long time

68 views
Skip to first unread message

David Menéndez Hurtado

unread,
Sep 11, 2015, 12:03:26 PM9/11/15
to sympy
Hi,

I have a very complicated expression. Running simplify on it takes a long time (running for 70 h and counting), while other similar or even longer expressions have been done in a few minutes. Is it possible that it has entered an endless loop?

The expression as is is good enough for my purposes, but I wanted to report a possible bug.



a0
, a1, a2, b0, b1, b2, c0, c1, c2 = symbols(vector_components, real=True)
angle, torsion = symbols(input_angles, real=True)
length, prev_length = symbols(input_lengths, real=True, positive=True)

c0 + length*((a1 - b1)*(b2 - c2) - (a2 - b2)*(b1 - c1))*sin(angle)*sin(torsion)/sqrt(((a0 - b0)*(b1 - c1) - (a1 - b1)*(b0 - c0))**2 + ((a0 - b0)*(b2 - c2) - (a2 - b2)*(b0 - c0))**2 + ((a1 - b1)*(b2 - c2) - (a2 - b2)*(b1 - c1))**2) + length*(-b0 + c0)*cos(angle)/prev_length + length*((b1 - c1)*((a0 - b0)*(b1 - c1) - (a1 - b1)*(b0 - c0)) + (b2 - c2)*((a0 - b0)*(b2 - c2) - (a2 - b2)*(b0 - c0)))*sin(angle)*cos(torsion)/(prev_length*sqrt(((a0 - b0)*(b1 - c1) - (a1 - b1)*(b0 - c0))**2 + ((a0 - b0)*(b2 - c2) - (a2 - b2)*(b0 - c0))**2 + ((a1 - b1)*(b2 - c2) - (a2 - b2)*(b1 - c1))**2))



Thanks,

/David.

Aaron Meurer

unread,
Sep 15, 2015, 1:46:27 AM9/15/15
to sy...@googlegroups.com
It should be considered a bug in simplify. It's probably not stuck in
an endless loop, but rather just an extremely inefficient algorithm.
If you end up canceling it with Control-C open an issue with the
traceback so we can see where it got stuck.

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 sympy+un...@googlegroups.com.
> To post to this group, send email to sy...@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/5cbdccc8-9a4e-4d6f-b439-57e4185b1e40%40googlegroups.com.
> For more options, visit https://groups.google.com/d/optout.

David Menéndez Hurtado

unread,
Sep 19, 2015, 3:20:41 PM9/19/15
to sympy
On Tuesday, September 15, 2015 at 7:46:27 AM UTC+2, Aaron Meurer wrote:
It should be considered a bug in simplify. It's probably not stuck in
an endless loop, but rather just an extremely inefficient algorithm.
If you end up canceling it with Control-C open an issue with the
traceback so we can see where it got stuck.

Aaron Meurer

Sorry for the late reply. I can confirm it was not stuck, and took more than four days but less than a week to finish. The final expression was almost the same, with only a minor change:

+ ((a1 - b1)...)

- ((- a1 + b1)...)

Since I have to rerun it again anyway, I can do so under cProfile. Would that be more helpful than the traceback?
Reply all
Reply to author
Forward
0 new messages