I'm trying to get sympy to pprint matrices with trig functions with the first letter instead of the shortened term in order to save space. So sin(a_1) will look like sa_1. Right now I'm printing to text then running a find and replace. (I'm new to programming.) So far, this is what does not work:
from sympy import sin as s
from sympy import cos as c
# declaring symbolic variables:
sin, cos, = sym.symbols('s, c')
#An example Matrix
T = Matrix([[c(theta), -s(theta), 0, a],
[s(theta) * c(alpha), c(theta) * c(alpha), -s(alpha), -s(alpha) * d],
[s(theta) * s(alpha), c(theta) * s(alpha), c(alpha), c(alpha) * d],
[0, 0, 0, 1]])
#T04 was a sympy symbol matrix solution
T_000 = str(print_latex(T04))
T_000 = str(T04)
T_000 = T_000.replace('sin', 's')
T_000 = T_000.replace('cos', 'c')
print('T000\n')
pprint(T_000)
T_001 = Matrix([[(-s(theta_1) * s(theta_2) + c(theta_1) * c(theta_2)) * c(theta_3) + (
-s(theta_1) * c(theta_2) - s(theta_2) * c(theta_1)) * s(theta_3),
-(-s(theta_1) * s(theta_2) + c(theta_1) * c(theta_2)) * s(theta_3) + (
-s(theta_1) * c(theta_2) - s(theta_2) * c(theta_1)) * c(theta_3), 0,
L_1 * c(theta_1) + L_2 * (-s(theta_1) * s(theta_2) + c(theta_1) * c(theta_2))], [
(-s(theta_1) * s(theta_2) + c(theta_1) * c(theta_2)) * s(theta_3) + (
s(theta_1) * c(theta_2) + s(theta_2) * c(theta_1)) * c(theta_3),
(-s(theta_1) * s(theta_2) + c(theta_1) * c(theta_2)) * c(theta_3) - (
s(theta_1) * c(theta_2) + s(theta_2) * c(theta_1)) * s(theta_3), 0,
L_1 * s(theta_1) + L_2 * (s(theta_1) * c(theta_2)
+ s(theta_2) * c(theta_1))], [0, 0, 1, d_4], [0, 0, 0, 1]])
print('\nT001\n')
pprint(T_001)
T_000.replace(sin, s)
print('T000\n', T_000)
It's always printing with the full "sin" and "cos" names.