subs | R Documentation |
Substitute symbols in a freealg
object for numbers or other
freealg
objects
subs(...)
subsu(S1,S2,r)
S1 , S2 |
Objects of class |
r |
Integer specifying symbol to substitute ( |
... |
First element is a |
Function subs()
substitutes variables for freealg
objects
(coerced if necessary) using natural R idiom. Observe that this type
of substitution is sensitive to order:
> subs("ax",a="1+x",x="1+a") free algebra element algebraically equal to + 2 + 3*a + 1*aa > subs("ax",x="1+a",a="1+x") free algebra element algebraically equal to + 2 + 3*x + 1*xx
Functions subsu()
is a lower-level formal function, not really
intended for the end-user. Function subsu()
takes S1
and
substitutes occurrences of symbol r
with S2
.
No equivalent to mvp::subvec()
is currently implemented.
Returns a freealg
object.
Function subs()
is one place in the package where the use of
letters
is effectively hard-wired in. Idiom such as
subs("abccc",b="1+3x")
is very nice, but identifies “b” with 2. Note that argument
r
of subsu()
is canonically an integer but a single
character is interpreted as a letter
. See also the note
at freealg.Rd
.
Robin K. S. Hankin
subs("abccc",b="1+3x")
subs("aaaa",a="1+x") # binomial
subs("abA",b=31)
subs("1+a",a="A") # can substitute for an inverse
subs("A",a="1+x") # inverses are not substituted for
## Sequential substitution works:
subs("abccc",b="1+3x",x="1+d+2e")
subs(rfalg(),a=rfalg())
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.