January 31, 2015

I began using Markdown in 2009, before which, I wrote everything in HTML. Despite switching, the habit of using inline links persisted, resulting in a folder full of draft posts that I now find harder to read and edit. Here’s where I find pandoc really helpful. This following example shows how to convert a file named `textinline.md`

that has inline style links into another file called `textref.md`

with reference links.

```
pandoc -f markdown -t markdown --reference-links --no-wrap textinline.md -o textref.md
```

### Batch convert

To do this for a folder full of files with `.mdown`

extension to `.md`

, here’s a batch shell script:

```
#!/usr/bin/env zsh
# 2015 ckunte
#
# Save this script as inl2ref.sh and run the following at zsh
# prompt:
#
# $ zsh inl2ref.sh
#
autoload -U zmv
for file in *.mdown; do pandoc -f markdown -t markdown --reference-links --no-wrap "$file" -o "$file.md"; done
zmv '(*).mdown.md' '$1.md'
```

November 23, 2014

My ten year old younger daughter has been discovering number series on her own. Today, she said to me that she has developed two conjectures:

- Square series conjecture: When any two square values in series are known, an entire series can be built.
- Cube series conjecture: When any three cube values in series are known, an entire series can be built.

Here’s how she explains them:

### Square series conjecture

Let’s say we have two square values in series:

```
25, 36
| |
+--+
11
```

The difference between square series is always an even number: 2. For instance,

```
1, 4, 9, 16
| | | |
+---+---+---+
3 5 7
| | |
+---+---+
2 2
```

So, you add 2 to the difference plus the last number to get the next in series.

```
25, 36, 49 (= 36 + 11 + 2)
| | ^
+--+ |
11 + 2--+
```

Likewise, one can find the previous in the series as below:

```
25 - (11 - 2) = 16
```

Imagine a series of sequential square values as below:

\begin{aligned}
…, a_{x-1}, a_{x}, a_{x+1}, a_{x+2}, …
\end{aligned}

If you know any *two* in sequence, then you can build the series. Here’s how:

\begin{aligned}
a_{x-1} = 2 \cdot a_{x} - a_{x+1} + 2 \newline
a_{x+2} = 2 \cdot a_{x+1} - a_{x} + 2
\end{aligned}

This series is built one step at a time, of course, but it can be programmed to whatever iteration required to build the series.

### Cube series conjecture

Let’s say we have three cube values in series:

```
27, 64, 125, 216,
| | | |
+----+----+----+
37 61 91
| | |
+----+----+
24 30
| |
+----+
6
```

The difference between cube series is always an even number: 6. So, you come up with the next number as follows:

```
64 - 61 + 30 - 6 = 27
216 + 91 + 30 + 6 = 343
```

Now Let us again imagine a series of sequential cube values as below:

\begin{aligned}
…, b_{x-2}, b_{x-1}, b_{x}, b_{x+1}, b_{x+2}, …
\end{aligned}

If you know any *three* in sequence, then you can build the series. Here’s how.

\begin{aligned}
b_{x-2} = 3 \cdot (b_{x-1} - b_{x}) + b_{x+1} - 6 \newline
b_{x+2} = 3 \cdot (b_{x+1} - b_{x}) + b_{x-1} + 6
\end{aligned}

Again like the square series, this series too is built one step at a time, of course, but it can be programmed to whatever iteration required to build the series.

She had to explain this whole thing to me *twice* before I could get my head around the concept and help formalize into equations, since she’s not yet into it herself.

November 22, 2014

My daughter, who is in year 10, came to me with this problem, which she said she’s expected to solve using logarithms:

\begin{aligned}
3^{x} + 10 = 2 \cdot 3^{x + 1}
\end{aligned}

I am conditioned to plain algebra, and because logarithms play by different rules^{1}, I find them unfamiliar to get my head around complex expressions. The other problem is that I have also forgotten logarithms conveniently, because why not, I’ve never used slide rules, and I’ve got calculators and computers that I do not find multiplication problems difficult anymore. Or do I?

She and I then spent a better part of an hour trying. After numerous run-ins in expanding the above expression into solvable bits, rearranging LHS and RHS, I thought we’d need to know the answer first. I punched the above expression, and Calca spit the answer out just like that.^{2}

```
3^x + 10 = 2 * 3^(x + 1)
x => 0.6309
```

As I realized, this turned out to be an exercise in humility in which it was my daughter that finally came up with a solution, and she then taught me how to. First, she split the equation (notably the power part of the RHS) as below:

\begin{aligned}
3^{x} + 10 = 2 \cdot (3^{x} \cdot 3)
\end{aligned}

The question suggested using suitable substitution. So, here’s a clever substitution she used:

\begin{aligned}
3^{x} = a \
\end{aligned}

Using it in the expression, she came up with the following:

\begin{aligned}
a + 10 = 2 \cdot a \cdot 3 \newline
10 = 6a - a \newline
a = 2 \newline
\end{aligned}

Substituting the value of *a* back, she got this:

\begin{aligned}
3^{x} = 2 \newline
\end{aligned}

Now using the first rule of logarithms:

\begin{aligned}
x = log_{3} 2 \newline
x = 0.6309
\end{aligned}

To get a value of log to the base 3 in the last part, she had to use a scientific calculator, since we do not have log tables.

Part of the difficulty dealing with the problem above was because it’s an expression that also has addition in it, while according to the simple definition (I am repeating myself here), logarithms transform multiplication and division problems into addition and subtraction problems. But the rules do not address how to deal with a mixture of these expressions. So, the best way to deal with these is to reduce the problem via plain algebra to simpler expressions first containing only multiplication and division, and then employ logarithms to the problem.

As to the last part of problem, I realize, log to *any* base (3 in our case), for computational simplicity, and because built-in calculators within our computers do not have the *any* base option, the above may also be rewritten as:

\begin{aligned}
x = log_{3} 2 \newline
x = \frac{log_{10} 2}{log_{10} 3} \newline
x = 0.6309
\end{aligned}

The common base can be anything. (Those with calculators would find it convenient to use a common base of 2, e, or 10). The answer would be the same. For instance,

\begin{aligned}
x = \frac{log_{e} 2}{log_{e} 3} \newline
x = 0.6309
\end{aligned}

Here’s the curve, and a graphical check — notice the intersection of the curve on x axis. That’s our answer found above.