A linear system correctly solved symbolically is nots solved when partially specialized with complex constants

52 views
Skip to first unread message

emanuel.c...@gmail.com

unread,
Oct 11, 2022, 6:41:49 AM10/11/22
to sympy

Consider :

from sympy import symbols, Eq, solve, I
L1, L2, L3, L4, C1, C2, C3, C4, M23, I1, I2, I3, I4, U, w, p, RL, J = \
symbols("L1, L2, L3, L4, C1, C2, C3, C4, M23, I1, I2, I3, I4, U, w, p, RL, J")
Sys = [Eq(I1*(J*L1*w - J/(C1*w)) + I2*J/(C1*w), U),
           Eq(I2*(J*L2*w - J/(C2*w) - J/(C1*w)) + I3*(J*M23*w + J/(C2*w)) + I1*J/(C1*w), 0),
           Eq(I2*(J*M23*w + J/(C2*w)) + I3*(J*L3*w - J/(C3*w) - J/(C2*w)) + I4*J/(C3*w), 0),
           Eq(I4*RL + I3*J/(C3*w) - I4*J/(C3*w), 0)]
IVars = [I1, I2, I3, I4]
Sol = solve(Sys, IVars)
Chk = [u.subs(Sol).simplify() for u in Sys]

This system is solved in a matter of milliseconds, and the (unique) solution is correct :

>>> Chk [True, True, True, True]

However, this :

>>> Sys0 = [u.subs({J:I}) for u in Sys]
>>> Sol0 = solve(Sys0, IVars)

“never” returns (i. e. didn’t return after >90 minutes).

WTF ?

Aaron Meurer

unread,
Oct 11, 2022, 7:47:31 PM10/11/22
to sy...@googlegroups.com
Can you open an issue in the issue tracker for this
https://github.com/sympy/sympy/issues/new. It looks like it is getting
stuck trying to compute polynomial gcds. The issue seems to be
specific to I. If you instead replace J with a real number, it works.
My guess is the fact that it's an algebraic extension causes it to get
stuck in some slow polys algorithm, or possibly an algorithm that is
bugged.

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 view this discussion on the web visit https://groups.google.com/d/msgid/sympy/fb2649d3-cba4-4919-bd05-d9de178bb561n%40googlegroups.com.

emanuel.c...@gmail.com

unread,
Oct 13, 2022, 10:21:29 AM10/13/22
to sympy
Le mercredi 12 octobre 2022 à 01:47:31 UTC+2, asme...@gmail.com a écrit :
Can you open an issue in the issue tracker for this
https://github.com/sympy/sympy/issues/new.


HTH,
Reply all
Reply to author
Forward
0 new messages