cancel() will take any rational function and put it into the standard canonical form

cancel(x)

Arguments

x

A caracas_symbol

Examples

if (has_sympy()){
  def_sym(x, y, z)
  expr = cancel((x**2 + 2*x + 1)/(x**2 + x))
  cancel(expr)
  expr = (x*y**2 - 2*x*y*z + x*z**2 + y**2 - 2*y*z + z**2)/(x**2 - 1)
  cancel(expr)
  factor_(expr)
}
#> c:        2
#>    (y - z) 
#>    ────────
#>     x - 1