Chyetanya KuntePersonal log
http://ckunte.net/log/
en-usFrom inline to reference style links
http://ckunte.net/log/2015/inl2ref
http://ckunte.net/log/2015/inl2refSat, 31 Jan 2015 00:00:00 GMT<p>I began using <a href="http://daringfireball.net/projects/markdown/" title="Text-to-HTML conversion tool for web writers.">Markdown</a> 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 <a href="http://johnmacfarlane.net/pandoc/" title="A universal document converter.">pandoc</a> really helpful. This following example shows how to convert a file named <code>textinline.md</code> that has inline style links into another file called <code>textref.md</code> with reference links.</p>
<pre><code>pandoc -f markdown -t markdown --reference-links --no-wrap textinline.md -o textref.md
</code></pre>
<h3>Batch convert</h3>
<p>To do this for a folder full of files with <code>.mdown</code> extension to <code>.md</code>, here’s a batch shell script:</p>
<pre><code>#!/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'
</code></pre>Square and cube series conjecture
http://ckunte.net/log/2014/square-cube-series-conjecture
http://ckunte.net/log/2014/square-cube-series-conjectureSun, 23 Nov 2014 00:00:00 GMT<p>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:</p>
<ol>
<li>Square series conjecture: When any two square values in series are known, an entire series can be built.</li>
<li>Cube series conjecture: When any three cube values in series are known, an entire series can be built.</li>
</ol>
<p>Here’s how she explains them:</p>
<h3>Square series conjecture</h3>
<p>Let’s say we have two square values in series:</p>
<pre><code>25, 36
| |
+--+
11
</code></pre>
<p>The difference between square series is always an even number: 2. For instance,</p>
<pre><code>1, 4, 9, 16
| | | |
+---+---+---+
3 5 7
| | |
+---+---+
2 2
</code></pre>
<p>So, you add 2 to the difference plus the last number to get the next in series.</p>
<pre><code>25, 36, 49 (= 36 + 11 + 2)
| | ^
+--+ |
11 + 2--+
</code></pre>
<p>Likewise, one can find the previous in the series as below:</p>
<pre><code>25 - (11 - 2) = 16
</code></pre>
<p>Imagine a series of sequential square values as below:</p>
<p>\begin{aligned}
…, a_{x-1}, a_{x}, a_{x+1}, a_{x+2}, …
\end{aligned}</p>
<p>If you know any <em>two</em> in sequence, then you can build the series. Here’s how:</p>
<p>\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}</p>
<p>This series is built one step at a time, of course, but it can be programmed to whatever iteration required to build the series.</p>
<h3>Cube series conjecture</h3>
<p>Let’s say we have three cube values in series:</p>
<pre><code>27, 64, 125, 216,
| | | |
+----+----+----+
37 61 91
| | |
+----+----+
24 30
| |
+----+
6
</code></pre>
<p>The difference between cube series is always an even number: 6. So, you come up with the next number as follows:</p>
<pre><code> 64 - 61 + 30 - 6 = 27
216 + 91 + 30 + 6 = 343
</code></pre>
<p>Now Let us again imagine a series of sequential cube values as below:</p>
<p>\begin{aligned}
…, b_{x-2}, b_{x-1}, b_{x}, b_{x+1}, b_{x+2}, …
\end{aligned}</p>
<p>If you know any <em>three</em> in sequence, then you can build the series. Here’s how.</p>
<p>\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}</p>
<p>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.</p>
<p>She had to explain this whole thing to me <em>twice</em> before I could get my head around the concept and help formalize into equations, since she’s not yet into it herself.</p>Logarithms
http://ckunte.net/log/2014/logarithms
http://ckunte.net/log/2014/logarithmsSat, 22 Nov 2014 00:00:00 GMT<p>My daughter, who is in year 10, came to me with this problem, which she said she’s expected to solve using logarithms:</p>
<p>\begin{aligned}
3^{x} + 10 = 2 \cdot 3^{x + 1}
\end{aligned}</p>
<p>I am conditioned to plain algebra, and because logarithms play by different rules<sup id="fnref:1"><a class="footnote-ref" href="#fn:1" rel="footnote">1</a></sup>, 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?</p>
<p>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 <a href="http://calca.io/" title="Calca - The Text Editor that Loves Math">Calca</a> spit the answer out just like that.<sup id="fnref:2"><a class="footnote-ref" href="#fn:2" rel="footnote">2</a></sup></p>
<pre><code>3^x + 10 = 2 * 3^(x + 1)
x => 0.6309
</code></pre>
<p>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:</p>
<p>\begin{aligned}
3^{x} + 10 = 2 \cdot (3^{x} \cdot 3)
\end{aligned}</p>
<p>The question suggested using suitable substitution. So, here’s a clever substitution she used:</p>
<p>\begin{aligned}
3^{x} = a \
\end{aligned}</p>
<p>Using it in the expression, she came up with the following:</p>
<p>\begin{aligned}
a + 10 = 2 \cdot a \cdot 3 \newline
10 = 6a - a \newline
a = 2 \newline
\end{aligned}</p>
<p>Substituting the value of <em>a</em> back, she got this:</p>
<p>\begin{aligned}
3^{x} = 2 \newline
\end{aligned}</p>
<p>Now using the first rule of logarithms:</p>
<p>\begin{aligned}
x = log_{3} 2 \newline
x = 0.6309
\end{aligned}</p>
<p>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.</p>
<p>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.</p>
<p>As to the last part of problem, I realize, log to <em>any</em> base (3 in our case), for computational simplicity, and because built-in calculators within our computers do not have the <em>any</em> base option, the above may also be rewritten as:</p>
<p>\begin{aligned}
x = log_{3} 2 \newline
x = \frac{log_{10} 2}{log_{10} 3} \newline
x = 0.6309
\end{aligned}</p>
<p>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,</p>
<p>\begin{aligned}
x = \frac{log_{e} 2}{log_{e} 3} \newline
x = 0.6309
\end{aligned}</p>
<p><img class="screen" src="/log/images/logcurve.png"></p>
<p>Here’s the curve, and a graphical check — notice the intersection of the curve on x axis. That’s our answer found above.</p>
<div class="footnote">
<hr />
<ol>
<li id="fn:1">
<p>It is a method that converts difficult multiplication and division problems into addition and subtraction problems using tables of logarithms. <a class="footnote-backref" href="#fnref:1" rev="footnote" title="Jump back to footnote 1 in the text">↩</a></p>
</li>
<li id="fn:2">
<p>Just be aware that in a quadratic equation with two solutions, Calca reports only the positive value. <a class="footnote-backref" href="#fnref:2" rev="footnote" title="Jump back to footnote 2 in the text">↩</a></p>
</li>
</ol>
</div>