Description Usage Arguments Value Author(s) Examples
Bernstein polynomials
1 | bernstein(k, n, indeterminate = "x")
|
k |
Bernstein polynomial k |
n |
Bernstein polynomial degree |
indeterminate |
indeterminate |
a mpoly object
David Kahle
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 | bernstein(0, 0)
bernstein(0, 1)
bernstein(1, 1)
bernstein(0, 1, "t")
bernstein(0:2, 2)
bernstein(0:3, 3)
bernstein(0:3, 3, "t")
bernstein(0:4, 4)
bernstein(0:10, 10)
bernstein(0:10, 10, "t")
bernstein(0:20, 20, "t")
## Not run: # visualize the bernstein polynomials
library(ggplot2); theme_set(theme_classic())
library(tidyr)
s <- seq(0, 1, length.out = 101)
N <- 10 # number of bernstein polynomials to plot
(bernPolys <- bernstein(0:N, N))
df <- data.frame(s, as.function(bernPolys)(s))
names(df) <- c("x", paste0("B_", 0:N))
head(df)
mdf <- gather(df, degree, value, -x)
head(mdf)
qplot(x, value, data = mdf, geom = "line", color = degree)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.