I have a linear equation system consisting of 3 equations as a result of a matrix multiplication. The equation system has 3 unknowns and 24 input variables. In theory, it should be solvable, however, linsolve takes forever (roughly a day so far) to calculate a solution.
Here is my sympy input:
from sympy import Matrix, symbols, pprint, Eq, linsolve
from sympy.utilities.lambdify import lambdastr
n2_x, n2_y, n2_z, o2_x, o2_y, o2_z, a2_x, a2_y, a2_z, p2_x, p2_y, p2_z = symbols('n2_x n2_y n2_z o2_x o2_y o2_z a2_x a2_y a2_z p2_x p2_y p2_z', real=True)
T_2 = Matrix([[n2_x, o2_x, a2_x, p2_x], [n2_y, o2_y, a2_y, p2_y], [n2_z, o2_z, a2_z, p2_z], [0,0,0,1]])
n3_x, n3_y, n3_z, o3_x, o3_y, o3_z, a3_x, a3_y, a3_z, p3_x, p3_y, p3_z = symbols('n3_x n3_y n3_z o3_x o3_y o3_z a3_x a3_y a3_z p3_x p3_y p3_z', real=True)
T_3 = Matrix([[n3_x, o3_x, a3_x, p3_x], [n3_y, o3_y, a3_y, p3_y], [n3_z, o3_z, a3_z, p3_z], [0,0,0,1]])
p_x, p_y, p_z = symbols('p_x p_y p_z', real=True)
R_p = Matrix([[0, 0, 0, p_x], [0, 0, 0, p_y], [0, 0, 0, p_z], [0,0,0,1]])
eq1 = (Matrix.eye(4)-T_2*T_3**-1)*R_p
eq2 = Eq(eq1[0, 3], 0)
eq3 = Eq(eq1[1, 3], 0)
eq4 = Eq(eq1[2, 3], 0)
res = linsolve([eq1[0, 3], eq1[1, 3], eq1[2, 3]], (p_x, p_y, p_z))
pprint(res)
print(res)
How can I speed up solving the problem, or what am I doing wrong?
Thanks in advance.
EDIT: As background information: T_2 and T_3 are transformation matrices, R_p is also a transformation matrix, but with (known) zero rotation. We are looking for the translation only.
I do concur with JohanC that it might be worth considering a different way of approaching this since the expressions you are asking for are enormous. If you know anything more specific about any relationship between the symbols then it can be better to use that information up front.
Looking at the answer (below) there seems to be a clear repetitive structure to it that would suggest that there could be a more intelligent way of computing that result rather than just slinging the whole system of arbitrary symbols into sympy. I expect that finding an expression for the i,j element of your matrix would lead to a shorter result involving indices and summations.
That being said there have been a lot of improvements in the performance of linsolve in sympy 1.7 and since (i.e. the current master branch that will at some point become 1.8). I expect further improvements after 1.8 as well.
With the (almost-)current sympy master branch I tried this and got a solution in around 1 minute:
In [33]: %time res = linsolve([eq1[0, 3], eq1[1, 3], eq1[2, 3]], (p_x, p_y, p_z))
CPU times: user 42.7 s, sys: 1.23 s, total: 43.9 s
Wall time: 51.2 s
Note that the first time I tried it took 1 minute. When I tried again after quitting Python and updating to the absolute latest sympy master it took a lot longer (not sure how long). I don't think anything should have changed but it's possible that the time taken is non-deterministic somehow.
The answer I found is:
In [41]: str(res)
Out[41]: 'FiniteSet(((a2_x*n2_y*o2_z*p3_x - a2_x*n2_y*o3_x*p2_z + a2_x*n2_y*o3_x*p3_z - a2_x*n2_y*o3_z*p3_x - a2_x*n2_z*o2_y*p3_x + a2_x*n2_z*o3_x*p2_y - a2_x*n2_z*o3_x*p3_y + a2_x*n2_z*o3_y*p3_x + a2_x*n3_x*o2_y*p2_z - a2_x*n3_x*o2_y*p3_z - a2_x*n3_x*o2_z*p2_y + a2_x*n3_x*o2_z*p3_y - a2_x*n3_x*o3_y*p2_z + a2_x*n3_x*o3_y*p3_z + a2_x*n3_x*o3_z*p2_y - a2_x*n3_x*o3_z*p3_y - a2_x*n3_y*o2_z*p3_x + a2_x*n3_y*o3_x*p2_z - a2_x*n3_y*o3_x*p3_z + a2_x*n3_y*o3_z*p3_x + a2_x*n3_z*o2_y*p3_x - a2_x*n3_z*o3_x*p2_y + a2_x*n3_z*o3_x*p3_y - a2_x*n3_z*o3_y*p3_x - a2_y*n2_x*o2_z*p3_x + a2_y*n2_x*o3_x*p2_z - a2_y*n2_x*o3_x*p3_z + a2_y*n2_x*o3_z*p3_x + a2_y*n2_z*o2_x*p3_x - a2_y*n2_z*o3_x*p2_x - a2_y*n3_x*o2_x*p2_z + a2_y*n3_x*o2_x*p3_z + a2_y*n3_x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x*p2_x - a3_z*n2_x*o2_y*p3_x + a3_z*n2_x*o3_x*p2_y - a3_z*n2_x*o3_x*p3_y + a3_z*n2_x*o3_y*p3_x + a3_z*n2_y*o2_x*p3_x - a3_z*n2_y*o3_x*p2_x - a3_z*n3_x*o2_x*p2_y + a3_z*n3_x*o2_x*p3_y + a3_z*n3_x*o2_y*p2_x - a3_z*n3_x*o3_y*p2_x - a3_z*n3_y*o2_x*p3_x + a3_z*n3_y*o3_x*p2_x)/(a2_x*n2_y*o2_z - a2_x*n2_y*o3_z - a2_x*n2_z*o2_y + a2_x*n2_z*o3_y - a2_x*n3_y*o2_z + a2_x*n3_y*o3_z + a2_x*n3_z*o2_y - a2_x*n3_z*o3_y - a2_y*n2_x*o2_z + a2_y*n2_x*o3_z + a2_y*n2_z*o2_x - a2_y*n2_z*o3_x + a2_y*n3_x*o2_z - a2_y*n3_x*o3_z - a2_y*n3_z*o2_x + a2_y*n3_z*o3_x + a2_z*n2_x*o2_y - a2_z*n2_x*o3_y - a2_z*n2_y*o2_x + a2_z*n2_y*o3_x - a2_z*n3_x*o2_y + a2_z*n3_x*o3_y + a2_z*n3_y*o2_x - a2_z*n3_y*o3_x - a3_x*n2_y*o2_z + a3_x*n2_y*o3_z + a3_x*n2_z*o2_y - a3_x*n2_z*o3_y + a3_x*n3_y*o2_z - a3_x*n3_y*o3_z - a3_x*n3_z*o2_y + a3_x*n3_z*o3_y + a3_y*n2_x*o2_z - a3_y*n2_x*o3_z - a3_y*n2_z*o2_x + a3_y*n2_z*o3_x - a3_y*n3_x*o2_z + a3_y*n3_x*o3_z + a3_y*n3_z*o2_x - a3_y*n3_z*o3_x - a3_z*n2_x*o2_y + a3_z*n2_x*o3_y + a3_z*n2_y*o2_x - a3_z*n2_y*o3_x + a3_z*n3_x*o2_y - a3_z*n3_x*o3_y - a3_z*n3_y*o2_x + a3_z*n3_y*o3_x), (a2_x*n2_y*o2_z*p3_y - a2_x*n2_y*o3_y*p2_z + a2_x*n2_y*o3_y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y - a3_x*n3_y*o2_y*p2_z + a3_x*n3_y*o2_y*p3_z + a3_x*n3_y*o2_z*p2_y - a3_x*n3_y*o3_z*p2_y - a3_x*n3_z*o2_y*p3_y + a3_x*n3_z*o3_y*p2_y - a3_y*n2_x*o2_y*p2_z + a3_y*n2_x*o2_y*p3_z + a3_y*n2_x*o2_z*p2_y - a3_y*n2_x*o3_z*p2_y + a3_y*n2_y*o2_x*p2_z - a3_y*n2_y*o2_x*p3_z - a3_y*n2_y*o2_z*p2_x + a3_y*n2_y*o2_z*p3_x - a3_y*n2_y*o3_x*p2_z + a3_y*n2_y*o3_x*p3_z + a3_y*n2_y*o3_z*p2_x - a3_y*n2_y*o3_z*p3_x - a3_y*n2_z*o2_x*p2_y + a3_y*n2_z*o2_y*p2_x - a3_y*n2_z*o2_y*p3_x + a3_y*n2_z*o3_x*p2_y + a3_y*n3_x*o2_y*p2_z - a3_y*n3_x*o2_y*p3_z - a3_y*n3_x*o2_z*p2_y + a3_y*n3_x*o3_z*p2_y + a3_y*n3_z*o2_x*p2_y - a3_y*n3_z*o2_y*p2_x + a3_y*n3_z*o2_y*p3_x - a3_y*n3_z*o3_x*p2_y - a3_z*n2_x*o2_y*p3_y + a3_z*n2_x*o3_y*p2_y + a3_z*n2_y*o2_x*p3_y - a3_z*n2_y*o3_x*p3_y - a3_z*n2_y*o3_y*p2_x + a3_z*n2_y*o3_y*p3_x + a3_z*n3_x*o2_y*p3_y - a3_z*n3_x*o3_y*p2_y - a3_z*n3_y*o2_x*p2_y + a3_z*n3_y*o2_y*p2_x - a3_z*n3_y*o2_y*p3_x + a3_z*n3_y*o3_x*p2_y)/(a2_x*n2_y*o2_z - a2_x*n2_y*o3_z - a2_x*n2_z*o2_y + a2_x*n2_z*o3_y - a2_x*n3_y*o2_z + a2_x*n3_y*o3_z + a2_x*n3_z*o2_y - a2_x*n3_z*o3_y - a2_y*n2_x*o2_z + a2_y*n2_x*o3_z + a2_y*n2_z*o2_x - a2_y*n2_z*o3_x + a2_y*n3_x*o2_z - a2_y*n3_x*o3_z - a2_y*n3_z*o2_x + a2_y*n3_z*o3_x + a2_z*n2_x*o2_y - a2_z*n2_x*o3_y - a2_z*n2_y*o2_x + a2_z*n2_y*o3_x - a2_z*n3_x*o2_y + a2_z*n3_x*o3_y + a2_z*n3_y*o2_x - a2_z*n3_y*o3_x - a3_x*n2_y*o2_z + a3_x*n2_y*o3_z + a3_x*n2_z*o2_y - a3_x*n2_z*o3_y + a3_x*n3_y*o2_z - a3_x*n3_y*o3_z - a3_x*n3_z*o2_y + a3_x*n3_z*o3_y + a3_y*n2_x*o2_z - a3_y*n2_x*o3_z - a3_y*n2_z*o2_x + a3_y*n2_z*o3_x - a3_y*n3_x*o2_z + a3_y*n3_x*o3_z + a3_y*n3_z*o2_x - a3_y*n3_z*o3_x - a3_z*n2_x*o2_y + a3_z*n2_x*o3_y + a3_z*n2_y*o2_x - a3_z*n2_y*o3_x + a3_z*n3_x*o2_y - a3_z*n3_x*o3_y - a3_z*n3_y*o2_x + a3_z*n3_y*o3_x), (a2_x*n2_y*o2_z*p3_z - a2_x*n2_y*o3_z*p2_z - a2_x*n2_z*o2_y*p3_z + a2_x*n2_z*o3_y*p3_z + a2_x*n2_z*o3_z*p2_y - a2_x*n2_z*o3_z*p3_y - a2_x*n3_y*o2_z*p3_z + a2_x*n3_y*o3_z*p2_z + a2_x*n3_z*o2_y*p2_z - a2_x*n3_z*o2_z*p2_y + a2_x*n3_z*o2_z*p3_y - a2_x*n3_z*o3_y*p2_z - a2_y*n2_x*o2_z*p3_z + a2_y*n2_x*o3_z*p2_z + a2_y*n2_z*o2_x*p3_z - a2_y*n2_z*o3_x*p3_z - a2_y*n2_z*o3_z*p2_x + a2_y*n2_z*o3_z*p3_x + a2_y*n3_x*o2_z*p3_z - a2_y*n3_x*o3_z*p2_z - a2_y*n3_z*o2_x*p2_z + a2_y*n3_z*o2_z*p2_x - a2_y*n3_z*o2_z*p3_x + a2_y*n3_z*o3_x*p2_z + a2_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_x*o3_y*p2_z + a3_z*n2_y*o2_x*p2_z - a3_z*n2_y*o2_z*p2_x + a3_z*n2_y*o2_z*p3_x - a3_z*n2_y*o3_x*p2_z - a3_z*n2_z*o2_x*p2_y + a3_z*n2_z*o2_x*p3_y + a3_z*n2_z*o2_y*p2_x - a3_z*n2_z*o2_y*p3_x + a3_z*n2_z*o3_x*p2_y - a3_z*n2_z*o3_x*p3_y - a3_z*n2_z*o3_y*p2_x + a3_z*n2_z*o3_y*p3_x + a3_z*n3_x*o2_y*p2_z - a3_z*n3_x*o2_z*p2_y + a3_z*n3_x*o2_z*p3_y - a3_z*n3_x*o3_y*p2_z - a3_z*n3_y*o2_x*p2_z + a3_z*n3_y*o2_z*p2_x - a3_z*n3_y*o2_z*p3_x + a3_z*n3_y*o3_x*p2_z)/(a2_x*n2_y*o2_z - a2_x*n2_y*o3_z - a2_x*n2_z*o2_y + a2_x*n2_z*o3_y - a2_x*n3_y*o2_z + a2_x*n3_y*o3_z + a2_x*n3_z*o2_y - a2_x*n3_z*o3_y - a2_y*n2_x*o2_z + a2_y*n2_x*o3_z + a2_y*n2_z*o2_x - a2_y*n2_z*o3_x + a2_y*n3_x*o2_z - a2_y*n3_x*o3_z - a2_y*n3_z*o2_x + a2_y*n3_z*o3_x + a2_z*n2_x*o2_y - a2_z*n2_x*o3_y - a2_z*n2_y*o2_x + a2_z*n2_y*o3_x - a2_z*n3_x*o2_y + a2_z*n3_x*o3_y + a2_z*n3_y*o2_x - a2_z*n3_y*o3_x - a3_x*n2_y*o2_z + a3_x*n2_y*o3_z + a3_x*n2_z*o2_y - a3_x*n2_z*o3_y + a3_x*n3_y*o2_z - a3_x*n3_y*o3_z - a3_x*n3_z*o2_y + a3_x*n3_z*o3_y + a3_y*n2_x*o2_z - a3_y*n2_x*o3_z - a3_y*n2_z*o2_x + a3_y*n2_z*o3_x - a3_y*n3_x*o2_z + a3_y*n3_x*o3_z + a3_y*n3_z*o2_x - a3_y*n3_z*o3_x - a3_z*n2_x*o2_y + a3_z*n2_x*o3_y + a3_z*n2_y*o2_x - a3_z*n2_y*o3_x + a3_z*n3_x*o2_y - a3_z*n3_x*o3_y - a3_z*n3_y*o2_x + a3_z*n3_y*o3_x)))'
Expanded that looks like:
FiniteSet(((a2_x*n2_y*o2_z*p3_x - a2_x*n2_y*o3_x*p2_z + a2_x*n2_y*o3_x*p3_z -
a2_x*n2_y*o3_z*p3_x - a2_x*n2_z*o2_y*p3_x + a2_x*n2_z*o3_x*p2_y -
a2_x*n2_z*o3_x*p3_y + a2_x*n2_z*o3_y*p3_x + a2_x*n3_x*o2_y*p2_z -
a2_x*n3_x*o2_y*p3_z - a2_x*n3_x*o2_z*p2_y + a2_x*n3_x*o2_z*p3_y -
a2_x*n3_x*o3_y*p2_z + a2_x*n3_x*o3_y*p3_z + a2_x*n3_x*o3_z*p2_y -
a2_x*n3_x*o3_z*p3_y - a2_x*n3_y*o2_z*p3_x + a2_x*n3_y*o3_x*p2_z -
a2_x*n3_y*o3_x*p3_z + a2_x*n3_y*o3_z*p3_x + a2_x*n3_z*o2_y*p3_x -
a2_x*n3_z*o3_x*p2_y + a2_x*n3_z*o3_x*p3_y - a2_x*n3_z*o3_y*p3_x -
a2_y*n2_x*o2_z*p3_x + a2_y*n2_x*o3_x*p2_z - a2_y*n2_x*o3_x*p3_z +
a2_y*n2_x*o3_z*p3_x + a2_y*n2_z*o2_x*p3_x - a2_y*n2_z*o3_x*p2_x -
a2_y*n3_x*o2_x*p2_z + a2_y*n3_x*o2_x*p3_z + a2_y*n3_x*o2_z*p2_x -
a2_y*n3_x*o3_z*p2_x - a2_y*n3_z*o2_x*p3_x + a2_y*n3_z*o3_x*p2_x +
a2_z*n2_x*o2_y*p3_x - a2_z*n2_x*o3_x*p2_y + a2_z*n2_x*o3_x*p3_y -
a2_z*n2_x*o3_y*p3_x - a2_z*n2_y*o2_x*p3_x + a2_z*n2_y*o3_x*p2_x +
a2_z*n3_x*o2_x*p2_y - a2_z*n3_x*o2_x*p3_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n3_y*o2_x*p3_x +
a3_z*n3_y*o3_x*p2_x)/(a2_x*n2_y*o2_z - a2_x*n2_y*o3_z - a2_x*n2_z*o2_y +
a2_x*n2_z*o3_y - a2_x*n3_y*o2_z + a2_x*n3_y*o3_z + a2_x*n3_z*o2_y -
a2_x*n3_z*o3_y - a2_y*n2_x*o2_z + a2_y*n2_x*o3_z + a2_y*n2_z*o2_x -
a2_y*n2_z*o3_x + a2_y*n3_x*o2_z - a2_y*n3_x*o3_z - a2_y*n3_z*o2_x +
a2_y*n3_z*o3_x + a2_z*n2_x*o2_y - a2_z*n2_x*o3_y - a2_z*n2_y*o2_x +
a2_z*n2_y*o3_x - a2_z*n3_x*o2_y + a2_z*n3_x*o3_y + a2_z*n3_y*o2_x -
a2_z*n3_y*o3_x - a3_x*n2_y*o2_z + a3_x*n2_y*o3_z + a3_x*n2_z*o2_y -
a3_x*n2_z*o3_y + a3_x*n3_y*o2_z - a3_x*n3_y*o3_z - a3_x*n3_z*o2_y +
a3_x*n3_z*o3_y + a3_y*n2_x*o2_z - a3_y*n2_x*o3_z - a3_y*n2_z*o2_x +
a3_y*n2_z*o3_x - a3_y*n3_x*o2_z + a3_y*n3_x*o3_z + a3_y*n3_z*o2_x -
a3_y*n3_z*o3_x - a3_z*n2_x*o2_y + a3_z*n2_x*o3_y + a3_z*n2_y*o2_x -
a3_z*n2_y*o3_x + a3_z*n3_x*o2_y - a3_z*n3_x*o3_y - a3_z*n3_y*o2_x +
a3_z*n3_y*o3_x), (a2_x*n2_y*o2_z*p3_y - a2_x*n2_y*o3_y*p2_z +
a2_x*n2_y*o3_y*p3_z - a2_x*n2_y*o3_z*p3_y - a2_x*n2_z*o2_y*p3_y +
a2_x*n2_z*o3_y*p2_y + a2_x*n3_y*o2_y*p2_z - a2_x*n3_y*o2_y*p3_z -
a2_x*n3_y*o2_z*p2_y + a2_x*n3_y*o3_z*p2_y + a2_x*n3_z*o2_y*p3_y -
a2_x*n3_z*o3_y*p2_y - a2_y*n2_x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p3_y +
a3_z*n2_z*o2_y*p2_x - a3_z*n2_z*o2_y*p3_x + a3_z*n2_z*o3_x*p2_y -
a3_z*n2_z*o3_x*p3_y - a3_z*n2_z*o3_y*p2_x + a3_z*n2_z*o3_y*p3_x +
a3_z*n3_x*o2_y*p2_z - a3_z*n3_x*o2_z*p2_y + a3_z*n3_x*o2_z*p3_y -
a3_z*n3_x*o3_y*p2_z - a3_z*n3_y*o2_x*p2_z + a3_z*n3_y*o2_z*p2_x -
a3_z*n3_y*o2_z*p3_x + a3_z*n3_y*o3_x*p2_z)/(a2_x*n2_y*o2_z -
a2_x*n2_y*o3_z - a2_x*n2_z*o2_y + a2_x*n2_z*o3_y - a2_x*n3_y*o2_z +
a2_x*n3_y*o3_z + a2_x*n3_z*o2_y - a2_x*n3_z*o3_y - a2_y*n2_x*o2_z +
a2_y*n2_x*o3_z + a2_y*n2_z*o2_x - a2_y*n2_z*o3_x + a2_y*n3_x*o2_z -
a2_y*n3_x*o3_z - a2_y*n3_z*o2_x + a2_y*n3_z*o3_x + a2_z*n2_x*o2_y -
a2_z*n2_x*o3_y - a2_z*n2_y*o2_x + a2_z*n2_y*o3_x - a2_z*n3_x*o2_y +
a2_z*n3_x*o3_y + a2_z*n3_y*o2_x - a2_z*n3_y*o3_x - a3_x*n2_y*o2_z +
a3_x*n2_y*o3_z + a3_x*n2_z*o2_y - a3_x*n2_z*o3_y + a3_x*n3_y*o2_z -
a3_x*n3_y*o3_z - a3_x*n3_z*o2_y + a3_x*n3_z*o3_y + a3_y*n2_x*o2_z
- a3_y*n2_x*o3_z - a3_y*n2_z*o2_x + a3_y*n2_z*o3_x - a3_y*n3_x*o2_z +
a3_y*n3_x*o3_z + a3_y*n3_z*o2_x - a3_y*n3_z*o3_x
- a3_z*n2_x*o2_y + a3_z*n2_x*o3_y + a3_z*n2_y*o2_x - a3_z*n2_y*o3_x +
a3_z*n3_x*o2_y - a3_z*n3_x*o3_y - a3_z*n3_y*o2_x + a3_z*n3_y*o3_x)))
Related
Now i m trying to solve 6th order of nonlinear equations.
For solving this problem, 'fsolve' is the best module for my situation.
But i have a problem for using this 'fsolve'.
My Equations below : eq1, eq2, eq3, eq4, eq5, eq6
U = (E*h/32)*(pi**4*K3+8*pi**2*K4+16*J2-pi**4/b*K1**2-8*pi**2/b*K1*J1)+pi**2/2*D*((K1*K2)**0.5+(1-v)*K5-v*K6)+F/(4*b)*pi**2*K1
eq1 = diff(U,b_1)
eq2 = diff(U,b_2)
eq3 = diff(U,b_3)
eq4 = diff(U,b_4)
eq5 = diff(U,b_5)
eq6 = diff(U,b_6)
Now i m gonna try to define functions:
def functions(v):
b_1 = v[0]
b_2 = v[1]
b_3 = v[2]
b_4 = v[3]
b_5 = v[4]
b_6 = v[5]
return eq1,eq2,eq3,eq4,eq5,eq6
Until now, all of code is perfectly completed.
But next, I got a error code for 'fsolve'
x0 = [0.1,0.1,0.1,0.1,0.1,0.1]
solutions = fsolve(functions,x0)
Traceback (most recent call last):
File "C:\Users\user\AppData\Roaming\Python\Python37\site-packages\sympy\core\expr.py", line 327, in __float__
raise TypeError("can't convert expression to float")
TypeError: can't convert expression to float
Traceback (most recent call last):
File "C:\Users\user\Desktop\-----\trial.py", line 97, in <module>
solutions = fsolve(functions,x0)
File "C:\Users\user\anaconda3\lib\site-packages\scipy\optimize\minpack.py", line 147, in fsolve
res = _root_hybr(func, x0, args, jac=fprime, **options)
File "C:\Users\user\anaconda3\lib\site-packages\scipy\optimize\minpack.py", line 225, in _root_hybr
ml, mu, epsfcn, factor, diag)
error: Result from function call is not a proper array of floats.
Actually i don't know exactly meaning about 'array of floats'.
The eq1~eq6 is really complicated expressions. For example (eq1):
519749583.393768*b_1**3 + 519749583.393768*b_1**2*b_2 + 311849750.036261*b_1**2*b_3 + 222749821.454472*b_1**2*b_4 + 173249861.131256*b_1**2*b_5 + 141749886.380119*b_1**2*b_6 + 589049527.846271*b_1*b_2**2 + 920699262.011818*b_1*b_2*b_3 + 742499404.84824*b_1*b_2*b_4 + 619499503.439037*b_1*b_2*b_5 + 530653420.807624*b_1*b_2*b_6 + 395009683.379264*b_1*b_3**2 + 672299461.117134*b_1*b_3*b_4 + 581053380.409443*b_1*b_3*b_5 + 510299590.968427*b_1*b_3*b_6 + 296183828.527375*b_1*b_4**2 + 524699579.42609*b_1*b_4*b_5 + 469323153.224931*b_1*b_4*b_6 + 236661575.009363*b_1*b_5**2 + 429394392.660243*b_1*b_5*b_6 + 196977114.839905*b_1*b_6**2 + 39642.9110110422*b_1 + 193049845.260542*b_2**3 + 482129613.548124*b_2**2*b_3 + 406949673.808743*b_2**2*b_4 + 350618949.729969*b_2**2*b_5 + 307488215.070719*b_2**2*b_6 + 420149663.228267*b_2*b_3**2 + 732095017.5835*b_2*b_3*b_4 + 645437944.186494*b_2*b_3*b_5 + 575987321.121736*b_2*b_3*b_6 + 326318969.207663*b_2*b_4**2 + 585464236.60242*b_2*b_4*b_5 + 529609601.687166*b_2*b_4*b_6 + 266189415.118358*b_2*b_5**2 + 486862510.0121*b_2*b_5*b_6 + 224616040.694387*b_2*b_6**2 - 29192.3833775011*b_2 + 125272976.510293*b_3**3 + 334349732.001359*b_3**2*b_4 + 299655189.675087*b_3**2*b_5 + 270932940.727941*b_3**2*b_6 + 302393649.018531*b_3*b_4**2 + 549176644.826696*b_3*b_4*b_5 + 501838635.183477*b_3*b_4*b_6 + 252001834.206563*b_3*b_5**2 + 464613445.578031*b_3*b_5*b_6 + 215729827.081362*b_3*b_6**2 - 28558.195613361*b_3 + 92286363.2746599*b_4**3 + 253972873.350655*b_4**2*b_5 + 234063996.922265*b_4**2*b_6 + 234970783.525745*b_4*b_5**2 + 436229928.976872*b_4*b_5*b_6 + 203716223.26551*b_4*b_6**2 - 24903.5955817128*b_4 + 72968765.0411644*b_5**3 + 204424758.743579*b_5**2*b_6 + 191897759.069662*b_5*b_6**2 - 21706.6337724143*b_5 + 60314467.7838601*b_6**3 - 19178.52782655*b_6 + 52.9828871992195*((35.720610813872*b_2**2 + 142.882443255488*b_2*b_3 + 214.323664883232*b_2*b_4 + 285.764886510976*b_2*b_5 + 357.20610813872*b_2*b_6 + 257.188397859878*b_3**2 + 918.529992356708*b_3*b_4 + 1333.56947038455*b_3*b_5 + 1753.55725813553*b_3*b_6 + 893.0152703468*b_4**2 + 2727.7557348775*b_4*b_5 + 3709.44804605594*b_4*b_6 + 2154.22760600582*b_5**2 + 6001.0626167305*b_5*b_6 + 4254.9551116524*b_6**2)*(0.482*b_1**2 + 0.321333333333333*b_1*b_2 + 0.1928*b_1*b_3 + 0.137714285714286*b_1*b_4 + 0.107111111111111*b_1*b_5 + 0.0876363636363637*b_1*b_6 + 0.0964*b_2**2 + 0.137714285714286*b_2*b_3 + 0.107111111111111*b_2*b_4 + 0.0876363636363637*b_2*b_5 + 0.0741538461538462*b_2*b_6 + 0.0535555555555556*b_3**2 + 0.0876363636363637*b_3*b_4 + 0.0741538461538462*b_3*b_5 + 0.0642666666666667*b_3*b_6 + 0.0370769230769231*b_4**2 + 0.0642666666666667*b_4*b_5 + 0.0567058823529412*b_4*b_6 + 0.0283529411764706*b_5**2 + 0.0507368421052632*b_5*b_6 + 0.022952380952381*b_6**2))**0.5*(0.964*b_1 + 0.321333333333333*b_2 + 0.1928*b_3 + 0.137714285714286*b_4 + 0.107111111111111*b_5 + 0.0876363636363637*b_6)/(0.482*b_1**2 + 0.321333333333333*b_1*b_2 + 0.1928*b_1*b_3 + 0.137714285714286*b_1*b_4 + 0.107111111111111*b_1*b_5 + 0.0876363636363637*b_1*b_6 + 0.0964*b_2**2 + 0.137714285714286*b_2*b_3 + 0.107111111111111*b_2*b_4 + 0.0876363636363637*b_2*b_5 + 0.0741538461538462*b_2*b_6 + 0.0535555555555556*b_3**2 + 0.0876363636363637*b_3*b_4 + 0.0741538461538462*b_3*b_5 + 0.0642666666666667*b_3*b_6 + 0.0370769230769231*b_4**2 + 0.0642666666666667*b_4*b_5 + 0.0567058823529412*b_4*b_6 + 0.0283529411764706*b_5**2 + 0.0507368421052632*b_5*b_6 + 0.022952380952381*b_6**2) + (-1.28102213260338e-7*b_2 - 3.20255533150846e-8*b_3 - 3.20255533150846e-8*b_4 - 1.60127766575423e-8*b_6)*(0.482*b_1**2 + 0.321333333333333*b_1*b_2 + 0.1928*b_1*b_3 + 0.137714285714286*b_1*b_4 + 0.107111111111111*b_1*b_5 + 0.0876363636363637*b_1*b_6 + 0.0964*b_2**2 + 0.137714285714286*b_2*b_3 + 0.107111111111111*b_2*b_4 + 0.0876363636363637*b_2*b_5 + 0.0741538461538462*b_2*b_6 + 0.0535555555555556*b_3**2 + 0.0876363636363637*b_3*b_4 + 0.0741538461538462*b_3*b_5 + 0.0642666666666667*b_3*b_6 + 0.0370769230769231*b_4**2 + 0.0642666666666667*b_4*b_5 + 0.0567058823529412*b_4*b_6 + 0.0283529411764706*b_5**2 + 0.0507368421052632*b_5*b_6 + 0.022952380952381*b_6**2) + (1.18477228028269e-9*b_1 + 6.14508444130024e-10*b_2 + 4.60881333097518e-10*b_3 + 1.53627111032506e-10*b_4 + 1.53627111032506e-10*b_5)*(78.9568352087149*b_1**2 + 52.6378901391433*b_1*b_2 + 31.582734083486*b_1*b_3 + 22.5590957739185*b_1*b_4 + 17.5459633797144*b_1*b_5 + 14.3557882197663*b_1*b_6 + 15.791367041743*b_2**2 + 22.5590957739185*b_2*b_3 + 17.5459633797144*b_2*b_4 + 14.3557882197663*b_2*b_5 + 12.1472054167254*b_2*b_6 + 8.77298168985721*b_3**2 + 14.3557882197663*b_3*b_4 + 12.1472054167254*b_3*b_5 + 10.5275780278287*b_3*b_6 + 6.07360270836269*b_4**2 + 10.5275780278287*b_4*b_5 + 9.2890394363194*b_4*b_6 + 4.6445197181597*b_5**2 + 8.31124581144368*b_5*b_6 + 3.75984929565309*b_6**2) + (0.964*b_1 + 0.321333333333333*b_2 + 0.1928*b_3 + 0.137714285714286*b_4 + 0.107111111111111*b_5 + 0.0876363636363637*b_6)*(-1.28102213260338e-7*b_1*b_2 - 3.20255533150846e-8*b_1*b_3 - 3.20255533150846e-8*b_1*b_4 - 1.60127766575423e-8*b_1*b_6 - 1.60127766575423e-8*b_2**2 - 3.20255533150846e-8*b_2*b_3 - 1.60127766575423e-8*b_2*b_5 - 8.00638832877115e-9*b_3**2 + 1.60127766575423e-8*b_3*b_4 - 8.00638832877115e-9*b_3*b_6 - 8.00638832877115e-9*b_4*b_5 + 8.00638832877115e-9*b_4*b_6 + 4.00319416438558e-9*b_5**2 - 8.00638832877115e-9*b_5*b_6 + 4.00319416438558e-9*b_6**2 + 41123.3516712057) - 129937395.848442*(4*b_1 + 1.33333333333333*b_2 + 0.8*b_3 + 0.571428571428572*b_4 + 0.444444444444445*b_5 + 0.363636363636364*b_6)*(b_1**2 + 0.666666666666667*b_1*b_2 + 0.4*b_1*b_3 + 0.285714285714286*b_1*b_4 + 0.222222222222222*b_1*b_5 + 0.181818181818182*b_1*b_6 + 0.2*b_2**2 + 0.285714285714286*b_2*b_3 + 0.222222222222222*b_2*b_4 + 0.181818181818182*b_2*b_5 + 0.153846153846154*b_2*b_6 + 0.111111111111111*b_3**2 + 0.181818181818182*b_3*b_4 + 0.153846153846154*b_3*b_5 + 0.133333333333333*b_3*b_6 + 0.076923076923077*b_4**2 + 0.133333333333333*b_4*b_5 + 0.117647058823529*b_4*b_6 + 0.0588235294117647*b_5**2 + 0.105263157894737*b_5*b_6 + 0.0476190476190477*b_6**2) + (157.91367041743*b_1 + 52.6378901391433*b_2 + 31.582734083486*b_3 + 22.5590957739185*b_4 + 17.5459633797144*b_5 + 14.3557882197663*b_6)*(5.92386140141343e-10*b_1**2 + 6.14508444130024e-10*b_1*b_2 + 4.60881333097518e-10*b_1*b_3 + 1.53627111032506e-10*b_1*b_4 + 1.53627111032506e-10*b_1*b_5 + 2.30440666548759e-10*b_2**2 + 1.53627111032506e-10*b_2*b_3 + 1.53627111032506e-10*b_2*b_4 + 1.53627111032506e-10*b_2*b_6 + 7.6813555516253e-11*b_3**2 - 7.6813555516253e-11*b_3*b_4 + 7.6813555516253e-11*b_3*b_6 + 7.6813555516253e-11*b_4*b_5 + 7.6813555516253e-11*b_4*b_6 + 3.84067777581265e-11*b_5**2 - 251.041666666667)
I must solve such theses 6 equations.
But " Result from function call is not a proper array of floats. " error message comes out.
Is there anyone who help my code?
I'm Python beginning, so Plz understane me
I'm trying to solve a long block of equations from an EES implementation using the scipy.optimze.fsolve. But in this block of equations there are CoolProp calls that have a range of validation, and sometimes it yields ValueError. I want to know if there is a strategy to avoid ValueError and let fsolve try another guesses.
This is my code:
def block1(x):
def cp_gas(Ti, Tj):
return (1000/(Tj - Ti)*(x[6]*1.25 + x[1]*(0.45 *(((Tj + 273.15)/1000)
-((Ti + 273.15)/1000)) + 1.67*(((Tj + 273.15)/1000)**2 - ((Ti + 273.15)/1000)**2)/2
- 1.27*(((Tj + 273.15)/1000)**3 - ((Ti + 273.15)/1000)**3)/3
+ 0.39*(((Tj + 273.15)/1000)**4 - ((Ti + 273.15)/1000)**4)/4)
+ x[2]*(1.79 *(((Tj + 273.15)/1000) - ((Ti + 273.15)/1000))
+ 0.107*(((Tj + 273.15)/1000)**2 - ((Ti + 273.15)/1000)**2)/2
+ 0.586*(((Tj + 273.15)/1000)**3 - ((Ti + 273.15)/1000)**3)/3
- 0.2*(((Tj + 273.15)/1000)**4 -((Ti + 273.15)/1000)**4)/4)
+ x[3]*(1.11*(((Tj + 273.15)/1000) - ((Ti + 273.15)/1000))
- 0.48*(((Tj + 273.15)/1000)**2 - ((Ti + 273.15)/1000)**2)/2
+ 0.96*(((Tj + 273.15)/1000)**3 - ((Ti + 273.15)/1000)**3)/3
- 0.42*(((Tj + 273.15)/1000)**4 - ((Ti + 273.15)/1000)**4)/4)
+ x[4]*(0.88*(((Tj + 273.15)/1000) - ((Ti + 273.15)/1000))
- 0.0001*(((Tj + 273.15)/1000)**2 - ((Ti + 273.15)/1000)**2)/2
+ 0.54*(((Tj + 273.15)/1000)**3 - ((Ti + 273.15)/1000)**3)/3
- 0.33*(((Tj + 273.15)/1000)**4 - ((Ti + 273.15)/1000)**4)/4)
+ x[5]*(0.37*(((Tj + 273.15)/1000) - ((Ti + 273.15)/1000))
+ 1.05*(((Tj + 273.15)/1000)**2 - ((Ti + 273.15)/1000)**2)/2
- 0.77*(((Tj + 273.15)/1000)**3 - ((Ti + 273.15)/1000)**3)/3
+ 0.21*(((Tj + 273.15)/1000)**4 - ((Ti + 273.15)/1000)**4)/4)))
f = np.zeros(26)
# x[24] = T_out_vent
f[0] = x[0] - cp_gas(T0, Tgas5)
f[1] = m_gas_teoria_conferindo*x[8] - x[9]*0.8 - x[7]
f[2] = x[10] + x[8] - (x[7] + x[9]*0.8)
f[3] = x[9] - x[8]*Z
f[4] = x[12] + x[13] + x[14] + x[15] + x[16] + x[17] - x[11]
f[5] = x[12] - M_CO2*x[8]/x[7]
f[6] = x[13] - M_H2O*x[8]/x[7]
f[7] = x[14] - M_N2*x[8]/x[7]
f[8] = x[15] - M_O2*x[8]/x[7]
f[9] = x[16] - M_SO2*x[8]/x[7]
f[10] = x[17] - (M_Cz*x[8] - 0.8*x[9])/x[7]
f[11] = x[18] - (e*a*((1-omega_ar) + 3.76*(1-omega_ar) + omega_ar)*(MM_ar_CBG)/(MM_CBG)*x[19])
f[12] = x[1] - ((m_gas5-x[7])*FM_g_CO2+x[7]*x[12])/(x[7]*x[11]+(m_gas5-x[7])*FM_g)
f[13] = x[2] - ((m_gas5-x[7])*FM_g_H2O+x[7]*x[13])/(x[7]*x[11]+(m_gas5-x[7])*FM_g)
f[14] = x[3] - ((m_gas5-x[7])*FM_g_N2+x[7]*x[14])/(x[7]*x[11]+(m_gas5-x[7])*FM_g)
f[15] = x[4] - ((m_gas5-x[7])*FM_g_O2+x[7]*x[15])/(x[7]*x[11]+(m_gas5-x[7])*FM_g)
f[16] = x[5] - (x[7]*x[16])/(x[7]*x[11]+(m_gas5-x[7])*FM_g)
f[17] = x[6] - (x[7]*x[17])/(x[7]*x[11]+(m_gas5-x[7])*FM_g)
f[18] = x[20] - x[21]/rho_ar_in
f[19] = (1/3600)*x[21] - (x[10]+x[18])
f[20] = ((x[10]+x[18])*h_in_vent + x[22]) - (x[10] + x[18])*x[23]
f[21] = x[23] - HAPropsSI('H', 'T', x[24] + 273.15, 'P', P_out_vent*1e3, 'W', omega_ar)/1e3
f[22] = x[22] - (0.000012523*x[20] + 0.054570445)
f[23] = x[25] - HAPropsSI('C', 'T', x[24] + 273.15, 'P', P_out_vent*1e3, 'W', omega_ar)/1e3
f[24] = m_gas5 - (x[7]+x[19]+x[18])
f[25] = eta_total - ((m_gas5*x[0]*(Tgas5-T0) - (x[10]+x[18])*x[25]*(x[24]-T0))
/(x[8]*PCI_RSU + x[19]*PCI_CBG))
return f
x = fsolve(block1, np.ones(26))
The code yields ValueError depending on constant values that are previously defined.
ValueError example:
ValueError: The output for key (8) with value (-nan) is outside the range of validity: (0) to (0.94145) :: inputs were:"H","T",1.3025950731911414e+02,"P",2.0132500000000000e+05,"W",1.0890000000000000e-02
If anyone can help me I will be grateful.
Thank in advance
The function you are running doesn't handle NaN values.
You can use try/except blocks to deal with it.
Or change the NaN values to a 0 (or any suitable number of your choice).
Here is a toy example to help you fix your code. You have to decide what should be the correct behavior and use one of the proposed strategies to deal with NaNs.
import bumpy as np
def f(x):
if np.isnan(x):
raise ValueError('NaN is not supported')
return x**x
test_cases = [1, 2, 3, 4, np.nan, 6, 7]
print('skip in case of error')
for x in test_cases:
try:
print(f(x))
except ValueError:
pass
print()
print('fix X in case of NaN')
for x in test_cases:
if np.isnan(x):
x = 0
print(f(x))
Output:
skip in case of error
1
4
27
256
46656
823543
fix X in case of NaN
1
4
27
256
1
46656
823543
I am trying to set constraints to perform optimization with the help of mystic package.
I executed the code in Spyder and PyCharm IDE. In both cases kernel crashed.
When I have only 2 line string 'simplify'-method works fine. Trying to set greater than 2 lines constraints leads to kernel's death.
import mystic.symbolic as ms
equation = """
x0*7.2 + x1*1.9 + x2*35.7 + x3*4.1 + x4*23.0 + x5*19.2 + x6*0.0 + x7*0.0 + x8*0.0 + x9*0.0 + x10*10.1 + x11*10.8 + x12*11.3 + x13*14.8 + x14*78.6 + x15*5.8 + x16*3.4 + x17*1.8 + x18*3.4 + x19*1.0 + x20*2.9 + x21*0.0 + x22*0.0 + x23*0.0 + x24*0.0 + x25*0.0 + x26*0.0 + x27*0.0 + x28*0.0 + x29*0.0 >= 27.0
x0*7.2 + x1*1.9 + x2*35.9 + x3*4.1 + x4*23.0 + x5*19.2 + x6*0.0 + x7*0.0 + x8*0.0 + x9*0.0 + x10*9.8 + x11*10.9 + x12*27.1 + x13*15.0 + x14*78.7 + x15*5.8 + x16*3.4 + x17*1.8 + x18*3.4 + x19*1.0 + x20*2.9 + x21*0.0 + x22*0.0 + x23*0.0 + x24*0.0 + x25*0.0 + x26*0.0 + x27*0.0 + x28*0.0 + x29*0.0 >= 29.0
x0*7.2 + x1*1.9 + x2*35.9 + x3*4.1 + x4*23.0 + x5*19.2 + x6*0.0 + x7*0.0 + x8*0.0 + x9*0.0 + x10*9.8 + x11*10.9 + x12*27.1 + x13*15.0 + x14*78.7 + x15*5.8 + x16*3.4 + x17*1.8 + x18*3.4 + x19*1.0 + x20*2.9 + x21*0.0 + x22*0.0 + x23*0.0 + x24*0.0 + x25*0.0 + x26*0.0 + x27*0.0 + x28*0.0 + x29*0.0 >= 29.0
x0*0.0 + x1*0.0 + x2*0.0 + x3*0.0 + x4*0.0 + x5*0.0 + x6*27.9 + x7*73.0 + x8*230.9 + x9*107.3 + x10*0.0 + x11*0.0 + x12*0.0 + x13*0.0 + x14*0.0 + x15*0.0 + x16*0.0 + x17*0.0 + x18*0.0 + x19*0.0 + x20*0.0 + x21*13.7 + x22*63.7 + x23*29.5 + x24*7.2 + x25*24.3 + x26*9.6 + x27*142.1 + x28*10.5 + x29*41.0 >= 420.0
x0*0.0 + x1*0.0 + x2*0.0 + x3*0.0 + x4*0.0 + x5*0.0 + x6*27.2 + x7*72.9 + x8*88.5 + x9*107.3 + x10*0.0 + x11*0.0 + x12*0.0 + x13*0.0 + x14*0.0 + x15*0.0 + x16*0.0 + x17*0.0 + x18*0.0 + x19*0.0 + x20*0.0 + x21*13.7 + x22*63.7 + x23*29.5 + x24*7.2 + x25*23.6 + x26*9.6 + x27*142.1 + x28*10.3 + x29*37.0 >= 420.0
"""
eqn = ms.simplify(equation)
You are probably just hitting your memory limit, or something like that. I'd suggest to turn off iterating through all solutions, and turn on cycling the variable solved for.
>>> import mystic.symbolic as ms
>>> equation = """
... x0*7.2 + x1*1.9 + x2*35.7 + x3*4.1 + x4*23.0 + x5*19.2 + x6*0.0 + x7*0.0 + x8*0.0 + x9*0.0 + x10*10.1 + x11*10.8 + x12*11.3 + x13*14.8 + x14*78.6 + x15*5.8 + x16*3.4 + x17*1.8 + x18*3.4 + x19*1.0 + x20*2.9 + x21*0.0 + x22*0.0 + x23*0.0 + x24*0.0 + x25*0.0 + x26*0.0 + x27*0.0 + x28*0.0 + x29*0.0 >= 27.0
... x0*7.2 + x1*1.9 + x2*35.9 + x3*4.1 + x4*23.0 + x5*19.2 + x6*0.0 + x7*0.0 + x8*0.0 + x9*0.0 + x10*9.8 + x11*10.9 + x12*27.1 + x13*15.0 + x14*78.7 + x15*5.8 + x16*3.4 + x17*1.8 + x18*3.4 + x19*1.0 + x20*2.9 + x21*0.0 + x22*0.0 + x23*0.0 + x24*0.0 + x25*0.0 + x26*0.0 + x27*0.0 + x28*0.0 + x29*0.0 >= 29.0
... x0*7.2 + x1*1.9 + x2*35.9 + x3*4.1 + x4*23.0 + x5*19.2 + x6*0.0 + x7*0.0 + x8*0.0 + x9*0.0 + x10*9.8 + x11*10.9 + x12*27.1 + x13*15.0 + x14*78.7 + x15*5.8 + x16*3.4 + x17*1.8 + x18*3.4 + x19*1.0 + x20*2.9 + x21*0.0 + x22*0.0 + x23*0.0 + x24*0.0 + x25*0.0 + x26*0.0 + x27*0.0 + x28*0.0 + x29*0.0 >= 29.0
... x0*0.0 + x1*0.0 + x2*0.0 + x3*0.0 + x4*0.0 + x5*0.0 + x6*27.9 + x7*73.0 + x8*230.9 + x9*107.3 + x10*0.0 + x11*0.0 + x12*0.0 + x13*0.0 + x14*0.0 + x15*0.0 + x16*0.0 + x17*0.0 + x18*0.0 + x19*0.0 + x20*0.0 + x21*13.7 + x22*63.7 + x23*29.5 + x24*7.2 + x25*24.3 + x26*9.6 + x27*142.1 + x28*10.5 + x29*41.0 >= 420.0
... x0*0.0 + x1*0.0 + x2*0.0 + x3*0.0 + x4*0.0 + x5*0.0 + x6*27.2 + x7*72.9 + x8*88.5 + x9*107.3 + x10*0.0 + x11*0.0 + x12*0.0 + x13*0.0 + x14*0.0 + x15*0.0 + x16*0.0 + x17*0.0 + x18*0.0 + x19*0.0 + x20*0.0 + x21*13.7 + x22*63.7 + x23*29.5 + x24*7.2 + x25*23.6 + x26*9.6 + x27*142.1 + x28*10.3 + x29*37.0 >= 420.0
... """
>>> eqns = ms.simplify(equation, all=False, cycle=True)
>>> print(eqns)
x4 >= -0.31304347826087*x0 - 0.0826086956521739*x1 - 0.426086956521739*x10 - 0.473913043478261*x11 - 1.17826086956522*x12 - 0.652173913043478*x13 - 3.42173913043478*x14 - 0.252173913043478*x15 - 0.147826086956522*x16 - 0.0782608695652174*x17 - 0.147826086956522*x18 - 0.0434782608695652*x19 - 1.56086956521739*x2 - 0.126086956521739*x20 - 0.178260869565217*x3 - 0.834782608695652*x5 + 1.26086956521739
x7 >= -0.187928669410151*x21 - 0.873799725651577*x22 - 0.404663923182442*x23 - 0.0987654320987654*x24 - 0.323731138545953*x25 - 0.131687242798354*x26 - 1.94924554183813*x27 - 0.141289437585734*x28 - 0.507544581618656*x29 - 0.373113854595336*x6 - 1.21399176954733*x8 - 1.4718792866941*x9 + 5.76131687242798
x0 >= -0.263888888888889*x1 - 1.40277777777778*x10 - 1.5*x11 - 1.56944444444444*x12 - 2.05555555555556*x13 - 10.9166666666667*x14 - 0.805555555555556*x15 - 0.472222222222222*x16 - 0.25*x17 - 0.472222222222222*x18 - 0.138888888888889*x19 - 4.95833333333333*x2 - 0.402777777777778*x20 - 0.569444444444444*x3 - 3.19444444444444*x4 - 2.66666666666667*x5 + 3.75
x6 >= -0.491039426523298*x21 - 2.2831541218638*x22 - 1.0573476702509*x23 - 0.258064516129032*x24 - 0.870967741935484*x25 - 0.344086021505376*x26 - 5.09318996415771*x27 - 0.376344086021505*x28 - 1.46953405017921*x29 - 2.61648745519713*x7 - 8.27598566308244*x8 - 3.84587813620072*x9 + 15.0537634408602
x3 >= -1.75609756097561*x0 - 0.463414634146341*x1 - 2.39024390243902*x10 - 2.65853658536585*x11 - 6.60975609756098*x12 - 3.65853658536585*x13 - 19.1951219512195*x14 - 1.41463414634146*x15 - 0.829268292682927*x16 - 0.439024390243902*x17 - 0.829268292682927*x18 - 0.24390243902439*x19 - 8.75609756097561*x2 - 0.707317073170732*x20 - 5.60975609756098*x4 - 4.68292682926829*x5 + 7.07317073170732
>>>
>>> constrain = ms.generate_constraint(ms.generate_solvers(eqns))
>>>
>>> constrain(list(range(-29,1)))
[-29, -28, -27, -26, 187.46956521739128, -24, 84.56076719225553, 85.54595336076824, -21, -20, -19, -18, -17, -16, -15, -14, -13, -12, -11, -10, -9, -8, -7, -6, -5, -4, -3, -2, -1, 0]
>>>
You may also want to look at and and or, which when used with the join keyword in generate_constraint, can be useful for modifying how the individual constraints work together. Also, if you have specific parameters you'd prefer are solved for, you can give them with the target keyword.
Anyway, the above should generate a constraint, useful within mystic's optimizers.
Objective
I am trying to symbolically solve an integral that has constant coefficients (a_w, b_IN_w, c_IN_w), which are composed of simple algebraic expressions.
What I Tried
I have tried running the code given below for an entire day, but it was still running when I checked it after a day. I have used Sympy before and I understand it may not be able to solve some complex operations, where it throws some kind of message or error indicating the problem. However, in the case described below, the program is busy running even after a day, which seems unreasonable for this problem with simple expressions. Is it possible to get the solution for the below-given expression (for q_IN_w)?
I updated Sympy to its most recent version using conda before I ran this problem.
import sympy as sym
def deg_to_rad(theta_deg):
from numpy import pi
theta_rad = (pi/180)*theta_deg
return theta_rad
r, a_w, a_o, a_g, b_IN_w, b_IN_o, b_IN_g, c_IN_2w, c_IN_2o, c_IN_2g, r_1, r_2, R, \
sigma_dia, IFT_ow, theta_IN_CA_deg, D_IN_ads_coeff, nablaP, mu_w, deltaP = \
sym.symbols('r, a_w, a_o, a_g, b_IN_w, b_IN_o, b_IN_g, c_IN_2w, c_IN_2o, c_IN_2g, r_1, r_2, R, \
sigma_dia, IFT_ow, theta_IN_CA_deg, D_IN_ads_coeff, nablaP, mu_w, deltaP')
l_IN_slip = sigma_dia/((sym.pi - deg_to_rad(theta_IN_CA_deg))**4)
W_IN_egy = IFT_ow*(1 + sym.cos(deg_to_rad(theta_IN_CA_deg)))
u_IN_s = (l_IN_slip*R*nablaP)/(2*mu_w)
u_IN_ads = (D_IN_ads_coeff/W_IN_egy)*deltaP
u_IN_s_eff = (u_IN_s - u_IN_ads)
b_IN_g = 0
b_IN_o = 2*(a_g - a_o)*(r_1**2)
b_IN_w = b_IN_o + 2*(a_o - a_w)*(r_2**2)
c_IN_2w = u_IN_s_eff - a_w*(R**2) - b_IN_w*sym.log(R)
q_IN_w = sym.integrate((a_w*(r**2) + b_IN_w*(sym.log(r)) + c_IN_2w)*(2*sym.pi*r), (r, r_2, R))
Here it finished in 30s, but it's quite the answer with the sym.pi
pi*R**4*a_w/2 - R**2*(pi**4*D_IN_ads_coeff*deltaP*mu_w*theta_IN_CA_deg**4 - 720*pi**4*D_IN_ads_coeff*deltaP*mu_w*theta_IN_CA_deg**3 + 194400*pi**4*D_IN_ads_coeff*deltaP*mu_w*theta_IN_CA_deg**2 - 23328000*pi**4*D_IN_ads_coeff*deltaP*mu_w*theta_IN_CA_deg + 1049760000*pi**4*D_IN_ads_coeff*deltaP*mu_w + pi**4*IFT_ow*R**2*a_w*mu_w*theta_IN_CA_deg**4*cos(pi*theta_IN_CA_deg/180) + pi**4*IFT_ow*R**2*a_w*mu_w*theta_IN_CA_deg**4 - 720*pi**4*IFT_ow*R**2*a_w*mu_w*theta_IN_CA_deg**3*cos(pi*theta_IN_CA_deg/180) - 720*pi**4*IFT_ow*R**2*a_w*mu_w*theta_IN_CA_deg**3 + 194400*pi**4*IFT_ow*R**2*a_w*mu_w*theta_IN_CA_deg**2*cos(pi*theta_IN_CA_deg/180) + 194400*pi**4*IFT_ow*R**2*a_w*mu_w*theta_IN_CA_deg**2 - 23328000*pi**4*IFT_ow*R**2*a_w*mu_w*theta_IN_CA_deg*cos(pi*theta_IN_CA_deg/180) - 23328000*pi**4*IFT_ow*R**2*a_w*mu_w*theta_IN_CA_deg + 1049760000*pi**4*IFT_ow*R**2*a_w*mu_w*cos(pi*theta_IN_CA_deg/180) + 1049760000*pi**4*IFT_ow*R**2*a_w*mu_w - 524880000*IFT_ow*R*nablaP*sigma_dia*cos(pi*theta_IN_CA_deg/180) - 524880000*IFT_ow*R*nablaP*sigma_dia + 2*pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg**4*log(R)*cos(pi*theta_IN_CA_deg/180) + 2*pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg**4*log(R) + pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg**4*cos(pi*theta_IN_CA_deg/180) + pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg**4 - 1440*pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg**3*log(R)*cos(pi*theta_IN_CA_deg/180) - 1440*pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg**3*log(R) - 720*pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg**3*cos(pi*theta_IN_CA_deg/180) - 720*pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg**3 + 388800*pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg**2*log(R)*cos(pi*theta_IN_CA_deg/180) + 388800*pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg**2*log(R) + 194400*pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg**2*cos(pi*theta_IN_CA_deg/180) + 194400*pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg**2 - 46656000*pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg*log(R)*cos(pi*theta_IN_CA_deg/180) - 46656000*pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg*log(R) - 23328000*pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg*cos(pi*theta_IN_CA_deg/180) - 23328000*pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg + 2099520000*pi**4*IFT_ow*a_g*mu_w*r_1**2*log(R)*cos(pi*theta_IN_CA_deg/180) + 2099520000*pi**4*IFT_ow*a_g*mu_w*r_1**2*log(R) + 1049760000*pi**4*IFT_ow*a_g*mu_w*r_1**2*cos(pi*theta_IN_CA_deg/180) + 1049760000*pi**4*IFT_ow*a_g*mu_w*r_1**2 - 2*pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg**4*log(R)*cos(pi*theta_IN_CA_deg/180) - 2*pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg**4*log(R) - pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg**4*cos(pi*theta_IN_CA_deg/180) - pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg**4 + 1440*pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg**3*log(R)*cos(pi*theta_IN_CA_deg/180) + 1440*pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg**3*log(R) + 720*pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg**3*cos(pi*theta_IN_CA_deg/180) + 720*pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg**3 - 388800*pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg**2*log(R)*cos(pi*theta_IN_CA_deg/180) - 388800*pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg**2*log(R) - 194400*pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg**2*cos(pi*theta_IN_CA_deg/180) - 194400*pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg**2 + 46656000*pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg*log(R)*cos(pi*theta_IN_CA_deg/180) + 46656000*pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg*log(R) + 23328000*pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg*cos(pi*theta_IN_CA_deg/180) + 23328000*pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg - 2099520000*pi**4*IFT_ow*a_o*mu_w*r_1**2*log(R)*cos(pi*theta_IN_CA_deg/180) - 2099520000*pi**4*IFT_ow*a_o*mu_w*r_1**2*log(R) - 1049760000*pi**4*IFT_ow*a_o*mu_w*r_1**2*cos(pi*theta_IN_CA_deg/180) - 1049760000*pi**4*IFT_ow*a_o*mu_w*r_1**2 + 2*pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg**4*log(R)*cos(pi*theta_IN_CA_deg/180) + 2*pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg**4*log(R) + pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg**4*cos(pi*theta_IN_CA_deg/180) + pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg**4 - 1440*pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg**3*log(R)*cos(pi*theta_IN_CA_deg/180) - 1440*pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg**3*log(R) - 720*pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg**3*cos(pi*theta_IN_CA_deg/180) - 720*pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg**3 + 388800*pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg**2*log(R)*cos(pi*theta_IN_CA_deg/180) + 388800*pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg**2*log(R) + 194400*pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg**2*cos(pi*theta_IN_CA_deg/180) + 194400*pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg**2 - 46656000*pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg*log(R)*cos(pi*theta_IN_CA_deg/180) - 46656000*pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg*log(R) - 23328000*pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg*cos(pi*theta_IN_CA_deg/180) - 23328000*pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg + 2099520000*pi**4*IFT_ow*a_o*mu_w*r_2**2*log(R)*cos(pi*theta_IN_CA_deg/180) + 2099520000*pi**4*IFT_ow*a_o*mu_w*r_2**2*log(R) + 1049760000*pi**4*IFT_ow*a_o*mu_w*r_2**2*cos(pi*theta_IN_CA_deg/180) + 1049760000*pi**4*IFT_ow*a_o*mu_w*r_2**2 - 2*pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg**4*log(R)*cos(pi*theta_IN_CA_deg/180) - 2*pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg**4*log(R) - pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg**4*cos(pi*theta_IN_CA_deg/180) - pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg**4 + 1440*pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg**3*log(R)*cos(pi*theta_IN_CA_deg/180) + 1440*pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg**3*log(R) + 720*pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg**3*cos(pi*theta_IN_CA_deg/180) + 720*pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg**3 - 388800*pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg**2*log(R)*cos(pi*theta_IN_CA_deg/180) - 388800*pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg**2*log(R) - 194400*pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg**2*cos(pi*theta_IN_CA_deg/180) - 194400*pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg**2 + 46656000*pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg*log(R)*cos(pi*theta_IN_CA_deg/180) + 46656000*pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg*log(R) + 23328000*pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg*cos(pi*theta_IN_CA_deg/180) + 23328000*pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg - 2099520000*pi**4*IFT_ow*a_w*mu_w*r_2**2*log(R)*cos(pi*theta_IN_CA_deg/180) - 2099520000*pi**4*IFT_ow*a_w*mu_w*r_2**2*log(R) - 1049760000*pi**4*IFT_ow*a_w*mu_w*r_2**2*cos(pi*theta_IN_CA_deg/180) - 1049760000*pi**4*IFT_ow*a_w*mu_w*r_2**2)/(pi**3*IFT_ow*mu_w*theta_IN_CA_deg**4*cos(pi*theta_IN_CA_deg/180) + pi**3*IFT_ow*mu_w*theta_IN_CA_deg**4 - 720*pi**3*IFT_ow*mu_w*theta_IN_CA_deg**3*cos(pi*theta_IN_CA_deg/180) - 720*pi**3*IFT_ow*mu_w*theta_IN_CA_deg**3 + 194400*pi**3*IFT_ow*mu_w*theta_IN_CA_deg**2*cos(pi*theta_IN_CA_deg/180) + 194400*pi**3*IFT_ow*mu_w*theta_IN_CA_deg**2 - 23328000*pi**3*IFT_ow*mu_w*theta_IN_CA_deg*cos(pi*theta_IN_CA_deg/180) - 23328000*pi**3*IFT_ow*mu_w*theta_IN_CA_deg + 1049760000*pi**3*IFT_ow*mu_w*cos(pi*theta_IN_CA_deg/180) + 1049760000*pi**3*IFT_ow*mu_w) - pi*a_w*r_2**4/2 + r_2**2*(pi**4*D_IN_ads_coeff*deltaP*mu_w*theta_IN_CA_deg**4 - 720*pi**4*D_IN_ads_coeff*deltaP*mu_w*theta_IN_CA_deg**3 + 194400*pi**4*D_IN_ads_coeff*deltaP*mu_w*theta_IN_CA_deg**2 - 23328000*pi**4*D_IN_ads_coeff*deltaP*mu_w*theta_IN_CA_deg + 1049760000*pi**4*D_IN_ads_coeff*deltaP*mu_w + pi**4*IFT_ow*R**2*a_w*mu_w*theta_IN_CA_deg**4*cos(pi*theta_IN_CA_deg/180) + pi**4*IFT_ow*R**2*a_w*mu_w*theta_IN_CA_deg**4 - 720*pi**4*IFT_ow*R**2*a_w*mu_w*theta_IN_CA_deg**3*cos(pi*theta_IN_CA_deg/180) - 720*pi**4*IFT_ow*R**2*a_w*mu_w*theta_IN_CA_deg**3 + 194400*pi**4*IFT_ow*R**2*a_w*mu_w*theta_IN_CA_deg**2*cos(pi*theta_IN_CA_deg/180) + 194400*pi**4*IFT_ow*R**2*a_w*mu_w*theta_IN_CA_deg**2 - 23328000*pi**4*IFT_ow*R**2*a_w*mu_w*theta_IN_CA_deg*cos(pi*theta_IN_CA_deg/180) - 23328000*pi**4*IFT_ow*R**2*a_w*mu_w*theta_IN_CA_deg + 1049760000*pi**4*IFT_ow*R**2*a_w*mu_w*cos(pi*theta_IN_CA_deg/180) + 1049760000*pi**4*IFT_ow*R**2*a_w*mu_w - 524880000*IFT_ow*R*nablaP*sigma_dia*cos(pi*theta_IN_CA_deg/180) - 524880000*IFT_ow*R*nablaP*sigma_dia + 2*pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg**4*log(R)*cos(pi*theta_IN_CA_deg/180) + 2*pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg**4*log(R) + pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg**4*cos(pi*theta_IN_CA_deg/180) + pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg**4 - 1440*pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg**3*log(R)*cos(pi*theta_IN_CA_deg/180) - 1440*pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg**3*log(R) - 720*pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg**3*cos(pi*theta_IN_CA_deg/180) - 720*pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg**3 + 388800*pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg**2*log(R)*cos(pi*theta_IN_CA_deg/180) + 388800*pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg**2*log(R) + 194400*pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg**2*cos(pi*theta_IN_CA_deg/180) + 194400*pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg**2 - 46656000*pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg*log(R)*cos(pi*theta_IN_CA_deg/180) - 46656000*pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg*log(R) - 23328000*pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg*cos(pi*theta_IN_CA_deg/180) - 23328000*pi**4*IFT_ow*a_g*mu_w*r_1**2*theta_IN_CA_deg + 2099520000*pi**4*IFT_ow*a_g*mu_w*r_1**2*log(R)*cos(pi*theta_IN_CA_deg/180) + 2099520000*pi**4*IFT_ow*a_g*mu_w*r_1**2*log(R) + 1049760000*pi**4*IFT_ow*a_g*mu_w*r_1**2*cos(pi*theta_IN_CA_deg/180) + 1049760000*pi**4*IFT_ow*a_g*mu_w*r_1**2 - 2*pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg**4*log(R)*cos(pi*theta_IN_CA_deg/180) - 2*pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg**4*log(R) - pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg**4*cos(pi*theta_IN_CA_deg/180) - pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg**4 + 1440*pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg**3*log(R)*cos(pi*theta_IN_CA_deg/180) + 1440*pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg**3*log(R) + 720*pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg**3*cos(pi*theta_IN_CA_deg/180) + 720*pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg**3 - 388800*pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg**2*log(R)*cos(pi*theta_IN_CA_deg/180) - 388800*pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg**2*log(R) - 194400*pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg**2*cos(pi*theta_IN_CA_deg/180) - 194400*pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg**2 + 46656000*pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg*log(R)*cos(pi*theta_IN_CA_deg/180) + 46656000*pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg*log(R) + 23328000*pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg*cos(pi*theta_IN_CA_deg/180) + 23328000*pi**4*IFT_ow*a_o*mu_w*r_1**2*theta_IN_CA_deg - 2099520000*pi**4*IFT_ow*a_o*mu_w*r_1**2*log(R)*cos(pi*theta_IN_CA_deg/180) - 2099520000*pi**4*IFT_ow*a_o*mu_w*r_1**2*log(R) - 1049760000*pi**4*IFT_ow*a_o*mu_w*r_1**2*cos(pi*theta_IN_CA_deg/180) - 1049760000*pi**4*IFT_ow*a_o*mu_w*r_1**2 + 2*pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg**4*log(R)*cos(pi*theta_IN_CA_deg/180) + 2*pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg**4*log(R) + pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg**4*cos(pi*theta_IN_CA_deg/180) + pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg**4 - 1440*pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg**3*log(R)*cos(pi*theta_IN_CA_deg/180) - 1440*pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg**3*log(R) - 720*pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg**3*cos(pi*theta_IN_CA_deg/180) - 720*pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg**3 + 388800*pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg**2*log(R)*cos(pi*theta_IN_CA_deg/180) + 388800*pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg**2*log(R) + 194400*pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg**2*cos(pi*theta_IN_CA_deg/180) + 194400*pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg**2 - 46656000*pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg*log(R)*cos(pi*theta_IN_CA_deg/180) - 46656000*pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg*log(R) - 23328000*pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg*cos(pi*theta_IN_CA_deg/180) - 23328000*pi**4*IFT_ow*a_o*mu_w*r_2**2*theta_IN_CA_deg + 2099520000*pi**4*IFT_ow*a_o*mu_w*r_2**2*log(R)*cos(pi*theta_IN_CA_deg/180) + 2099520000*pi**4*IFT_ow*a_o*mu_w*r_2**2*log(R) + 1049760000*pi**4*IFT_ow*a_o*mu_w*r_2**2*cos(pi*theta_IN_CA_deg/180) + 1049760000*pi**4*IFT_ow*a_o*mu_w*r_2**2 - 2*pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg**4*log(R)*cos(pi*theta_IN_CA_deg/180) - 2*pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg**4*log(R) - pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg**4*cos(pi*theta_IN_CA_deg/180) - pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg**4 + 1440*pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg**3*log(R)*cos(pi*theta_IN_CA_deg/180) + 1440*pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg**3*log(R) + 720*pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg**3*cos(pi*theta_IN_CA_deg/180) + 720*pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg**3 - 388800*pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg**2*log(R)*cos(pi*theta_IN_CA_deg/180) - 388800*pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg**2*log(R) - 194400*pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg**2*cos(pi*theta_IN_CA_deg/180) - 194400*pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg**2 + 46656000*pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg*log(R)*cos(pi*theta_IN_CA_deg/180) + 46656000*pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg*log(R) + 23328000*pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg*cos(pi*theta_IN_CA_deg/180) + 23328000*pi**4*IFT_ow*a_w*mu_w*r_2**2*theta_IN_CA_deg - 2099520000*pi**4*IFT_ow*a_w*mu_w*r_2**2*log(R)*cos(pi*theta_IN_CA_deg/180) - 2099520000*pi**4*IFT_ow*a_w*mu_w*r_2**2*log(R) - 1049760000*pi**4*IFT_ow*a_w*mu_w*r_2**2*cos(pi*theta_IN_CA_deg/180) - 1049760000*pi**4*IFT_ow*a_w*mu_w*r_2**2)/(pi**3*IFT_ow*mu_w*theta_IN_CA_deg**4*cos(pi*theta_IN_CA_deg/180) + pi**3*IFT_ow*mu_w*theta_IN_CA_deg**4 - 720*pi**3*IFT_ow*mu_w*theta_IN_CA_deg**3*cos(pi*theta_IN_CA_deg/180) - 720*pi**3*IFT_ow*mu_w*theta_IN_CA_deg**3 + 194400*pi**3*IFT_ow*mu_w*theta_IN_CA_deg**2*cos(pi*theta_IN_CA_deg/180) + 194400*pi**3*IFT_ow*mu_w*theta_IN_CA_deg**2 - 23328000*pi**3*IFT_ow*mu_w*theta_IN_CA_deg*cos(pi*theta_IN_CA_deg/180) - 23328000*pi**3*IFT_ow*mu_w*theta_IN_CA_deg + 1049760000*pi**3*IFT_ow*mu_w*cos(pi*theta_IN_CA_deg/180) + 1049760000*pi**3*IFT_ow*mu_w) + (2*pi*R**2*a_g*r_1**2 - 2*pi*R**2*a_o*r_1**2 + 2*pi*R**2*a_o*r_2**2 - 2*pi*R**2*a_w*r_2**2)*log(R) - (2*pi*a_g*r_1**2*r_2**2 - 2*pi*a_o*r_1**2*r_2**2 + 2*pi*a_o*r_2**4 - 2*pi*a_w*r_2**4)*log(r_2)
Closed. This question is not reproducible or was caused by typos. It is not currently accepting answers.
This question was caused by a typo or a problem that can no longer be reproduced. While similar questions may be on-topic here, this one was resolved in a way less likely to help future readers.
Closed 7 years ago.
Improve this question
what error with this code:
data = ['K:C:192.168.1.3:myusername:mypassword', 'M:N:192.168.3.2:root:toor']
for i in data:
r = str(i).strip(":")
if len(r) == 4:
print r[0] + " ||" + ((28 - len(r[1])) / 2) * " " + r[1] + ((28 - len(r[1]) / 2) * " " + "||" + ((22 - len(r[2])) / 2) * " " + r[2] + ((22 - len(r[2])) / 2) * ' ' + "||" + ((22 - len(r[3])) / 2) * " " + r[3] + ((22 - len(r[3])) / 2) * " "
elif len(r) == 3:
print r[0] + " ||" + ((28 - len(r[1])) / 2) * " " + r[1] + ((28 - len(r[1]) / 2) * " " + "||" + ((22 - len(r[2])) / 2) * " " + r[2] + ((22 - len(r[2])) / 2) * ' ' + "||"
a got an error like this:
elif len(r) == 3:
^
SyntaxError: invalid syntax
can anyone help me ?
It's just a simple case of mismatched parentheses on the preceding line (and also on the following line). Try this:
data = ['K:C:192.168.1.3:myusername:mypassword', 'M:N:192.168.3.2:root:toor']
for i in data:
r = str(i).strip(":")
if len(r) == 4:
print r[0] + " ||" + ((28 - len(r[1])) / 2) * " " + r[1] + ((28 - len(r[1])) / 2) * " " + "||" + ((22 - len(r[2])) / 2) * " " + r[2] + ((22 - len(r[2])) / 2) * ' ' + "||" + ((22 - len(r[3])) / 2) * " " + r[3] + ((22 - len(r[3])) / 2) * " "
elif len(r) == 3:
print r[0] + " ||" + ((28 - len(r[1])) / 2) * " " + r[1] + ((28 - len(r[1])) / 2) * " " + "||" + ((22 - len(r[2])) / 2) * " " + r[2] + ((22 - len(r[2])) / 2) * ' ' + "||"