Computing the first derivative of a product function with two factors and randomly-drawn parameters, using the product rule. In addition to the correct solution, four false alternatives are generated through
num_to_schoice()by providing two common errors along with a range and minimal delta for two further random solutions.
Verbatim R input/output:
(Note that the HTML output contains mathematical equations in MathML, rendered by MathJax using ‘mathjax = TRUE’. Instead it is also possible to use ‘converter = “pandoc-mathjax”’ so that LaTeX equations are rendered by MathJax directly.)
library("exams") set.seed(403) exams2html("deriv2.Rmd", mathjax = TRUE) set.seed(403) exams2pdf("deriv2.Rmd") set.seed(403) exams2html("deriv2.Rnw", mathjax = TRUE) set.seed(403) exams2pdf("deriv2.Rnw")