News for hackers. Stuff that matters.
Re:SymPy: Symbolic Mathematics in Python by sampo on Wednesday February 28, 2024 @02:38PM (#39542577)
> I use sympy to (i) compute these big vectors, expressed in a very declarative way, (ii) compute the jacobian and (iii) export the results in C-code, immediately importable in my code case.

You could maybe calculate the Jacobian in C code using automatic differentiation. Might be less C-code, might be less elementary operations done in the C code, and you would not need to be copy-pasting complex symbolically derived formulas from Python to C.

https://en.wikipedia.org/wiki/Automatic_differentiation

Re:SymPy: Symbolic Mathematics in Python by whatshisface on Wednesday February 28, 2024 @02:53PM (#39542697)
I could be wrong, but I seriously doubt C macros can do this.
Re:SymPy: Symbolic Mathematics in Python by sampo on Wednesday February 28, 2024 @03:11PM (#39542888)
Why are you thinking of macros?
Re:SymPy: Symbolic Mathematics in Python by whatshisface on Wednesday February 28, 2024 @04:03PM (#39543383)
In an embedded environment you would want it to be pre-compiled and optimized.