2020-12-21 21:43:01 +08:00
|
|
|
"""
|
|
|
|
writen by shenjackyuanjie
|
|
|
|
mail: 3695888@qq.com
|
2020-12-23 23:19:16 +08:00
|
|
|
|
|
|
|
file name stand for : Physics calculation
|
2020-12-21 21:43:01 +08:00
|
|
|
"""
|
|
|
|
|
|
|
|
import libs
|
|
|
|
import math
|
|
|
|
|
2020-12-26 00:08:52 +08:00
|
|
|
from libs.tools import F_Mi, F_Mu, F_A, F_D
|
|
|
|
|
2020-12-21 21:43:01 +08:00
|
|
|
|
2020-12-23 23:19:16 +08:00
|
|
|
def S_C_float_check(SC): # stand for Scientific notation's float check
|
2020-12-21 21:43:01 +08:00
|
|
|
"""
|
|
|
|
formats:
|
2020-12-22 18:42:12 +08:00
|
|
|
SC list format:docs.basic_config.json:basic_number"""
|
|
|
|
while SC[0] >= 10:
|
2020-12-26 00:08:52 +08:00
|
|
|
SC[0] = F_D(SC[0], 10)
|
2020-12-22 18:42:12 +08:00
|
|
|
SC[1] += 1
|
|
|
|
while SC[0] < 1:
|
2020-12-26 00:08:52 +08:00
|
|
|
SC[0] = F_Mu(SC[0], 10)
|
2020-12-22 18:42:12 +08:00
|
|
|
SC[1] -= 1
|
|
|
|
|
|
|
|
|
2020-12-27 22:42:55 +08:00
|
|
|
def S_N_M(*SN): # stand for Scientific notation multiple
|
2020-12-27 21:10:38 +08:00
|
|
|
"""
|
|
|
|
formats:
|
|
|
|
A & B & C list format:docs.basic_config.json:basic_number"""
|
2020-12-27 22:42:55 +08:00
|
|
|
if len(SN) < 2:
|
|
|
|
raise TypeError("it need more than 2!")
|
|
|
|
elif len(SN) == 2:
|
|
|
|
return __S_N_M(SN[0], SN[1])
|
2020-12-27 21:10:38 +08:00
|
|
|
else:
|
2020-12-27 22:42:55 +08:00
|
|
|
R = __S_N_M(SN[0], SN[1])
|
|
|
|
for A in SN[2:]:
|
|
|
|
R = __S_N_M(R, A)
|
|
|
|
return R
|
2020-12-27 21:10:38 +08:00
|
|
|
|
|
|
|
|
|
|
|
def __S_N_M(A, B):
|
2020-12-21 21:43:01 +08:00
|
|
|
"""
|
2020-12-22 18:42:12 +08:00
|
|
|
formats:
|
|
|
|
A & B list format:docs.basic_config.json:basic_number"""
|
2020-12-27 22:42:55 +08:00
|
|
|
R = [F_Mu(A[0], B[0]), A[1] + B[1]]
|
2020-12-27 21:10:38 +08:00
|
|
|
S_C_float_check(R)
|
2020-12-22 17:58:38 +08:00
|
|
|
Unit1, Unit2 = A[2] + B[2], A[3] + B[3]
|
2020-12-21 22:48:43 +08:00
|
|
|
if Unit1 == None:
|
|
|
|
Unit1 = []
|
2020-12-22 18:13:59 +08:00
|
|
|
libs.tools.D_C(Unit1, Unit2)
|
2020-12-27 21:10:38 +08:00
|
|
|
R += [Unit1, Unit2]
|
|
|
|
return R
|
2020-12-21 21:48:52 +08:00
|
|
|
|
|
|
|
|
2020-12-23 23:19:16 +08:00
|
|
|
def S_N_D(A, B): # stand for Scientific notation divided
|
2020-12-21 21:48:52 +08:00
|
|
|
"""
|
|
|
|
formats:
|
2020-12-26 00:26:06 +08:00
|
|
|
A & B list format:docs.basic_config:basic_number"""
|
2020-12-27 22:42:55 +08:00
|
|
|
R = [F_D(A[0], B[0]), A[1] - B[1]]
|
2020-12-27 21:10:38 +08:00
|
|
|
S_C_float_check(R)
|
2020-12-22 17:58:38 +08:00
|
|
|
Unit1, Unit2 = A[2] + B[3], A[3] + B[2]
|
2020-12-21 22:48:43 +08:00
|
|
|
if Unit1 == None:
|
|
|
|
Unit1 = []
|
2020-12-22 18:13:59 +08:00
|
|
|
libs.tools.D_C(Unit1, Unit2)
|
2020-12-27 21:10:38 +08:00
|
|
|
R += [Unit1, Unit2]
|
|
|
|
return R
|
2020-12-26 00:26:06 +08:00
|
|
|
|
|
|
|
|
2021-01-01 11:29:27 +08:00
|
|
|
def G_C(M, m, R, G): # stand for gravity calculation
|
2020-12-27 21:10:38 +08:00
|
|
|
"""
|
|
|
|
formats:
|
|
|
|
M : ship's mass
|
|
|
|
m : planet's mass
|
|
|
|
R : distance to the planet
|
|
|
|
G : Gravitational constant
|
|
|
|
M & m & R format: docs.basic_config:basic_number
|
|
|
|
"""
|
2020-12-31 23:13:11 +08:00
|
|
|
g = libs.config.basic_number()
|
|
|
|
A = S_N_M(M, m, G)
|
|
|
|
B = S_N_D(A, S_N_M(R, R))
|
|
|
|
return B
|