How can I call Sage from R?

From the search, I see that calling R from Sage pretty simple. However, I cannot find the Sage call information from R For example, suppose I have an expression R that I would like to distinguish, say

 temp <- expression(x + x^2) 

How can I send this to a sage and split it and send the expression R? I would like the result to be pretty much equivalent

 D(temp,'x') 

I searched for CRAN and google and found nothing. I hope there will be a better solution than something based on the system function. I saw that there is R support for yacas , but I'm interested in Sage .

I am using 64-bit Ubuntu.

Thanks!

+4
source share
1 answer

I don't know if this will work, but Sage libraries can be imported into Python, and Python can be paired with the rJython package. Could you name the Sage functions through rJython ? It may not be as clean as Ryacas or rSymPy , but it may be good enough.

Edit Because Sage uses SymPy, you can interact directly with SymPy:

 require(rSymPy) x <- Var('x') # Convenience function for: sympy("var('x')") sympy("diff(x + x**2, x, 1)") # [1] "1 + 2*x" 
+2
source

Source: https://habr.com/ru/post/1380352/


All Articles