dist: Distances and the Pythagorean Theorem

Exercise template for computing the distance (numeric answer) between two randomly-drawn points in a Cartesian coordinate system.

Name:
dist
Type:
Related:
Description:
Computing the (Euclidean) distance between two randomly-drawn points by using the Pythagorean Theorem.
Solution feedback:
Yes
Randomization:
Random numbers and graphics
Mathematical notation:
Yes
Verbatim R input/output:
No
Images:
Yes
Other supplements:
No
Template:
Raw: (1 random version)
PDF:
dist-Rnw-pdf
dist-Rmd-pdf
HTML:
dist-Rnw-html
dist-Rmd-html

(Note that the HTML output contains mathematical equations in MathML. It is displayed by browsers with MathML support like Firefox or Safari - but not Chrome.)

Demo code:

library("exams")

set.seed(1090)
exams2html("dist.Rnw")
set.seed(1090)
exams2pdf("dist.Rnw")

set.seed(1090)
exams2html("dist.Rmd")
set.seed(1090)
exams2pdf("dist.Rmd")