幻方的构造方法

幻方的构造方法

首先:不存在2阶幻方,证明十分简单,假设四个数a、b、c、d,根据幻方的定义,应当有a+b = a+c,但是\(b \neq c\),二者矛盾,所以不存在2阶幻方。

奇数阶幻方和4M+2阶幻方可以阅读:

https://zh.wikipedia.org/wiki/%E5%B9%BB%E6%96%B9

4M阶幻方的构造上文不全面,对于4M阶幻方,应当将从左上角开始将矩阵分成多个4*4的小方阵,将小方阵内的正反对角线上所有元素变换为整个大方阵上的中心对称位置上的元素。

相关问题:https://vjudge.net/problem/UVA-10087

What is the square root of i?

Solution:

Let \(z = a + bi\) be the complex number which is a square root of i, that is

\(z^{2} = (a + bi)^{2} = a^{2} – b^{2} + 2abi = i\)

Equating real and imaginary parts, we have

\(\begin{cases} a^{2} – b^{2} & = 0,\\ 2ab & = 1.\end{cases}\)

The two real solution to this pair of equations are

\(\begin{cases} a = \frac{1}{\sqrt{2}},\\ b = \frac{1}{\sqrt{2}},\end{cases}\)

and

\(\begin{cases} a = -\frac{1}{\sqrt{2}},\\ b = -\frac{1}{\sqrt{2}}.\end{cases}\)

The two square root of i therefor are \(\pm\frac{1}{\sqrt{2}}(i + 1)\).