sym: Convert a Character Expression to Ryacas Symbol or matrix

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/helper.R

Description

It converts a Character Expression or Matrix in R to Ryacas symbolic expression or matrix.

Usage

1
sym(x)

Arguments

x

A character expression or matrix.

Details

It converts mathematic operators from R to mathematic operators in yacas and then uses ysym to convert the R character expression or matrix to Ryacas symbolic expression or matrix. The Ryacas expression or matrix can be used for further symbolic calculations.

Value

An expression or matrix of class "yac_symbol".

Author(s)

Mike W.-L. Cheung <mikewlcheung@nus.edu.sg>

See Also

ysym, as.matrix

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
A1 <- "log(x) + exp(y)"

sym(A1)
# y: Ln(x)+Exp(y)

A2 <- matrix(c(1, 2, 3, "a", "sqrt(b)", "sin(c)"), ncol=2, nrow=3)
A2
#     [,1] [,2]     
# [1,] "1"  "a"      
# [2,] "2"  "sqrt(b)"
# [3,] "3"  "sin(c)" 

sym(A2)
# {{      1,       a},
#  {      2, Sqrt(b)},
#  {      3,  Sin(c)}} 

symSEM documentation built on July 16, 2020, 9:06 a.m.