A trick like Incorrect Values Creating Expression From Other Expressions - #2 by francesco-ballarin may be of help. Define two symbols x0 = sympy.var("x[0]")
and x1 = sympy.var("x[1]")
, use sympy
to compute theta
and r
starting from x0
and x1
, write your expression in theta
and r
, and finally convert them to a C++ code with sympy.printing.ccode
.