Learn R Programming

polyMatrix (version 0.9.16)

parse.polyMatrix: Parse polynomial matrix from strings

Description

This is a convenient way to input a polynomial matrix.

Usage

parse.polyMatrix(..., var = "x")

Arguments

...

string or strings to parse

var

variable character. Only lower latin characters are allowed except 'e' which is reseved for numbers

Value

new polynomial matrix of polyMatrix class

Details

Space and tabulation characters are ignored.

Row should be divided by new line "\n" or backslash "\" (TeX style).

Elements in each row can be divided by ",", ";" or "&" (TeX style)

For convenience, this function can accept multiple string. In this case each string will be treated as a new row.

This function accepts TeX matrix format.

See Also

parse.polynomial()

Examples

Run this code
# NOT RUN {
parse.polyMatrix("       1, 2 + x",
                 "2 + 2x^2,    x^3")

# The function can suggest mistake position in case of invalid format
# }
# NOT RUN {
parse.polyMatrix(
    "1 + y &    2\\
        -2 &  x^2"
)
## Fail to parse polyMatrix: invalid term at position 2 in item [1, 1]
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab