# Short scripts

Main home HERE.

For now, the programs below are entirely random (as in R-A-N-D-O-M); later on we'll be more specific, focusing on things that relate to high school math. We also use this opportunity to apologize to our fellow JavaScript fanatics, who may observe that we haven't followed code ethics.

Does it work?

## Diverse colours

In case you choose YES, enter the regular name (e.g black, brown, blue, etc) of your preferred colour in the pop up box. It's even possible to use rgb/rgba/hex/hsl values, which then gives you THOUSANDS -- yea, MILLIONS -- of options.

If you like to play with colours, this activity is for you.

## Dauntless courage

That's what you'll need when you're confronted with a daunting challenge, such as this game.

You'll be guessing random integers between $1$ and $20$. You win if your guess matches that of the computer.

Give it a go with all the grit you can muster! Don't falter in a contest with the computer!

## Dynamic center

The program in this section is, in a sense, the forebear of the rest. This is why it bears the name dynamic, which reflects the nature of the entire page's contents.

## Decisive courses

We assume that you are going the university route. (In Ontario, Canada, there's a distinction between university preparatory courses and college preparatory courses. This distinction begins early -- in grade 9 ('subtly'), in grade 11 (settled)).

• Are you in high school?
Yes
No
• Are you in Ontario?
Yes
No
• Do you want to attend college or university?
College
University
• Indicate the general area of your intended career:
STEM
Social sciences
Education

## Dual calculator

Type a number in each RED input field, then CLICK on MULTIPLY and/or DIVIDE.

## Date concepts

Complete date and time.

## Discriminant computation

In this section, we consider our favourite word in all of high school math -- the discriminant.

We're mainly interested in computing the discriminant, without discussing the associated nature of roots. We've also limited our computations to degrees 2 and 3, as higher degrees are inconvenient.

To proceed, CLICK on either the quadratic discriminant button or the cubic discriminant button, enter the appropriate coefficients, then click the button again. The default value has been set to zero (don't worry about this, it will change once you've entered the required coefficients, and clicked the button the second time).

From $ax^2+bx+c$, ENTER the values of $a,b,c$ below: Value of $a$:

Value of $b$:

Value of $c$:

From $ax^3+bx^2+cx+d$, ENTER the values of $a,b,c,d$ below: Value of $a$:

Value of $b$:

Value of $c$:

Value of $d$:

## Divisibility concerns

Things related to divisibility -- for example, the greatest common divisor (gcd), also known as the highest common factor (hcf). We also consider the least common multiple (lcm), which is useful in finding common denominators when working with fractions. $0$ is left out.

Our program produces the divisors alongside, so is slower in comparison with the standard Euclidean algorithm, especially for large numbers (such large numbers are rarely encountered in high school numerical problems, so we're safe).

## Digits counter

Here's our simplest program; it serves no purpose -- other than to count the number of digits in a given number.

Click the yellow button once, after which a red input field will appear. Type in your desired number (no decimals), then click the yellow button again.

Enter the number below: Input number:

## Deciphering content

This program reads what you type. Type in WHATEVER you want, then click OUTSIDE the input area (or just press the ENTER key). What you typed will appear below the red button.

Here's a variant of the above. You don't have to press the enter key after typing. As you're typing, the contents will be displayed. Call this activity type seeing (to mimic sight seeing ...).

Finally, we have another variant. This time around, the program tells you which keys you pressed on your keyboard. Really? Yes. However, some special keys like TAB, ALT, F3, F5, F6, F7, F9 will distort the program, so if you have to press them, do so after all other keys. Almost the same thing happens with F10, F11, and F12, but pressing them TWICE will prevent their default effect. You will also notice that some keys perform the same functions (like F3, slash /, and single quotes ').
(By the way, if you've ever taken an online typing test/training, this is the sort of program that determines whether or not you typed the correct keys.)

## Drawing charts

And graphs. Code's coming.

## Discrete functions

Functions with the positive integers as domain. Code's coming.

## Describing transformations

As far as high school math is concerned, transformation is our second favourite word, after disriminant. Sorry that we don't hide our bias.

Assume that $f(x)$ is the parent function, and that $af[k(x-d)]+c$ is the transformed function. Ensure that the transformed function is of this form. Enter the parameters $a,k,d,c$. The description will be displayed just under the last input field. For now, this program only accepts integers and decimals, so if any of the parameters $a,k,d,c$ is a fraction, one may have to first convert it to its decimal equivalent (we understand that this is inconvenient, so we'll modify the program in due time).

Enter the value of $a$: Enter the value of $k$: Enter the value of $d$: Enter the value of $c$:

## BMI Calculation

If you've been following our programs to this point, you can now see the extent of randomness that we've gotten to. However, this doesn't mean that we're directionless. We want to scale different lengths and heights without being scalars ourselves (in physics, scalars are quantities that don't have direction).

By BMI, we refer to the popular Body Mass Index. It is used to determine if an individual has the right amount of fat. It can be calculated using a simple formula: BMI=$\frac{\textrm{mass}}{\textrm{height}^2}$, where mass is measured in kilograms and height is measured in metres (the usual physics units for these quantities, but other units are possible, like pounds and inches).

## Simple measurement

Use the buttons below to calculate the areas of two familiar shapes. The final result will be displayed in an alert.

## Triple measurement

Right now only few shapes have been included. We hope to expand the list later.

## Pythagorean theorem

Based on the familiar formula $c^2=a^2+b^2$ and its re-arrangements ($a^2=c^2-b^2$, $\quad b^2=c^2-a^2$). Here, the hypotenuse is represented as $c$, while the opposite or adjacent side could be $a$ or $b$.

## Pythagorean triples

Any triple $(a,b,c)$ of positive integers that satisfy $c^2=a^2+b^2$. Code's coming.

## Pascal's triangle

Binomial coefficients. Code's coming.

## Perfect squares

Recall that a positive integer $p$ is said to be a perfect square if there's another integer $q$ (called the square root of $p$) such that $p=q^2$. Note that a negative integer can never be a perfect square (in the domain of real numbers).

## Perfect powers

Here we work with numbers that are perfect powers, not just perfect squares.

## Pop quiz

Below is a sample, simple math quiz (you can also check this page). Each question carries one point. When you're done, CLICK on the submit button to see your total score. Excited? Let's get started!

1. Which of the following is a prime number?
2. One
Two
Four
Six
3. Which of the following is a factor of $111111$?
4. One
Two
Three
Five
5. Which of the following is an even number?
6. One
Two
Three
Five
7. Which of the following is NOT a perfect square?
8. One
Two
Four
Nine
9. Which of the following is a perfect cube?
10. One
Two
Three
Four

## Prime numbers

A positive integer $p$ is said to be prime if it has only two divisors, namely $1$ and $p$.

We offer three variants. In the first, you'll type an arbitrary number, then click to see if it's a prime number (the program for this is relatively slower, because it produces the divisors alongside). The second variant generates the first few primes beginning from $2$. The third variant generates prime numbers within an interval specified by the user.

Type a positive INTEGER in the input field below:

## Perfect numbers

A positive integer $n$ is said to be perfect if it is equal to the sum of its proper divisors. For example, $6$ is a perfect number because $6=1+2+3$, where $1,2,3$ are the proper divisors of $6$.

As usual, you first click the yellow button, after which a red input field will appear. Type in a random number, then click the same button again.

Enter the number below: Input number:

Enter the lower and upper limits below: Lower limit:

Upper limit:

## Finite differences

Constructing finite differences and using them to determine if certain relations are polynomials. Code's coming.

Coming up soon.

Coming up soon.

Coming up soon.

Coming up soon.

Coming up soon.

Coming up soon.

Coming up soon.

Coming up soon.

Coming up soon.

Coming up soon.

Coming up soon.