将方程式转换为Python语言

时间:2020-07-14 10:10:48

标签: python

如何将这个等式转换为Python代码

enter image description here

1 个答案:

答案 0 :(得分:1)

You can need to learn about operator precedence and associativity in Programming Languages. That way you can strengthen your understanding of how to perform complex calculations in Python. 

Apart from that try to break the problem into smaller subproblems and combine the smaller subproblems to generate solution for the larger problem.

[0.38C(1-g/C)2] = (0.38 * C) * (1 - (g/C) * 2)  
[1-(g/C)(X)]    = (1 - (g/C) * X)  
173X2           = 173 * 2  
[(X-1)+[(X-1)2 + (16X/C)]1/2] = ((X-1)+((X-1)*2 + (16*X/C))* 1/2)


Now put all values in the equation:  
"d=[0.38C(1-g/C)2]/[1-(g/C)(X)]+173X2[(X-1)+[(X-1)2 + (16X/C)]1/2]"   


    d = (((0.38 * C)*(1 - (g/c)) * 2 ) / (1 - (g/C) * X)) + 172 * 2 *((X-1) +((X-1)+((X-1)*2 + (16*X/C))* 1/2)