kangwonlee / momisp

Mechanics of Materials in SciPy
Other
3 stars 4 forks source link

symbols with units in text #21

Closed kangwonlee closed 6 years ago

kangwonlee commented 6 years ago
import sympy as sy
a, b, c =  sy.symbols('a[m] b[kg] c[N]', real=True)
kangwonlee commented 6 years ago

How to automate the process?

kangwonlee commented 6 years ago

Currently

import sympy as sy
a_m, b_kg, c_N =  sy.symbols('a_m, b_kg, c_N', real=True)
kangwonlee commented 6 years ago

Then utilize #10

kangwonlee commented 6 years ago
Before After
L_m, a_m, b_m = sy.symbols('L_m, a_m, b_m', positive=True) L_m, a_m, b_m = sy.symbols('L[m], a[m], b[m]', positive=True)
w0_N_m = sy.Symbol('w0_N_m') w0_N_m = sy.Symbol('w0[N/m]')
P_N = sy.Symbol('P_N') P_N = sy.Symbol('P[N]')
x_m = sy.Symbol('x_m', real=True, nonnegative=True) x_m = sy.Symbol('x[m]', real=True, nonnegative=True)
R_A_N, R_D_N = sy.symbols('R_A_N, R_D_N', real=True) R_A_N, R_D_N = sy.symbols('R_{A}[N], R_{D}[N]', real=True)
b_m, h_m, t_f_m, t_w_m, I_m4 = sy.symbols('b_m, h_m, t_f_m, t_w_m, I_m4', positive=True) b_m, h_m, t_f_m, t_w_m, I_m4 = sy.symbols('b[m], h[m], t_{f}[m], t_{w}[m], I[m^{4}]', positive=True)
kangwonlee commented 6 years ago

21aad573741abd3920fa4dab37fe90d1cf61c969 resolves the issue