using substitute with mathematical expressions

a somewhat lengthy but effective idiom for plotting mathematical
expressions with values taken from variables in the R session