#!/usr/bin/env python
from sympy import *
print ccode(sympify('sqrt(x)'), user_functions={"sqrt": "std::sqrt"})
print ccode(sympify('Abs(x)'), user_functions={"fabs": "std::abs"})
print ccode(sympify('x**2'), user_functions={"pow": "std::pow"})
sqrt(x)
fabs(x)
pow(x, 2)
--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/32b5380b-83e8-403c-a512-2d0417fbdf3e%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Also this one isn't obvious:
In [21]: print sympy.ccode(sympy.symbols('x')**2, user_functions={"Pow": "std::pow"})
std::pow(x, 2)
--
You received this message because you are subscribed to the Google Groups "sympy" group.
To unsubscribe from this group and stop receiving emails from it, send an email to sympy+un...@googlegroups.com.
To post to this group, send email to sy...@googlegroups.com.
Visit this group at http://groups.google.com/group/sympy.
To view this discussion on the web visit https://groups.google.com/d/msgid/sympy/fa8762b6-04b1-4c9d-92fc-0a99b7935711%40googlegroups.com.