Feb-21-2022, 01:34 PM
Hi there! The following block of code works, but the results are presented as the list of formulas. Before I have included lines 18-22 (lines relate to equation equl to zero I have to include), the calculation took around 20-30 minutes and the result was just nice - all the possible variations of variables values clearly presented. After I added lines mentioned, I see that the line 21 is performed for hours and the result looks as the variables of the equation remain symbols and the calculation cannot be performed. I get not variables with numeric values, but a list with formulas. So I see that the iteration through values for these variables (which received a symbolic type) is not going. How can I solve this problem? Help me please
About my purpose: For each of the variables with underlining, I have set a range of possible values, within which the values are sorted with a set step. In this block of code, I am trying to take into account the equations where are unknown variables in order to reduce the number of possible values. I use nested functions. After the last function, the final combinations of values (concrete numbers) for variables should be output.
About my purpose: For each of the variables with underlining, I have set a range of possible values, within which the values are sorted with a set step. In this block of code, I am trying to take into account the equations where are unknown variables in order to reduce the number of possible values. I use nested functions. After the last function, the final combinations of values (concrete numbers) for variables should be output.
step = -0.01 for y30_ in np.arange(y30[0], y30[1], step): y00_ = function_vr(ph0b, et0, y30_) y10_ = function_vn(ph0b, et0, y30_) y20_ = function_o(ph0, et0, y30_) #print(f"y00_ = {y00_}, y10_ = {y10_}, y20_ = {y20_}, y30_ = {y30_}") for y50_ in np.arange(y50[0], y50[1], step): #print(y50_) for y60_ in np.arange(y60[1], y60[0], step): tn0_ = funct_tn(y50_, y60_) #print(y60_) for y70_ in np.arange(y70[1], y70[0], step): y80_ = funct_labt(y30_, y60_, y70_, y50_) function_gam(et0, y30_, ph0b, y50_, y60_, y70_, y80_) 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)) #Use sympy.subs() method ham0 = solve(equation.subs(ht0, 0)) print(ham0) #do I need this line? for y90_ in np.arange(y90[1], y90[0], step): function_propulsion(y40, y50_, y60_, y90_, ptb, mqb) function_deo(y40, y50_, y60_, y90_, ptb, mqb, pes) print(f"y00_ = {y00_}, y10_ = {y10_}, y20_ = {y20_}, y30_ = {y30_}, y50_ = {y50_}, y60_ = {y60_}, y70_ = {y70_}, y80_ = {y80_}, y90_ = {y90_}")