bernoulli(10)
# 1.00000000 -0.50000000 0.16666667 0.00000000 -0.03333333
# 0.00000000 0.02380952 0.00000000 -0.03333333 0.00000000 0.07575758
#
x1 <- linspace(0.3, 0.7, 2)
y1 <- bernoulli(1, x1)
plot(x1, y1, type='l', col='red', lwd=2,
xlim=c(0.0, 1.0), ylim=c(-0.2, 0.2),
xlab="", ylab="", main="Bernoulli Polynomials")
grid()
xs <- linspace(0, 1, 51)
lines(xs, bernoulli(2, xs), col="green", lwd=2)
lines(xs, bernoulli(3, xs), col="blue", lwd=2)
lines(xs, bernoulli(4, xs), col="cyan", lwd=2)
lines(xs, bernoulli(5, xs), col="brown", lwd=2)
lines(xs, bernoulli(6, xs), col="magenta", lwd=2)
legend(0.75, 0.2, c("B_1", "B_2", "B_3", "B_4", "B_5", "B_6"),
col=c("red", "green", "blue", "cyan", "brown", "magenta"),
lty=1, lwd=2)
Run the code above in your browser using DataLab