read_one_term {genscore} | R Documentation |
Parses the first term of a non-uniform expression.
Description
Parses the first term of a non-uniform expression.
Usage
read_one_term(s)
Arguments
s |
A string, the variable side of a non-uniform inequality expression (i.e. terms must be rewritten in e.g. |
Details
Parses the first term in a non-uniform expression and returns the rest of the terms.
Value
A list containing the following elements:
idx |
An integer, the index of the first term (e.g. |
power_numer |
An integer, the power_numer of the first term. |
power_denom |
An integer, the power_denom of the first term. |
coef |
A number, the coefficient on the first term (e.g. |
s |
A string, the rest of the unparsed string. |
Examples
read_one_term("0.5*x1+x2^2")
read_one_term("2e3x1^(2/3)-1.3x2^(-3)")
read_one_term("2exp(3x1)+2.3*x2^2")
read_one_term(paste(sapply(1:10, function(j){paste(j, "x", j, "^", (11-j), sep="")}), collapse="+"))
read_one_term("0.5*x1^(-2/3)-x3^3 + 2log(x2)- 1.3e4exp(-25*x6)+x8-.3x5^(-3/-4)")
read_one_term("-1e-4x1^(-2/3)-x2^(4/-6)+2e3x3^(-6/9) < 3.5e5")
[Package genscore version 1.0.2.2 Index]