Blog 1

Random Talk on Random Thoughts

Rake Aborted Due to a Vim Swap File

| Comments |

Background

I’m using fugitive.vim for efficient verson control.1

Problem

Tonight, I wrote an article about Venn diagram, and I attempted to publish it using the Vim editor command

:Gpush|!rake gen_deploy && rake notify

After that, the following error message popped up.

[owner@localhost ~/octopress]$ vi
To git@github.com:VincentTam/vincenttam.github.io.git
   c6c422a..fc8d6b8  source -> source

## Generating Site with Jekyll
    write source/stylesheets/screen.css
Configuration file: /home/owner/octopress/_config.yml
            Source: source
       Destination: public
      Generating... 
                    done.
 Auto-regeneration: disabled. Use --watch to enable.
cp -r source/_posts/.2016-02-09-my-venn-diagram-mistake.markdown.swp public/_posts/.2016-02-09-my-venn-diagram-mistake.markdown.swp
rake aborted!
Errno::ENOENT: No such file or directory @ rb_sysopen - public/_posts/.2016-02-09-my-venn-diagram-mistake.markdown.swp
/home/owner/octopress/Rakefile:276:in `block (2 levels) in <top (required)>'
/home/owner/octopress/Rakefile:275:in `block in <top (required)>'
/home/owner/octopress/Rakefile:265:in `block in <top (required)>'
/home/owner/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `eval'
/home/owner/.rvm/gems/ruby-2.1.2/bin/ruby_executable_hooks:15:in `<main>'
Tasks: TOP => copydot
(See full trace by running task with --trace)

shell returned 1

Press ENTER or type command to continue

When one sees an error message like above for the first time, one needs not look directly into code, even though one is writing code in an IDE. Instead, one may view the error log to see what’s wrong.

From the command cp -r ..., I realised that the problem came from Rakefile, which tried to copy the non-existent .2016-blablabla.markdown.swp in the public folder in the local folder for this blog to the _deploy folder.2 (There are no _posts folder under the public folder.)

How can I do the task within Vim?

My Venn Diagram Mistake

| Comments |

Background

I tried this Mathematics Stack Exchange question by drawing a Venn Diagram.

</source> A 4-set Venn Diagram

Problem

A downvote was quickly casted on my answer below which a comment about the non-existence of a Venn diagram with 4 sets was left. I clicked on the link to another question in that comment to understand why I got this downvote: Why a 4-set Venn diagram doesn’t exist?

Explanation

I understood the arguments of Joebot’s answer up to the “application of binomial theorem”, but I didn’t understand the Euler’s formular. In fact, for any 3-D object with edges, vertices and faces, one can represent it by a 2-D planar graph, on which the outermost region also represents one of the faces of the 3-D object. Thus, the Euler’s formula for any 3-D object can be seen on a 2-D planar graph. I’m amazed that this can be proved by mathematical induction on the number of regions on the 2-D graph (which corresponds to that of faces of the 3-D object). IMHO, this should be taught in high schools as examples of mathematical induction, instead of divisibility of integers, which can be done better using modular arithmetic.

Jekyll Blog Page Build Warning

| Comments |

Background

The page build of Jekyll is quite easy because one doesn’t need to locally generate the HTML code of the Markdown source with rake. One just needs to directly save, commit and push the source code online. The GitHub page support will handle the rest for you.

Problem

I wrote an article in my Jekyll blog yesterday afternoon. From what was shown in the terminal, the page build was smooth as expected. Then, I received a warning from GitHub.

</source> The warning email from GitHub

Flair in Octopress via HTTPS

| Comments |

Background

I replaced the big avatar of my self intro in the sidebar with my Stack Exchange flair, which summarized my reputation and badges on Mathematics Stack Exchange. Since then, it’s easier to see my profile there.

Problem

When I browsed my blog, I saw a lock with a yellow triangle on the left of the URL.

</source> An abnormal icon on the left of the URL

This indicated the presence of insecure contents.

</source> </source> Firefox's error console message

How can I get rid of this error message?

Closedness vs Completeness

| Comments |

Background

To prove a limit, we need to find a number before. The definition gives us no hints on how to find it. Cauchy’s Criterion for convergence is a good method for finding it numerically in “certain spaces” (e.g. $\R,L^p,L^\infty$) because the definition is intrinsic.

Unluckily, there’re some “strange spaces” where Cauchy’s Criterion isn’t enough to give a convergence. The simplest one is $\Q$ equipped with the usual metric in $\R$.

One knows that an incomplete metric space $X$ can extended to form a complete one $X^*$ (which is unique up to isometric isomorphism) so that $\iota(X)$ is dense in $X^*$. That is, $\overline{\iota(X)} = X^*$.

Problem

I confused $\overline{X}$ with $X^*$. In other words, what’s the difference between the completion of $X$ and the closure of $X$?

Explanation

General answer

To see this, we note that the closedness of a set is discussed relative to another set, so if one stays inside the incomplete space $X$, then one notices that $X$ is closed in $X$. However, even though one doesn’t know about $X^*$, one still realises that $X$ is incomplete.

If one becomes wiser and seeks to “complete a given Cauchy sequence” (i.e. find a limit for a Cauchy sequence in $X$), it’s impossible to live inside $X$—one needs to escape from $X$ to $X^*$ so as to enjoy more freedom.

Claim: $X$ isn’t closed in $X^*$.

Approach: We won’t start from the topological definition (open complement). Instead, we’ll argue with sequences.

Proof: Since $X$ is incomplete, there exists a Cauchy sequence $(x_n)$ in $X$ so that it has no limit in $X$. The completeness of $X^*$ is applied to construct a limit $x$ in $X^*$. If one allows $X$ to be closed, then $x$ will stay inside $X$, which contradicts the fact that $(x_n)$ has no limit in $X$.

Even though living in $X$ is sad, and it seems to be hard to escape (because $X$ is closed in $X$), if one has a chance to travel outside, one will see that $X$ is not really closed—it is possible to find a sequence $(x_n)$ to escape from $X$.

Specific example

$\Q$ is closed in $\Q$, but it isn’t closed in $\R$. Therefore, the concept of closedness depends on the bigger space. However, the concept of completeness only depends on $\Q$ itself.

Become an Unsung Hero

| Comments |

Several mininutes ago, I was awarded the “Unsung Hero” badge on Mathematics Stack Exchange. I’m glad about that, and I hope that this will bring more upvotes to my answers and reduce the ratio of zero score accepted answers to all accepted answers. This is not likely to happen though.

My "Unsung Hero" badge on Mathematics Stack Exchange

A Search Result on HKHeadline

| Comments |

After writing three posts, I would like to stop doing so and watch some news. Therefore, I browse the home page of HKHeadline. I see a hot topic on the right of the search button: “Taiwan presidential election” (台灣大選). I click on that but no results are returned.

</source> Search results for a hot topic

Generate $\rm \LaTeX$ Code for Octave Matrices

| Comments |

Background

Problem

Recently, I encountered a linear algebra problem on Mathematics Stack Exchange.

For any given matrix $A$ in Octave,

A = [1 2 2; 2 3 4; 4 4 2]
A =

   1   2   2
   2   3   4
   4   4   2

how can one generate its $\rm \LaTeX$ code

$\rm \LaTeX$ code for matrix $A$
1
A = \begin{bmatrix} 1&2&2\\ 2&3&4\\ 4&4&2 \end{bmatrix}

so that one gets

\[ A = \begin{bmatrix} 1&2&2\\ 2&3&4\\ 4&4&2 \end{bmatrix}? \]

Generate Simplex Tableaux With Octave

| Comments |

Background

It’s easy that one makes careless mistakes in a pivot operation. As a result, in test/exams in which calculators are allowed, I used a simple program to save time.

Answering linear programming question on Mathematics Stack Exchange, I used GNU Octave to do the tedious work.

Initial tableau

First write the LPP in standard form. I assume that $b$ and $c$ are column vectors.

  • c is the objective function.
  • A is the coefficient matrix of the constraints. (a.k.a technology matrix)
  • b is the RHS of the constraints.
  • T0 is the initial tableau.

My habit is to

  1. place $b$ on the RHS;
  2. place the objective function row at the bottom;
  3. omit the coefficient for $z$ since it’ll never be changed.
Generate the initial tableaulink
1
2
3
4
5
6
7
format rat;
c = [-1 2 -3 0 0 0]'; b = [11 0 8]';
A = [
1 -.5 1 1 0 0;
0 2 -1 0 1 0;
0 0 0 2 0 1];
T0 = [A b; -c' 0]

Current simplex tableau

The command basis = [3 2 6] is used to choose the decision variables $x_3,x_2$ and $x_6$ as the basis. Note that the order of the entries in the array basis is very important. By setting this array, I don’t need to repeat typing the same set of numbers for $B$ and $c_B$.

Generate the tableau from the current basislink
1
2
basis = [3 2 6]; B = A(:,basis); cB = c(basis);
T = [B\A B\b; cB'*(B\A)-c' cB'*(B\b)]

Inadequacies

Since I’m no longer in an LP course, I’m too lazy to write the code for finding the suitable elements for a pivot operation. We don’t need to re-develop something that has been well-developed.