We summarize with this, the most remarkable formula in mathematics: \[ e^{i \theta} = \cos \theta + i \sin \theta. \] This is our jewel.

We may relate the geometry to the algebra by representing complex numbers in a plane; the horizontal position of a point is \( x, \) the vertical position of a point is \( y. \) We represent every complex number, \( x + iy. \) Then if the radial distance to this point is called \( r \) and the angle is called \( \theta, \) the algebraic law is that \( x + iy \) is written in the form \( r, e^{i \theta} \) where the geometrical relationships between \( x \) \( y, \) \( r, \) and \( \theta \) are as shown. This, then, is the unification of algebra and geometry.

See the bottom of the page at https://www.feynmanlectures.caltech.edu/I_22.html for the above excerpt.

]]>When the biologists returned to the island two months later they found that all chameleons were red in colour. They were certain that no chameleons died because they did not find dead remains of any chameleon. What does it say about the number of blue chameleons on the day the biologists counted the number of red and green chameleons?

See the comments page for the solution.

]]>For example, on February 9 the cubes would be placed side by side such that the front face of the cube on the left side shows 0 and that of the one on the right side shows 9.

Two ways of assigning the digits to the faces of the cubes are considered different if and only if it is not possible to get one assignment from the other by performing one or more of the following operrations:

- Rotating (reorienting) the digits with respect to the faces they belong to.
- Rotating the cubes.
- Swapping the cubes.

See the comments page for the solution.

]]>See the comments page for the solution.

]]>Bob thought for a while, could not arrive at an answer, and gave up. Alice explained, "Well, the answer is white. It is a polar bear. It is only when you start from the North Pole that after travelling 1 km south, 1 km west, and 1 km north you would end up at the point where you started."

Bob replied, "That is an interesting solution. Now that I understand your solution, I realize that there are other starting points apart from the North Pole where one could walk 1 km south, then 1 km west, and then 1 km north to return to the starting point."

Can you find all the other such starting points that Bob is talking about?

See the comments page for the solution.

]]>See the comments page for the solution.

]]>I learnt this from an arithmetic book during my childhood days. If the first digit of a 2-digit number is \( a \) and the second digit is \( 5 \) in decimal representation, then its square can then be written as the result of \( a \times (a + 1) \) followed by \( 25 \) in decimal representation, i.e., the first few digits of the square is given by \( a \times (a + 1) \) and the last two digits are \( 25 \). Here are some examples:

- \( 25^2 = 625. \) (Note that \( 2 \times 3 = 6. \))
- \( 85^2 = 7225. \) (Note that \( 8 \times 9 = 72. \))

After learning the previous trick, I wondered if I could make more such tricks for myself. This is the first one I could come up with. If the first digit of a 2-digit number is \( 5 \) and the second digit is \( a \), then its square can be written as the result of \( 25 + a \) followed by \( a^2 \). In other words, the first two digits of the square are obtained from the result of \( 25 + a \) and the last two digits are obtained from the result of \( a^2 \). Here are some examples:

- \( 52^2 = 2704. \) (Note that \( 25 + 2 = 27 \) and \( 2^2 = 4. \))
- \( 57^2 = 3249. \) (Note that \( 25 + 7 = 32 \) and \( 7^2 = 49. \))

Let us represent all digits except the last one as \( a \), e.g., if we are given the number \( 115 \), we say, \( a = 11 \). Then we can express the given number algebraically as \( 10a + 5 \). Note that the square of this number is \[ (10a + 5)^2 = 100a(a + 1) + 25. \] In decimal representation, this amounts to writing the result of \( a(a + 1) \) followed by \( 25. \) Here are some examples:

- \( 115^2 = 13225. \) (Note that \( 11 \times 12 = 132. \))
- \( 9995^2 = 99900025. \) (Note that \( 999 \times 1000 = 999000. \))

Let us represent all digits except the first one as \( a \), e.g., if we are given the number \( 512 \), we say, \( a = 12 \). Then we can express the given number algebraically as \( 5 \times 10^n + a \) where \( n \) is the number of digits in \( a \). Note that \[ (5 \times 10^n + a)^2 = 25 \times 10^{2n} + 10^{n + 1} a + a^2. \] In decimal reprensetation, this amounts to performing the following steps:

- Write \( 25 \) as the first two digits.
- Then write \( a^2 \) as a \( 2n \)-digit number immediately after \( 25 \). Prefix \( a^2 \) with appropriate number of \( 0 \)s so that \( a^2 \) is written with \( 2n \) digits.
- Write the \( + \)-sign directly below the first digit, that is, write the \( + \)-sign directly before the first \( 2 \).
- Write every digit of \( a \) including any preceding \( 0 \)s immediately after the \( + \)-sign.
- Finally add the numbers in both rows column by column performing the carrying operation whenever necessary.

Here are some examples: \[ 502^2 = \\ \left\{ \begin{array}{cccccc} 2 & 5 & 0 & 0 & 0 & 4 \\ + & 0 & 2 \\ \hline 2 & 5 & 2 & 0 & 0 & 4 \end{array} \right\} = 252004. \] \[ 512^2 = \\ \left\{ \begin{array}{cccccc} 2 & 5 & 0 & 1 & 1 & 4 \\ + & 1 & 2 \\ \hline 2 & 6 & 2 & 1 & 1 & 4 \end{array} \right\} = 262114. \] \[ 564^2 = \\ \left\{ \begin{array}{cccccc} 2 & 5 & 4 & 0 & 9 & 6 \\ + & 6 & 4 \\ \hline 3 & 1 & 8 & 0 & 9 & 6 \\ \end{array} \right\} = 318096. \]

Let us now see an example where we use both the tricks together. Let us find \( 5195^2 \). This is a number that begins with the digit \( 5 \) as well as ends with the digit \( 5 \). We need to use the second trick to find \( 5195^2 \). But the second trick begins with writing \( 25 \) immediately followed by the result of \( 195^2 \), so we use the first trick to calculate \( 195^2 \).

To write the result of \( 195^2 \), we first write \( 380 \) which we obtain as the result of \( 19 \times 20 \) and then we write \( 25 \) immediately after it. Thus \( 195^2 = 38025 \). Now we perform the second trick as follows: \begin{align*} 5195^2 = \left\{ \begin{array}{cccccccc} 2 & 5 & 0 & 3 & 8 & 0 & 2 & 5 \\ + & 1 & 9 & 5 \\ \hline 2 & 6 & 9 & 8 & 8 & 0 & 2 & 5 \end{array} \right\} = 26988025. \end{align*}

]]>`cv()`

function that calculates the coefficient of
variation. The function `cv(x)`

is equivalent
to `stddev(x)`

/ `avg(x)`

where `x`

represents the list of data points.
$cat perf.sqlCREATE TABLE performance ( name VARCHAR, duration DOUBLE PRECISION ); INSERT INTO performance VALUES ('RAND', 101.0); INSERT INTO performance VALUES ('ZERO', 157.0); INSERT INTO performance VALUES ('NONE', 209.0); INSERT INTO performance VALUES ('TEST', 176.0); INSERT INTO performance VALUES ('UNIT', 197.0); INSERT INTO performance VALUES ('LOAD', 193.0); INSERT INTO performance VALUES ('FREE', 198.0); $psql statisticspsql (8.4.3) Type "help" for help. statistics=#\i perf.sqlDROP TABLE CREATE TABLE INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 INSERT 0 1 statistics=#select * from performance;name | duration ------+---------- RAND | 101 ZERO | 157 NONE | 209 TEST | 176 UNIT | 197 LOAD | 193 FREE | 198 (7 rows) statistics=#

statistics=#SELECT aggtransfn, aggfinalfn, aggtranstype::regtype, agginitvalstatistics-#FROM pg_aggregatestatistics-#WHERE aggfnoid='stddev(double precision)'::regprocedure;aggtransfn | aggfinalfn | aggtranstype | agginitval --------------+--------------------+--------------------+------------ float8_accum | float8_stddev_samp | double precision[] | {0,0,0} (1 row) statistics=#SELECT aggtransfn, aggfinalfn, aggtranstype::regtype, agginitvalstatistics-#FROM pg_aggregatestatistics-#WHERE aggfnoid='avg(double precision)'::regprocedure;aggtransfn | aggfinalfn | aggtranstype | agginitval --------------+------------+--------------------+------------ float8_accum | float8_avg | double precision[] | {0,0,0} (1 row) statistics=#

$cat cv.sqlCREATE OR REPLACE FUNCTION finalcv(double precision[]) RETURNS double precision AS $$ SELECT float8_stddev_samp($1) / float8_avg($1); $$ LANGUAGE SQL; CREATE AGGREGATE cv(double precision) ( sfunc = float8_accum, stype = double precision[], finalfunc = finalcv, initcond = '{0, 0, 0}' );

$psql statisticspsql (8.4.3) Type "help" for help. statistics=#select stddev(duration), avg(duration) from performance;stddev | avg ------------------+------------------ 37.1682147873178 | 175.857142857143 (1 row) statistics=#select stddev(duration) / avg(duration) as cv from performance;cv ------------------- 0.211354592616754 (1 row) statistics=#\i cv.sqlCREATE FUNCTION CREATE AGGREGATE statistics=#select cv(duration) from performance;cv ------------------- 0.211354592616754 (1 row) statistics=#

Checked whether
Bessel's
correction was used in the `stddev()`

function of
PostgreSQL. Yes, it was used.

$octave -qoctave:1>std([101, 157, 209, 176, 197, 193, 198], 0)ans = 37.168 octave:2>std([101, 157, 209, 176, 197, 193, 198], 1)ans = 34.411 octave:3>

The `std()`

function in MATLAB and GNU Octave applies
Bessel's correction when invoked with the second argument
as `0`

.