Skip to contents

Parses source into a tree, applies derivative rules (sum, product, quotient, power, chain, sin/cos/exp/log/tanh/sqrt), constant-folds. When at is given, checks against a central finite difference.

Usage

morie_geron_symbolic_diff(expr, var = "x", at = NULL)

Arguments

expr

Expression source string or already-parsed tree.

var

Variable to differentiate with respect to.

at

Optional named list/vector giving a point to evaluate at.

Value

list with derivative, tree, expression, value, numeric_check, error, nodes, var, estimate, n, method.

Examples

S <- c("a", "b", "c")
morie_geron_symbolic_diff(S)
#> $derivative
#> [1] "0"
#> 
#> $tree
#> $tree[[1]]
#> [1] "num"
#> 
#> $tree[[2]]
#> [1] 0
#> 
#> 
#> $expression
#> [1] "a"
#> 
#> $value
#> NULL
#> 
#> $numeric_check
#> NULL
#> 
#> $error
#> NULL
#> 
#> $nodes
#> [1] 1
#> 
#> $var
#> [1] "x"
#> 
#> $estimate
#> [1] 1
#> 
#> $n
#> [1] 1
#> 
#> $method
#> [1] "Rule-based differentiation of the parsed expression tree with constant folding"
#>