<?xml version="1.0" encoding="utf-8"?><rss version="2.0">
<channel>
<title><![CDATA[jtchang blog]]></title>
<link>http://blog.pfan.cn/jtchang</link>
<description>编程爱好者博客</description>
<language>zh-cn</language>
			<item>
		<title><![CDATA[整理我以前的PASCAL源程序-马的遍历]]></title>
		<link>http://blog.pfan.cn/jtchang/51695.html</link>
		<description><![CDATA[和八皇后问题同样有名的，是马的遍历问题。
中国象棋的棋盘(9*10的棋盘)，指定起点位置放上一只马。要求马不重复地跳完棋盘每个格子一次，最后刚好落在指定终点上。
如果指定起点和指定终点形成一个马步，则遍历后刚好能回到起点。
算法和八皇后问题的最后一个程序一样，采用了改进的拉斯维加斯算法(j.t.chang's LV)。
例如下面是从(1,1)遍历棋盘到(3,2)的一种解法：
01 04 35 80 89 28 37 26 31
82 79 90 03 36 33 30 23 38
05 02 81 34 29 88 27 32 25
78 83 18 87 20 57 24 39 22
17 06 77 84 09 86 21 58 55
76 49 08 19 72 59 56 65 40
07 16 75 10 85 66 41 54 43
48 13 50 73 60 71 44 67 64
15 74 11 46 51 62 69 42 53
12 47 14 61 70 45 52 63 68
{
&nbsp;&nbsp; 中国象棋的棋盘上，指定起点，放一只马，马不重复跳完棋盘各格一次，最后落在指定终点上。
&nbsp;}
Const&nbsp; maxx = 9;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; maxy = 10;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dn = maxx*maxy;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dx :array[1..8] of integer = (1,2,-1,-2,-2,-1, 1, 2);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dy :array[1..8] of integer = (2,1, 2, 1,-1,-2,-2,-1);
Type
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; point_rec = record
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; x, y : integer;
&nbsp;]]></description>
		<author><![CDATA[jtchang]]></author>
		<pubDate>2010-08-22 22:12:00</pubDate>
		</item>
				<item>
		<title><![CDATA[整理我以前的PASCAL源程序-八皇后问题(5)改进的拉斯维加斯算法]]></title>
		<link>http://blog.pfan.cn/jtchang/51694.html</link>
		<description><![CDATA[拉斯维加斯算法有个特点，一旦发现算不下去了，便会全部推倒重来。也许，没必要全部推倒重来。如果象“回溯”一样退回几步重算，可能答案就出来了。
下面是我自己改进的拉斯维加斯算法，在算100皇后或者更多皇后的问题上，比原来的算法效率要高出很多。我称这样方法为“伪回溯”。
(*
&nbsp;&nbsp;&nbsp; One Answer Of N Queens Problem.
&nbsp;&nbsp;&nbsp; Arithmetic Of j.t.Chang's LV.
*)
program LV_Queens;
const
&nbsp;&nbsp;&nbsp;&nbsp; N=100;
var
&nbsp;&nbsp;&nbsp; x:array[1..N] of integer;
&nbsp;&nbsp;&nbsp; i:integer;
procedure PrintResult;
var
&nbsp;&nbsp;&nbsp; i,j: integer;
&nbsp;&nbsp;&nbsp; t1,t2:longint;
&nbsp;&nbsp;&nbsp; f:text;
&nbsp;&nbsp;&nbsp; ch: char;
begin
&nbsp;&nbsp;&nbsp; for i:=1 to N do write(x[i]:5);
&nbsp;&nbsp;&nbsp; Readln;
end;
function place(k,a:integer):boolean;
var
&nbsp;&nbsp;&nbsp; i:integer;
begin
&nbsp;&nbsp; for i:=1 to k-1 do
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (k-i)=abs(a-x[i])&nbsp; then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; begin
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; place:=false;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;]]></description>
		<author><![CDATA[jtchang]]></author>
		<pubDate>2010-08-22 21:26:00</pubDate>
		</item>
				<item>
		<title><![CDATA[整理我以前的PASCAL源程序-八皇后问题(4)拉斯维加斯算法]]></title>
		<link>http://blog.pfan.cn/jtchang/51693.html</link>
		<description><![CDATA[在N*N的棋盘上放上N个皇后，使任意两个皇后都不会互相攻击。
有时一个问题的情况比较复杂、答案又很多，我们却苦于连一种解都找不到。用回溯法未必能等得来。用拉斯维加斯算法不失为一个好办法。
(*
&nbsp;&nbsp;&nbsp; Question Eight Queens.
&nbsp;&nbsp;&nbsp; Arithmetic Las Vegas.
&nbsp;&nbsp;&nbsp; Programmed by j.t.Chang.
*)
program LV_queens;
const
&nbsp;&nbsp;&nbsp;&nbsp; N=50;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
var
&nbsp;&nbsp;&nbsp; x:array[1..N] of integer;
&nbsp;&nbsp;&nbsp; i:integer;
procedure PrintResult;
var
&nbsp;&nbsp;&nbsp; i: integer;
begin
&nbsp;&nbsp;&nbsp; for i:=1 to N do write(x[i]:4);
&nbsp;&nbsp;&nbsp; Readln;
end;
function place(k: integer): boolean;
var
&nbsp;&nbsp;&nbsp; j:integer;
begin
&nbsp;&nbsp;&nbsp; for j:=1 to k-1 do
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (abs(k-j)=abs(x[k]-x[j])) or (x[k]=x[j]) then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; begin
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; place:=false]]></description>
		<author><![CDATA[jtchang]]></author>
		<pubDate>2010-08-22 17:40:00</pubDate>
		</item>
				<item>
		<title><![CDATA[整理我以前的PASCAL源程序-高精度计算(5)计算2的算术立方根]]></title>
		<link>http://blog.pfan.cn/jtchang/51690.html</link>
		<description><![CDATA[program Cube_Root_2;
{ This program is computing the cube root of 2.
&nbsp; (1-x)^(-m) = 1 + mx + m(m+1)/2! * x^2 + m(m+1)(m+2)/3! * x^3 +...
&nbsp; when m=1/3
&nbsp; 1/(1-x)^(1/3) = 1 + 1/3 * x + 1*4/(3*6) * x^2 + 1*4*7/(3*6*9) * x^3 +...
&nbsp; Let x = 375/16000
&nbsp; At last, Answer = sum*25/20
&nbsp; Note: Last some digits may be Wrong.
}

label ext;
const
&nbsp;&nbsp;&nbsp;&nbsp; dn=336;
var
&nbsp;&nbsp;&nbsp; i,k:longint;
&nbsp;&nbsp;&nbsp; sum,a:array[1..dn] of integer;
&nbsp;&nbsp;&nbsp; ip:integer;
procedure outp;
var
&nbsp; i:integer;
procedure writep(num:integer);
begin
&nbsp;&nbsp;&nbsp; write(num div 1000);
&nbsp;&nbsp;&nbsp; write(num div 100 mod 10);
&nbsp;&nbsp;&nbsp; write(num div 10 mod 10);
&nbsp;&nbsp;&nbsp; write(num mod 10,' ');
end;
begin
&nbsp;&nbsp; writeln('Cube_root(2)=');
&nbsp;&nbsp; writeln(sum[1],'.');
&nbsp;&nbsp; for i:=2 to dn do
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; writep(sum[i]) ;
&nbsp;&nbsp; writeln;
&nbsp;&n]]></description>
		<author><![CDATA[jtchang]]></author>
		<pubDate>2010-08-21 18:06:00</pubDate>
		</item>
				<item>
		<title><![CDATA[整理我以前的PASCAL源程序-八皇后问题(3)基本解]]></title>
		<link>http://blog.pfan.cn/jtchang/51688.html</link>
		<description><![CDATA[排除对称、旋转，八皇后问题的基本解其实只有12种。
(*
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 求八皇后问题排除对称、旋转后的基本摆法。
*)
const&nbsp; N=8;
type
&nbsp;&nbsp;&nbsp;&nbsp; queentype=array[1..N] of integer;
var
&nbsp;&nbsp; x,y:queentype;
&nbsp;&nbsp; sum: longint;
function place(k: integer):boolean;
var
&nbsp;&nbsp; i: integer;
begin
&nbsp;&nbsp;&nbsp; for i:=1 to k-1 do
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (k-i=abs(x[k]-x[i])) or (x[k]=x[i]) then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; begin
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; place:=false;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end;
&nbsp;&nbsp;&nbsp;&nbsp; place:=true;
end;
function trialed:boolean;
var
&nbsp;&nbsp;&nbsp; i: integer;
begin
&nbsp;&nbsp;&nbsp; for i:=1 to N do
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if y[i]&lt;x[i] then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; begin
&nbsp;&nbsp;&nbsp;&nbsp]]></description>
		<author><![CDATA[jtchang]]></author>
		<pubDate>2010-08-20 20:17:00</pubDate>
		</item>
				<item>
		<title><![CDATA[整理我以前的PASCAL源程序-八皇后问题(2)非递归算法]]></title>
		<link>http://blog.pfan.cn/jtchang/51686.html</link>
		<description><![CDATA[const
&nbsp;&nbsp;&nbsp;&nbsp; N=8;
var
&nbsp;&nbsp;&nbsp;&nbsp; k: integer;
&nbsp;&nbsp;&nbsp;&nbsp; x: array[1..N] of integer;
&nbsp;&nbsp;&nbsp;&nbsp; sum: longint;
procedure PrintChessboard;
var
&nbsp;&nbsp;&nbsp; i,j:integer;
begin
&nbsp;&nbsp;&nbsp; writeln;
&nbsp;&nbsp;&nbsp; writeln('No. ',sum);
&nbsp;&nbsp;&nbsp; for i:=1 to N do
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; begin
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for j:=1 to N do
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if j=x[i] then write('Q':2)
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; else write('.':2);
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; writeln;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end;
&nbsp;&nbsp;&nbsp; readln;
end;

function place(k: integer): boolean;
var
&nbsp;&nbsp; j:integer;
begin
&nbsp;&nbsp; for j:=1 to k-1 do
&nbsp;&nbsp;&nbsp;&nbsp; if (k-j=abs(x[k]-x[j])) or (x[k]=x[j]) then]]></description>
		<author><![CDATA[jtchang]]></author>
		<pubDate>2010-08-20 20:12:00</pubDate>
		</item>
				<item>
		<title><![CDATA[整理我以前的PASCAL源程序-八皇后问题(1)递归算法]]></title>
		<link>http://blog.pfan.cn/jtchang/51685.html</link>
		<description><![CDATA[　　八皇后问题是一个经典的问题。从解问题中产生出很多种经典的算法。下面是递归算法：
&nbsp;
const&nbsp; N=8;
type
&nbsp;&nbsp;&nbsp;&nbsp; queentype=array[1..N] of integer;
var
&nbsp;&nbsp; x,y:queentype;
&nbsp;&nbsp; sum: longint;
&nbsp;
function place(k: integer):boolean;
var
&nbsp;&nbsp; i: integer;
begin
&nbsp;&nbsp;&nbsp; for i:=1 to k-1 do
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if (k-i=abs(x[k]-x[i])) or (x[k]=x[i]) then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; begin
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; place:=false;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end;
&nbsp;&nbsp;&nbsp;&nbsp; place:=true;
end;
&nbsp;
procedure PrintChessboard;
var
&nbsp;&nbsp;&nbsp; i,j:integer;
begin
&nbsp;&nbsp;&nbsp; writeln('No. ',sum, ' :');
&nbsp;&nbsp;&nbsp; for i:=1 to N do
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; begin
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; for j:=1 to N do]]></description>
		<author><![CDATA[jtchang]]></author>
		<pubDate>2010-08-20 18:44:00</pubDate>
		</item>
				<item>
		<title><![CDATA[整理我以前的PASCAL源程序-高精度计算(4)计算Ln(3)]]></title>
		<link>http://blog.pfan.cn/jtchang/51684.html</link>
		<description><![CDATA[公式就不多说了，注释写得很清楚。
program Ln_3;
{ This program is computing Ln(3)
&nbsp; Ln(1-z) = -(z+z^2/2+z^3/3+...)
&nbsp; -Ln(1-z) = z+z^2/2+z^3/3+...
&nbsp; Let z =2/3
&nbsp; Ln(3) = -Ln(1-2/3) = (2/3) + (2/3)^2/2 + (2/3)^3/3 + ...
}
label ext;
const
&nbsp;&nbsp;&nbsp;&nbsp; dn=307;
var
&nbsp;&nbsp;&nbsp; i,k:longint;
&nbsp;&nbsp;&nbsp; sum,a:array[1..dn] of integer;
&nbsp;&nbsp;&nbsp; ip:integer;
procedure outp;
var
&nbsp; i:integer;
procedure writep(num:integer);
begin
&nbsp;&nbsp;&nbsp; write(num div 1000);
&nbsp;&nbsp;&nbsp; write(num div 100 mod 10);
&nbsp;&nbsp;&nbsp; write(num div 10 mod 10);
&nbsp;&nbsp;&nbsp; write(num mod 10,' ');
end;
begin
&nbsp;&nbsp; writeln('Ln(3)=');
&nbsp;&nbsp; writeln(sum[1],'.');
&nbsp;&nbsp; for i:=2 to dn do
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; writep(sum[i]) ;
&nbsp;&nbsp; writeln;
&nbsp;&nbsp; writeln('Programmed by j.t.chang');
end;
procedure m_div(k:longint);
var
&nbsp;&nbsp; i:integer;
&nbsp;&nbsp; r1,c:longint;]]></description>
		<author><![CDATA[jtchang]]></author>
		<pubDate>2010-08-20 00:41:00</pubDate>
		</item>
				<item>
		<title><![CDATA[整理我以前的PASCAL源程序-高精度计算(3)计算Sqrt(2)和黄金分割]]></title>
		<link>http://blog.pfan.cn/jtchang/51682.html</link>
		<description><![CDATA[1、计算sqrt(2)
　　利用公式：1/sqrt(1-x)=1 + 1/2*x + 1*3/(2*4)*x^2 + (1*3*5)/(2*4*6)*x^3 + ……
　　当x=1/57122时，代入左边算算得到什么数。Sqrt(2)前多一个系数没关系，最后做一步简单的系数乘除就行了。
　　选择x=1/57122，是为了让级数收敛更快些。当然，选1/50、1/1682 也是可以的，慢一点而已。
program sqrt_2;
label ext;
const
&nbsp;&nbsp;&nbsp;&nbsp; dn=2504;
var
&nbsp;&nbsp;&nbsp; i,k:longint;
&nbsp;&nbsp;&nbsp; sum,a:array[1..dn] of integer;
&nbsp;&nbsp;&nbsp; ip:integer;
procedure outp;
var
&nbsp; i,m:integer;
procedure testm;
begin
&nbsp;&nbsp;&nbsp;&nbsp; if m mod 10=0 then write(' ');
&nbsp;&nbsp;&nbsp;&nbsp; if (m mod 50=0) and (m mod 1000&lt;&gt;0) then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; writeln(':',m:8);
&nbsp;&nbsp;&nbsp;&nbsp; if m mod 1000&lt;&gt;0 then exit;
&nbsp;&nbsp;&nbsp;&nbsp; writeln(':',m:8,'&nbsp; Press Enter..');
&nbsp;&nbsp;&nbsp;&nbsp; readln;
end;
procedure writep(num:integer);
begin
&nbsp;&nbsp;&nbsp; write(num div 1000);&nbsp;&nbsp; m:=m+1;&nbsp;&nbsp; testm;
&nbsp;&nbsp;&nbsp; writ]]></description>
		<author><![CDATA[jtchang]]></author>
		<pubDate>2010-08-19 23:18:00</pubDate>
		</item>
				<item>
		<title><![CDATA[整理我以前的PASCAL源程序-高精度计算(2)计算自然对数底e]]></title>
		<link>http://blog.pfan.cn/jtchang/51680.html</link>
		<description><![CDATA[　　算自然对数底e，比起算圆周率甚至还要简单。直接利用e的级数算就行。下面的程序算到e的小数点后一万位。
program se;
label ext;
const
&nbsp;&nbsp;&nbsp;&nbsp; dn=2504;
var
&nbsp;&nbsp;&nbsp; n,i,ip,k:integer;
&nbsp;&nbsp;&nbsp; sum,a:array[1..dn] of integer;
procedure testk;
var
&nbsp;&nbsp; ch:char;
begin
&nbsp;&nbsp;&nbsp;&nbsp; if k mod 10=0 then write(' ');
&nbsp;&nbsp;&nbsp;&nbsp; if (k mod 50=0) and (k mod 1000&lt;&gt;0) then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; writeln(':',k:8);
&nbsp;&nbsp;&nbsp;&nbsp; if k mod 1000&lt;&gt;0 then exit;
&nbsp;&nbsp;&nbsp;&nbsp; writeln(':',k:8,'&nbsp; Press Enter..');
&nbsp;&nbsp;&nbsp;&nbsp; readln;
end;
procedure outp;
var
&nbsp; i:integer;
begin
&nbsp;&nbsp; writeln('e=');
&nbsp;&nbsp; writeln(sum[1],'.');
&nbsp;&nbsp; k:=0;
&nbsp;&nbsp; for i:=2 to dn do
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; begin
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; write(sum[i] div 1000);&nbsp; k:=k+1; testk;
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbs]]></description>
		<author><![CDATA[jtchang]]></author>
		<pubDate>2010-08-19 22:17:00</pubDate>
		</item>
				<item>
		<title><![CDATA[整理我以前的PASCAL源程序-高精度计算(1)计算圆周率]]></title>
		<link>http://blog.pfan.cn/jtchang/51679.html</link>
		<description><![CDATA[序言
　　看着这些程序，使我想起了以前DOS时代。这些PASCAL程序是我多年前编的。有些在论坛贴过，有些没贴出来。最近在整理，希望对以后学PASCAL的人有用。
　　
高精度计算(1)计算圆周率
　　以前就一个16位的编译器TP7，数组开大一点还不行。当时是想开一个数组，把一些常数计算得位数更从一些。没有用别人的算法，没有用别人的代码，就自己编，不求太高的效率。
　　最先计算的是圆周率，失败了几次，最后程序成功地算出一千位来。当时心情真的很兴奋。以前网络没有普及，拿着一本书，在那里对着数位，直到书上数位没有了，程序仍然显示着后面的数位……
&nbsp;&nbsp;&nbsp; 后来改了几次。下面的程序，用Machin公式，在TP7下可以算出一万位圆周率来。

program spi;
{ pi=16acrtg(1/5)-4arctg(1/239)&nbsp;&nbsp; }
{ pi/4=1/1*(20/25-239/57121)-1/3(20/25^2-239/57121^2)+... }
{ Programmed by j.t.Chang.}
label ext,ext2;
const
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dn=2504;
var
&nbsp;&nbsp; i,ip,c:integer;
&nbsp;&nbsp; k:longint;
&nbsp;&nbsp; a,b,sum:array[1..dn] of integer;
procedure oupt;
var i:integer;
&nbsp;&nbsp;&nbsp; k:longint;
procedure testk;
var
&nbsp;&nbsp; ch:char;
begin
&nbsp;&nbsp;&nbsp;&nbsp; if k mod 10=0 then write(' ');
&nbsp;&nbsp;&nbsp;&nbsp; if (k mod 50=0) and (k mod 1000&lt;&gt;0) then
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; writeln(]]></description>
		<author><![CDATA[jtchang]]></author>
		<pubDate>2010-08-19 22:05:00</pubDate>
		</item>
				<item>
		<title><![CDATA[懂数学不懂语文的人闹的笑话]]></title>
		<link>http://blog.pfan.cn/jtchang/29341.html</link>
		<description><![CDATA[　　我今天看到一本电子书《乐在其中的数学》，其中一句话，几乎让我笑倒。这句话是这样写的：“古往今来，含有数字的上好对联为数极多，真是罄竹难书，……”　　“罄竹难书”形容罪行多得写不完，是贬义词。语出《旧唐书&#8226;李密传》：“罄南山之竹，书罪未穷；决东海之波,流恶难尽。”这个词用在这里，让任何一位有一点语文知识的人都会笑倒。　　这就是懂数学不懂语文的人闹的一个笑话。]]></description>
		<author><![CDATA[jtchang]]></author>
		<pubDate>2007-09-12 11:07:00</pubDate>
		</item>
				<item>
		<title><![CDATA[摆了52年的“六角形”幻方]]></title>
		<link>http://blog.pfan.cn/jtchang/29271.html</link>
		<description><![CDATA[　　“幻方”是数学大世界中的一朵奇葩，吸引了无数人对它的痴迷。在“幻方”的世界中，人们主要研究的是正方形幻方的填法，对其他形状幻方的研究涉及较少。但是有一个“六角形”幻方的填法值得我们了解，因为这个幻方用了52年的光阴才让它与世人见面，这不得不让人们为之惊奇和感动。 　　上个世纪初，国外有个叫亚当斯的青年，他对幻方的痴迷让人吃惊。一次，他突发奇想：为何只研究正方形幻方呢？难道其他形状的没有了吗？于是，他着手研究“六角形”的幻方。 　　亚当斯理所当然首先想到的是一层的六角形幻方，即将1-7这七个自然数填到如图1所示的圆圈中，他经过证明，这样的六角形幻方是不能填出来的。于是，他又着手研究二层的六角形幻方的填法。如图2所示，将1-19这19个自然数填入圆圈中，使每一直线上的几个数之和都相等。 

　　亚当斯起初觉得这样的幻方不一定很难，以为只要几个小时，也许就能摆出来。当他动手摆了几次后，才感到这样的幻方不是自己想像的那么容易。于是，为了更好的、更早的把这样的幻方摆出来，他做了19块小板，带在身上，只要一有空，他就拿出来摆。这一摆，就让他感到事情不是那么的简单。一次，两次，无数次；失败，失败，再失败。亚当斯从1910年开始，直到1957年，用了47年的时间，还是一点头绪也没有。失败，挫折，没让亚当斯退却。只是为了更早的摆出来，劳累让亚当斯病倒了。他躺在医院的病床上，也没有忘记他那心爱的、让人难以达到的六角形幻方。功夫不负有心人，一天，亚当斯在无意之中把它摆了出来，此时，亚当斯的心情非常激动，马上把他的摆法记了下来。这样，六角形的幻方摆出来了，心情高兴了，病也好了。在回家的路上，不知什么原因，亚当斯把他记六角形幻方的纸张给弄丢了。 　　亚当斯并不灰心，既然第一次摆出来了，第二次也肯定能摆出来。不料，这一丢失，亚当斯又用了5年，才第二次把六角形幻方摆出来（图略），这时，时间到了1962年。 　　亚当斯用了52年的时间，终于摆出了六角形幻方。图上一共有15条连线，这15条连线上的数字之和分别均为38。 　　当这件事过去了7年后，有一位大学生阿莱尔用电子计算机，仅仅用了17秒就摆出来了；同时也得出，六角形幻方仅此一例，再没有别的六角形幻方了。此幻方的稀有程度不得不让人记住它。 
　　亚当斯的精神让我敬佩，同时我为他浪费了52年的时间感到惋惜。　　现在任何一个编程好一点的计算]]></description>
		<author><![CDATA[jtchang]]></author>
		<pubDate>2007-09-10 14:37:00</pubDate>
		</item>
				<item>
		<title><![CDATA[用Excel解线性方程组]]></title>
		<link>http://blog.pfan.cn/jtchang/3980.html</link>
		<description><![CDATA[这里我想提的只是一个Excel里不被人注意的函数：计算行列式MDETERM() 

例题：&nbsp;&nbsp;

设有未知数x1、x2、x3、x4，满足以下条件：
x1 + 3*x2 -2*x3 + x4 = 1
2*x1 + 5*x2 -3*x3 + 2*x4 = 3
-3*x1+ 4*x2 + 8*x3 -2*x4 = 4
6*x1 -x2 - 6*x3 + 4*x4 =2
用克拉默法则求出x1、x2、x3、x4的值。

解题方法：

我们在(A1:E4)单元格分别输入系数和等号右边的数值
1&nbsp;&nbsp;&nbsp;&nbsp;3&nbsp;&nbsp;&nbsp;&nbsp;-2&nbsp;&nbsp;&nbsp;&nbsp;1&nbsp;&nbsp;&nbsp;&nbsp;1
2&nbsp;&nbsp;&nbsp;&nbsp;5&nbsp;&nbsp;&nbsp;&nbsp;-3&nbsp;&nbsp;&nbsp;&nbsp;2&nbsp;&nbsp;&nbsp;&nbsp;3
-3&nbsp;&nbsp;&nbsp;&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;8&nbsp;&nbsp;&nbsp;&nbsp;-2&nbsp;&nbsp;&nbsp;&nbsp;4
6&nbsp;&nbsp;&nbsp;&nbsp;-1&nbsp;&nbsp;&nbsp;&nbsp;-6&nbsp;&nbsp;&nbsp;&nbsp;4&nbsp;&nbsp;&nbsp;&nbsp;2

在单元格A5输入公式：
=MDETERM(A1:D4)
即计算系数行列式，得到 17 ，于是得 D = 17;

选中(E1:E4)这一列单元格，复制：按Ctrl + c，
然后点中A1单元，粘贴：按Ctrl +&nbsp;&nbsp;v，
A5单元格变成了 -34 ，于是得 D1 = -34

取消：按Ctrl + z，A5单元格仍变回17。点中B1单元格，粘贴：按Ctrl +&nbsp;&nbsp;v，
A5单元格变成了 0 ，于是得 D2 = 0

取消：按Ctrl + z，A5单元格仍变回17。点中C1单元格，粘贴：按Ctrl +&nbsp;&nbsp;v，
A5单元格变成了 17，于是得 D3 = 17

取消：按Ctrl + z，A5单元格仍变回]]></description>
		<author><![CDATA[jtchang]]></author>
		<pubDate>2005-08-21 01:31:00</pubDate>
		</item>
				<item>
		<title><![CDATA[用winamp播放《仙剑奇侠传》dos版音乐]]></title>
		<link>http://blog.pfan.cn/jtchang/3944.html</link>
		<description><![CDATA[本文提到的音乐文件、winamp插件均可在http://jtchang.ys168.com网络硬盘的压缩包里找到，或者在SPC音乐网www.spcmusic.net找到。感谢SPC音乐网成员以及所有为我提供帮助的网友！

未经作者同意不得转载
------------------------------

　　怀念《仙剑奇侠传》DOS版优美的音乐！它让我想起了拿着把木剑到处斩妖除魔的学生时代。
&nbsp;&nbsp;&nbsp;&nbsp;尽管那时是在DOS下玩的游戏，但是它优美的音乐依然让人难以忘怀。我曾经编程把游戏文件Midi.mkf里的midi文件拆开来播放，现在网上也有一些midi文件可以下载，但总觉得和实际游戏里播放的音乐相去甚远，游戏里的音乐更加动听。
&nbsp;&nbsp;&nbsp;&nbsp;直到有人用《大富翁》测试声卡的程序“偷梁换柱”来播放《仙剑奇侠传》的背景音乐，我才意识到这个差距是怎么回事：原来我和大多数人一样弄错了，其实游戏里调用的是另一个文件：mus.mkf。音乐文件不是midi，而是rix。(rix文件：大宇公司早期开发游戏时的音乐文件)
　　随着DOS的淘汰，原来那个《大富翁》测试程序已经没办法直接在windows下播出声音来了，必须通过dos模拟器才能正常发出音乐。同时那个测试程序也不便于选曲。
&nbsp;&nbsp;&nbsp;&nbsp;去年，经过BBS上各位网友提供的帮助，我也下了很多功夫，终于制成了能够在windows的mp3播放器winamp下独立播放的*.dro文件。
&nbsp;&nbsp;&nbsp;
&nbsp;&nbsp;&nbsp;&nbsp;文件的播放方法：
１、你需要安装有winamp这个软件，大名鼎鼎的mp3文件播放器。
２、下载并安装winamp的插件Adplug。下载网址：
http://www.informatik.uni-oldenburg.de/~dyna/adplug/files/in_adlib-1.6.exe
３、用winamp播放我制作的扩展名为dro的文件。

&nbsp;&nbsp;&nbsp;&nbsp;这些音乐和游戏里的背景音乐播放效果是一样的。
&nbsp;&nbsp;&nbsp;&nbsp;如果上述插件网址连接失效，可以发邮件到我的邮箱：jtchang@21cn.co]]></description>
		<author><![CDATA[jtchang]]></author>
		<pubDate>2005-08-19 10:55:00</pubDate>
		</item>
		</channel>
</rss>