# NOT RUN {
## when supplied with exactly one coefficient, most simplifactions are ignored.
as.body(1+0i, strict = FALSE)
## zero valued coefficients are removed by 'reduce', this can be changed.
as.body(0)
as.body(0, zero.rm = FALSE) # zero valued coefficient is retained.
as.body(Hermite(10), decreasing = TRUE)
as.body(Cyclotomic(105), decreasing = TRUE)
## 'var' can be a call to result in a more interesting result.
## the Chebyshev polynomials of the first kind are based on 'x = cos(theta)'
## and we can use 'var' to simulate this.
as.body(Chebyshev1(5), decreasing = TRUE,
var = call("cos", as.symbol("theta")))
## we can also specify 'var' as an expresion to get the same thing.
as.body(Chebyshev1(5), decreasing = TRUE,
var = expression(cos(theta)))
## you can combine this with 'as.function' like this:
as.function(reduce(Chebyshev1(5), decreasing = TRUE),
xname = "theta", var = expression(cos(theta)))
# }
Run the code above in your browser using DataLab