Feb-21-2022, 07:09 AM
Hello!
When solving a system of equations, I need to take into account an additional equation equal to zero. To include this equation, I use sympy.subs() method, but I get a syntax error. I cannot understand what mistake I have made. Warmly requesting your support to correct the error.
PS: Underlining is used because it is required to iterate through several values for each variable.
When solving a system of equations, I need to take into account an additional equation equal to zero. To include this equation, I use sympy.subs() method, but I get a syntax error. I cannot understand what mistake I have made. Warmly requesting your support to correct the error.
PS: Underlining is used because it is required to iterate through several values for each variable.
1 2 3 4 5 6 7 |
from sympy import * from sympy import symbols ht0, et0, y30_, ph0b_, y50_, y60_, y70_, y80_ = symbols( 'ht0 et0 y30_ ph0b y50_ y60_ y70_ y80_' ) equation = Eq(ht0, (y50_ * et0_ * cos(y30_) / sqrt(ph0b) + y60_ * - et0 * sin(y30_) / sqrt(ph0b) + y70_ * sqrt( 1 / ph0b) * et0 * sin(y30_) + y80_ * (sqrt( 1 / ph0b) * ( 1 + et0 * cos(y30_)) * ( 1 + et0 * cos(y30_)) * * 2 ) / ph0b * * 2 ) ham0 = solve(equation.subs(ht0, 0 )) return ham0 |