I'm writing a text where I'm needing to plot polynomial bases and operations on them. The bases are often represented in a vector form, e.g.,

Where N_i^p(\xi) may be a power, Bernstein, Lagrange, Legendre, Chebyshev, etc. basis function

I then want to be able to do things like plot \mathbf{N}^p(\xi) for \xi \in [\xi_{\min}, \xi_{\max}] , or multiply \mathbf{N}^p(\xi) by a matrix and plot the result (\mathbf{S}^p(\xi) below):

###
Code for assembling a `math/matrix`

of a Bernstein basis:

```
#lang racket/base
(require math)
(require plot)
(define (evalBernsteinBasis1D degree basis-idx variate)
(define term1 (binomial degree basis-idx) )
(define term2 (expt variate basis-idx) )
(define term3 (expt (- 1 variate) (- degree basis-idx) ) )
(* term1 term2 term3)
)
(define (eval-bernstein-basis-1D-vector degree variate )
(define basis-list (for/list ( [i (in-range (+ degree 1 ))] ) (evalBernsteinBasis1D degree (+ i 0) variate) ) )
(list->matrix (+ degree 1) 1 basis-list )
)
```

### Working, but verbose plotting of vector

```
(parameterize ( [plot-width 800]
[plot-height 400]
[plot-x-label #f]
[plot-y-label #f]
[plot-pen-color-map `tab10])
(plot
(list
(function (lambda (x) (matrix-ref (eval-bernstein-basis-1D-vector 2 x ) 0 0) ) 0 1 #:y-min 0 #:y-max 1 #:color 0 #:width 4)
(function (lambda (x) (matrix-ref (eval-bernstein-basis-1D-vector 2 x ) 1 0) ) 0 1 #:y-min 0 #:y-max 1 #:color 0 #:width 4)
(function (lambda (x) (matrix-ref (eval-bernstein-basis-1D-vector 2 x ) 2 0) ) 0 1 #:y-min 0 #:y-max 1 #:color 0 #:width 4)
)
)
)
```

Results in:

But I'd like to know if I can be more efficient with this plotting - a single `function`

plot and no `(matrix-ref _ 0 0)`

For example,

## An attempt at a more efficient plot

```
(parameterize ( [plot-width 800]
[plot-height 400]
[plot-x-label #f]
[plot-y-label #f]
[plot-pen-color-map `tab10])
(plot
(function (lambda (x) (eval-bernstein-basis-1D-vector 2 x ) ) 0 1 #:y-min 0 #:y-max 1 #:color 0 #:width 4)
)
)
```

But this results in an empty plot.