コールブルック方程式の近似をコーディングして摩擦係数を取得しようとしています。私はMatlabでこれを達成しましたが、pythonになると私のコードは機能しません。
import math
Re = 2300
eD=0.0009
1/math.sqrt(friction)=-2*math.log10((((eD/3.7)+(2.51/Re))*(1.14-2*math.log10(((eD/2)+(21.25/Re**0.9))))))
print(friction)
私もこれを試しました
import math
def friction(Re, eD):
eD= 0.0009
Re= 2300
f = -2*math.log10((((eD/3.7)+(2.51/Re))*(1.14-2*math.log10(((eD/2)+(21.25/Re**0.9))))))
return 1/math.sqrt(f)
しかし、これも機能しません。