sympy functions in R

I'm trying to adapt the following python code that uses sympy to r through reticulate:

from sympy import Function, Symbol
x = Symbol('x')
f = Function('f')
g = Function('g')(x)
f(x)

It should be something like this

library("reticulate")
sympy <- import("sympy")
x <- sympy$Symbol('x')
f <- sympy$Function('f')
g <-  sympy$Function('g')(x)
# Error in py_call_impl(callable, dots$args, dots$keywords) : 
#  TypeError: expected bytes, NoneType found
f(x)
# Error in py_call_impl(callable, dots$args, dots$keywords) : 
#  TypeError: expected bytes, NoneType found

But it seems I need to convert the input of the sympy functions somehow, but I couldn't figure out how.

Maybe someone managed?

This topic was automatically closed 21 days after the last reply. New replies are no longer allowed.