sqrt
→ sqrt()Returns the square root of a number — the number that gives it back when multiplied by itself.
sqrt(palo)sqrt(9) is 3, because 3 × 3 is 9. It is sq turned around.
The result is always above 0. sqrt does not work with numbers below 0 — sqrt(-9) returns NaN, meaning “not a number”.
The name is left as it stands, like sq and pow. “Square root” is mathematical notation that a Botswana learner meets in English in class — it appears in the JCE and BGCSE syllabuses in English only; translating it would hand them a word they will not see anywhere else.
In art sqrt is used to make growth ease off as it goes — it starts fast and then settles, which is what makes movement look natural.
Parameters
Section titled “Parameters”| Name | Type | Description |
|---|---|---|
palo | palo | A number above 0 whose square root is wanted. |
Examples
Section titled “Examples”tiro setaLoeto() {
thalaKanefase(400, 400);
bokamorago(18, 22, 32);
tlogelaGoTlatsa();
boketeMothalo(2);
// sqrt e dira gore diko tse di fa gare di kgaogane, tse di kwa ntle di atamalane
gopheta (diri i = 1; i <= 12; i = i + 1) {
metlha bogolwane = sqrt(i) * 100;
mothaloMmala(80 + i * 12, 190, 240 - i * 10);
thalaSediko(200, 200, bogolwane);
}
}tiro setaLoeto() {
thalaKanefase(400, 400);
bokamorago(240);
metlha x1 = 80;
metlha y1 = 300;
metlha x2 = 320;
metlha y2 = 120;
mothaloMmala(60, 120, 200);
boketeMothalo(3);
thalaMothalo(x1, y1, x2, y2);
// Se ke se `sekgala` se se dirang, se kwadilwe ka bolona
kwala(sqrt(sq(x2 - x1) + sq(y2 - y1)));
kwala(sekgala(x1, y1, x2, y2));
tlogelaMothalo();
tlatsaMmala(240, 180, 70);
thalaSediko(x1, y1, 16);
thalaSediko(x2, y2, 16);
}