sympy_func {caracas}R Documentation

Call a SymPy function directly on x

Description

Extend caracas by calling SymPy functions directly.

Usage

sympy_func(x, fun, ...)

Arguments

x

Object to call fun on

fun

Function to call

...

Passed on to fun

Examples

if (has_sympy()) {
  def_sym(x, a)
  p <- (x-a)^4
  p
  q <- p %>% sympy_func("expand")
  q
  q %>% sympy_func("factor")
  
  def_sym(x, y, z)
  expr <- x*y + x - 3 + 2*x^2 - z*x^2 + x^3
  expr
  expr %>% sympy_func("collect", x) 
  
  x <- symbol("x")
  y <- gamma(x+3)
  sympy_func(y, "expand_func")
  expand_func(y)
}
 

[Package caracas version 2.1.1 Index]