Do you need mathematical expressions worked out so you can just paste them into a C program (or basically any other language)? Check out #sympy and its code generation capability.
Do you need to optimise the expressions? Look no further than cse or common subexpression eliminiation:
👉 https://bowfinger.de/blog/2024/03/using-sympys-common-subexpression-elimination-to-generate-code/