03 May 2020 - viridi - Sparisoma Viridi
Try to get some marks in document, such as Figure \ptref{graph-line-points} and fortunately how in works with \ptref{graph-points}
can no be explained.
Today we has accomplished in using MathJax and syntax highlighting using Rouge in Jekyll. And also introduction to pText in drawing a xy-chart using canvas through JavaScript.
We can have a graph of line
or points
or event both
Figures \ptref{graph-line}, \ptref{graph-points}, and \ptref{graph-line-points} are created with only a few lines of code. It can be seen that figure \ptref{graph-line-points} has both property of figures \ptref{graph-line} and \ptref{graph-points} in drawing the results.
A quadratic equation is simply
\begin{equation} \label{eq:equation-quadratic} y = ax^2 + bx + c, \end{equation}
whose roots can be obtained from
\begin{equation} \label{eq:equation-quadratic-roots} x_{1,2} = \frac{-b \pm \sqrt{b^2 - 4ac}}{2a}. \end{equation}
Implementation of equations \eqref{eq:equation-quadratic} and \eqref{eq:equation-quadratic-roots} in JavaScript can be as follow
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
function roots() {
// Get equation parameters
var eqn = arguments[0];
var a = eqn.a;
var b = egn.b;
var c = eqn.c;
// Calculate discriminant
var D = b * b - 4 * a * c;
// Calculate roots using
var x1 = (-b + Math.sqrt(D)) / (2 * a);
var x2 = (-b - Math.sqrt(D)) / (2 * a);
return [x1, x2];
}
where equation \eqref{eq:equation-quadratic-roots} is known as quadratic formula.