A Brief History of Pi
Pi is a name given to the ratio of the circumference of a circle to the diameter. That means, for any circle, you can divide the circumference (the distance around the circle) by the diameter and always get exactly the same number. It doesn't matter how big or small the circle is, Pi remains the same. Pi is often written using the symbol
and is pronounced "pie", just like the dessert.
A Brief History of Pi
Ancient civilizations knew that there was a fixed ratio of circumference to diameter that was approximately equal to three. The Greeks refined the process and Archimedes is credited with the first theoretical calculation of Pi.
In 1761 Lambert proved that Pi was irrational, that is, that it can't be written as a ratio of integer numbers.
In 1882 Lindeman proved that Pi was transcendental, that is, that Pi is not the root of any algebraic equation with rational coefficients. This discovery proved that you can't "square a circle", which was a problem that occupied many mathematicians up to that time. (More information on squaring the circle.)
How many digits are there? Does it ever end?
Because Pi is known to be an irrational number it means that the digits never end or repeat in any known way. But calculating the digits of Pi has proven to be an fascination for mathematicians throughout history. Some spent their lives calculating the digits of Pi, but until computers, less than 1,000 digits had been calculated. In 1949, a computer calculated 2,000 digits and the race was on. Millions of digits have been calculated, with the record held (as of September 1999) by a supercomputer at the University of Tokyo that calculated 206,158,430,000 digits.
(first 1,000 digits)
More about the History of Pi can be found at the Mac Tutor Math History archives.
Approximation of Pi
Archimedes calculated that Pi was between 3 10/71 and 3 1/7 (also written 223/71 <
< 22/7 ). 22/7 is still a good approximation. 355/113 is a better one.
Pi Web Sites
Pi continues to be a fascination of many people around the world. If you are interested in learning more, there are many web sites devoted to the number Pi. There are sites that offer thousands, millions, or billions of digits, pi clubs, pi music, people who calculate digits, people who memorize digits, Pi experiments and more. Check this Yahoo page for a complete listing.
A Cool Pi Experiment
One of the most interesting ways to learn more about Pi is to do pi experiments yourself. Here is a famous one called Buffon's Needle.
In Buffon's Needle experiment you can drop a needle on a lined sheet of paper. If you keep track of how many times the needle lands on a line, it turns out to be directly related to the value of Pi.
Buffon's Needle Simulation Applet (Michael J. Hurben)
Buffon's Needle (George Reese, Office for Mathematics, Science and Technology Education University of Illinois Champaign-Urbana)
First 100 digits
3.1415926535 8979323846 2643383279 5028841971 6939937510 5820974944 5923078164 0628620899 8628034825 3421170679 ...
First 1000 digits
3.1415926535 8979323846 2643383279 5028841971 6939937510 5820974944 5923078164 0628620899 8628034825 3421170679 8214808651 3282306647 0938446095 5058223172 5359408128 4811174502 8410270193 8521105559 6446229489 5493038196 4428810975 6659334461 2847564823 3786783165 2712019091 4564856692 3460348610 4543266482 1339360726 0249141273 7245870066 0631558817 4881520920 9628292540 9171536436 7892590360 0113305305 4882046652 1384146951 9415116094 3305727036 5759591953 0921861173 8193261179 3105118548 0744623799 6274956735 1885752724 8912279381 8301194912 9833673362 4406566430 8602139494 6395224737 1907021798 6094370277 0539217176 2931767523 8467481846 7669405132 0005681271 4526356082 7785771342 7577896091 7363717872 1468440901 2249534301 4654958537 1050792279 6892589235 4201995611 2129021960 8640344181 5981362977 4771309960 5187072113 4999999837 2978049951 0597317328 1609631859 5024459455 3469083026 4252230825 3344685035 2619311881 7101000313 7838752886 5875332083 8142061717 7669147303 5982534904 2875546873 1159562863 8823537875 9375195778 1857780532 1712268066 1300192787 6611195909 2164201989
Vieta's Formula
2/PI =
2/2 *
( 2 +
2 )/2 *
(2 + (
( 2 +
2) ) )/2 * ...c
Leibnitz's Formula
PI/4 = 1/1 - 1/3 + 1/5 - 1/7 + ...
Wallis Product
PI/2 = 2/1 * 2/3 * 4/3 * 4/5 * 6/5 * 6/7 * ...
2/PI = (1 - 1/22)(1 - 1/42)(1 - 1/62)...
Lord Brouncker's Formula
4/PI = 1 + 1
----------------
2 + 32
------------
2 + 52
---------
2 + 72 ...
(PI2)/8 = 1/12 + 1/32 + 1/52 + ...
(PI2)/24 = 1/22 + 1/42 + 1/62 + ...
(PI2)/6 =
(n = 1..
) 1/n2 = 1/12 + 1/22 + 1/32 + ...
(or more generally...)
(n = 1..
) 1/n(2k) = (-1)(k-1) PI(2k) 2(2k) B(2k) / ( 2(2k)!)
B(k) = the k th Bernoulli number. eg. B0=1 B1=-1/2 B2=1/6 B4=-1/30 B6=1/42 B8=-1/30 B10=5/66. Further Bernoulli numbers are defined as (n 0)B0 + (n 1)B1 + (n 2)B2 + ... + (n (n-1))B(N-1) = 0 assuming all odd Bernoulli #'s > 1 are = 0. (n k) = binomial coefficient = n!/(k!(n-k)!)
See Power Summations #2 for simplified expressions (without the Bernoulli notation) of these sums for given values of k.
[原创]破解xmind3.2.1专业版功能
November 22, 2010 — — XMind Ltd today announced the new XMind update, v3.2.1, with some good improvements and a few fixed bugs.
- Brandnew dictionary management in Preferences page lets spell check work better.
- The special XMind version for Japan serves Japanese users.
- Improved French and Spanish UI translation is waiting for French or Spanish speaking users.
- XMind Pro can work offline now. (expect uploading map of course.)
- The signin process in XMind is enhanced much.
- Fix a shortcut bug (Ctrl+Alt+N).
- Fix a paste bug on Mac OS X. Now, paste multiple-line content into XMind, and every line would be a topic.
- And some other improvements.
发现可以支持线下使用pro功能了,不错,破解思路与3.2一样,熟练工,花了10分钟。。。。
需要破解思路的请访问:[原创]破解xmind3.2.0专业版功能
打包替换,以下是我校验的java代码。
只供有需要的朋友体验正式版功能,如果觉得不错,强烈建议购买正版!
[转]Ultraedit使用:配置字数统计工具栏
有朋友在使用Ultraedit的时候,可能不知道Ultraedit可以对文档的字符数进行统计的,还把文字全都拷贝到word里,利用word的字数统计功能进行统计,那这样就失去了使用Ultraedit的意义了,其实用Ultraedit进行字数统计是非常容易的,只要点击一下工具栏中字数统计的按钮即可,但不幸的是,Ultraedit默认好像并不显示字数统计按钮,所以这个又得由我们自己配置,下面就说说如何让字数统计按钮显示在上部工具栏里。
1、 菜单选择:高级->配置,如下图所示:
2、配置:
在左侧列表中,点“定制”,然后在右侧点“定制工具栏”,弹出如下窗口
在右侧的“新建工具栏”里输入“自定义”(文字可随意),表示我们将建立一个自定义工具栏集,然后点文本框右边的图标,在左侧将新建一个工具栏集“自定义”。
然后在左侧选中刚才新建的工具栏集“自定义”,在右侧列表中找到“字数统计”,找到后,选中,按下图所说的处理。
3、 显示
示例如下:
[原创]破解xmind3.2专业版功能
花了一天时间,其实是一个晚上的时间,突然觉得很好用,但是默认版本只有导出png功能,本来考虑买个正版的,一看价格,我崩溃了,好像买不起……
又想用,又买不起,怎么办?google了下,没有任何破解,只有3.1.1版本有个同学做了一个破解,download下来看了下,他的原理是绕过验证请求,用zip解压了plugins/net.xmind.verify_3.2.0.201009142023.jar文件,将net\xmind\verify\internal\UserInfoVerifier.class文件进行了还原,发现作者用了内部类,那个美元“$”相当纠结了,至少我就被他卡死了,用了很多方法编译都没有成功,提示的都是内部类引起的无法找到符号的问题,算了作罢吧,这条路太纠结了,怎么办?
这条路不行,那我就换嘛,
破解需要的准备工作:将plugins的所有文件解压在本地,也就是将classpath目录移到一个目录(本人解压在了plugins3),方便javac和查找,嘿嘿
用UE搜索“pdf”,嘿嘿,找到了导出代码的位置:\org\xmind\ui\internal\exports的PDFExportWizard.class,也就是org.xmind.ui.exports_3.2.0.201009142023.jar文件,用jd-gui-0.3.3.windows软件直接打开解压的目录,就可以很方便的看源码了,据说有问题,但是大致看看还是可以的:
打开后看到:
protected void addValidPages() {
addPage(new VerifyPage(ExportMessages.PDFExportJob_Name));
addPage(this.page = new PDFExportPage());
}
原来是增加了:addPage(new VerifyPage(ExportMessages.PDFExportJob_Name));
那么继续找VerifyPage类:
public VerifyPage(String name)
{
super("org.xmind.ui.export.verify", ExportMessages.VerifyPage_Title, null);
setPageComplete(false);
this.name = name;
}
public void setVisible(boolean visible)
{
super.setVisible(visible);
if (visible)
VerifyUI.runAction(this.name, new IVerifyListener() {
public void notifyValidity(IStatus validity) {
if (validity.getCode() == 1) {
VerifyPage.this.setPageComplete(true);
IWizardPage next = VerifyPage.this.getNextPage();
if (next != null) {
IWizardPage previous = VerifyPage.this.getPreviousPage();
VerifyPage.this.getContainer().showPage(next);
next.setPreviousPage(previous);
}
}
}
});
}
好,看到这里会看代码的就知道接下来改干什么了,不知道?呃,面壁去……
好啦,好晚了,也困了,就直接讲下吧:
将第二个函数直接引导至下一页即可:
public void setVisible(boolean visible)
{
super.setVisible(visible);
VerifyPage.this.setPageComplete(true);
IWizardPage next = VerifyPage.this.getNextPage();
VerifyPage.this.getContainer().showPage(next);
}
javac编译:
C:\Users\Administrator>C:\PROGRA~1\Java\JDK16~1.0_2\bin\javac.exe -classpath E:\
tt\XMind\plugins3\ -d E:\tt\XMind\plugins\org.xmind.ui.exports_3.2.0.20100914202
3 E:\tt\XMind\plugins3\org\xmind\ui\internal\exports\VerifyPage.java
成class文件,替换掉原来的,然后用zip打包,改后缀为.jar,替换原来的文件,打开xmind程序,测试导出功能,OK
由于涉及到版权问题,这里就不将破解文件公布了,需要的可以自行破解,或者留下email,呵呵,我会尽快邮件给你测试,请将破解文件在24小时内删除,否则牵扯到版权纠纷,一律与本站与本人无关。
----------------------------2010.10.16 00:30分割线----------------------------------------
昨天这个时候完成了export的破解,还有录音,头脑风暴等功能不能使用,嘿嘿,今天耐着性子看完了UserInfoVerifier.class的代码,结合jd-gui-0.3.3.windows和DJ Java Decompiler 3.11各自还原的java代码进行中和,顺利的完成了javac的再编译,嘿嘿,自此,在源头上破解了pro版本。经测试,用普通账户登录即可使用pro功能,需要测试的同学可以邮我。
具体破解方法如上,打包替换,以下是我校验的java代码。
只供有需要的朋友体验正式版功能,如果觉得不错,强烈建议购买正版!
[转]小议TCP的MSS(最大分段)以及MTU
[前言]
漫漫51长假,没有好的去处,只能每日上网消遣,某日逛到NBO灌水,见一帖曰:无法通过2514路由器上MSN(出口为ADSL线路,通过PPPoE)吾心想,ADSL---PPPoE,那肯定就是MTU之问题。回帖告之:改PC之MTU。
过数日,又逛到NBO,又见这帖,后有人回曰:ip tcp adjust-mss 1452后帖主又跟:问题解决。
吾纳闷之,后百思而得其解,So决定将自己所得写出来,分享给大家。
[背景知识]
MTU: Maxitum Transmission Unit 最大传输单元
MSS: Maxitum Segment Size 最大分段大小(偶是直译,翻译的不好,不要打
俺PP)
PPPoE: PPP Over Ethernet(在以太网上承载PPP协议)
[分析过程]
先说说这MTU最大传输单元,这个最大传输单元实际上和链路层协议有着密切的关系,让我们先仔细回忆一下EthernetII帧的结构DMAC+SMAC+Type+Data+CRC
由于以太网传输电气方面的限制,每个以太网帧都有最小的大小64bytes最大不能超过1518bytes,对于小于或者大于这个限制的以太网帧我们都可以视之为错误的数据帧,一般的以太网转发设备会丢弃这些数据帧。
(注:小于64Bytes的数据帧一般是由于以太网冲突产生的“碎片”或者线路干扰或者坏的以太网接口产生的,对于大于1518Bytes的数据帧我们一般把它叫做Giant帧,这种一般是由于线路干扰或者坏的以太网口产生)
由于以太网EthernetII最大的数据帧是1518Bytes这样,刨去以太网帧的帧头(DMAC目的MAC地址48bit=6Bytes+SMAC源MAC地址48bit=6Bytes+Type域2bytes)14Bytes和帧尾CRC校验部分4Bytes(这个部门有时候大家也把它叫做FCS),那么剩下承载上层协议的地方也就是Data域最大就只能有1500Bytes这个值我们就把它称之为MTU。这个就是网络层协议非常关心的地方,因为网络层协议比如IP协议会根据这个值来决定是否把上层传下来的数据进行分片。就好比一个盒子没法装下一大块面包,我们需要把面包切成片,装在多个盒子里面一样的道理。
当两台远程PC互联的时候,它们的数据需要穿过很多的路由器和各种各样的网络媒介才能到达对端,网络中不同媒介的MTU各不相同,就好比一长段的水管,由不同粗细的水管组成(MTU不同 )通过这段水管最大水量就要由中间最细的水管决定。
对于网络层的上层协议而言(我们以TCP/IP协议族为例)它们对水管粗细不在意它们认为这个是网络层的事情。网络层IP协议会检查每个从上层协议下来的数据包的大小,并根据本机MTU的大小决定是否作“分片”处理。分片最大的坏处就是
降低了传输性能,本来一次可以搞定的事情,分成多次搞定,所以在网络层更高一层(就是传输层)的实现中往往会对此加以注意!有些高层因为某些原因就会要求我这个面包不能切片,我要完整地面包,所以会在IP数据包包头里面加上一
个标签:DF(Donot Fragment)。这样当这个IP数据包在一大段网络(水管里面)传输的时候,如果遇到MTU小于IP数据包的情况,转发设备就会根据要求丢弃这个数据包。然后返回一个错误信息给发送者。这样往往会造成某些通讯上的问题,不过幸运的是大部分网络链路都是MTU1500或者大于1500。
对于UDP协议而言,这个协议本身是无连接的协议,对数据包的到达顺序以及是否正确到达不甚关心,所以一般UDP应用对分片没有特殊要求。
对于TCP协议而言就不一样了,这个协议是面向连接的协议,对于TCP协议而言它非常在意数据包的到达顺序以及是否传输中有错误发生。所以有些TCP应用对分片有要求---不能分片(DF)。
花开两朵,各表一枝,说完MTU的故事我们该讲讲今天的第二个猪脚---PPPoE所谓PPPoE就是在以太网上面跑PPP协议,有人奇怪了,PPP协议和Ethernet不都是链路层协议吗?怎么一个链路层跑到另外一个链路层上面去了,难道升级成网络层协议了不成。其实这是个误区:就是某层协议只能承载更上一层协议。
为什么会产生这种奇怪的需求呢?这是因为随着宽带接入(这种宽带接入一般为Cable Modem或者xDSL或者以太网的接入)由于以太网缺乏认证计费机制而传统运营商是通过PPP协议来对拨号等接入服务进行认证计费的,所以就出了这么一个怪胎:PPPoE。(有关PPPoE的详细介绍参见V大以及本站其他成员的一些介绍文章,我就不啰里啰唆的了)
PPPoE带来了好处,也带来了一些坏处,比如:二次封装耗费资源,降低了传输效能等等,这些坏处俺也不多说了,最大的坏处就是PPPoE导致MTU变小了以太网的MTU是1500,再减去PPP的包头包尾的开销(8Bytes),就变成1492。
如果两台主机之间的某段网络使用了PPPoE那么就会导致某些不能分片的应用无法通讯。
这个时候就需要我们调整一下主机的MTU,通过降低主机的MTU,这样我们就能够顺利地进行通讯了。
当然对于TCP应用而言还有另外的解决方案。
马上请出今天第三位猪脚:MSS。
MSS最大传输大小的缩写,是TCP协议里面的一个概念。
MSS就是TCP数据包每次能够传输的最大数据分段。为了达到最佳的传输效能TCP协议在建立连接的时候通常要协商双方的MSS值,这个值TCP协议在实现的时候往往用MTU值代替(需要减去IP数据包包头的大小20Bytes和TCP数据段的包头20Bytes)所以往往MSS为1460。通讯双方会根据双方提供的MSS值得最小值确定为这次连接的最大MSS值。
介绍完这三位猪脚s
我们回过头来看前言里面的那个问题,我们试想一下,如果我们在中间路由器上把每次TCP连接的最大MSS进行调整这样使得通过PPPoE链路的最大MSS值加上数据包头包尾不会超过PPPoE的MTU大小1492这样就不会造成无法通讯的问题.所以上面的问题可以通过ip tcp adjust-mss 1452来解决。
当然问题也可以通过修改PC机的MTU来解决。
[后记]
Cisco的TCP Adjust MSS Feature:
The TCP MSS Adjustment feature enables the configuration of the
maximum segment size (MSS) for transient packets that traverse a router,
specifically TCP segments in the SYN bit set, when Point to Point Protocol
over Ethernet (PPPoE) is being used in the network. PPPoE truncates the
Ethernet maximum transmission unit (MTU) 1492, and if the effective MTU
on the hosts (PCs) is not changed, the router in between the host and the
server can terminate the TCP sessions. The ip tcp adjust-mss command
specifies the MSS value on the intermediate router of the SYN packets to
avoid truncation.
俺太懒了就不翻译了。。自己慢慢看
[转自:http://www.net130.com/CMS/Pub/network/network_protocal/2005_09_22_97176.htm]
PHP5类实例教程【整理版】
看到一个类教程,感觉算是比较全面了,所以就整理成了word,需要的可以下载。
从OOP(面向对象)的视角看,不应区分语言。无论是C++、无论是Java、无论是.net还有更多面向对象的语言,只要你了解了OOP的真谛,便可以跨越语言,让你的思想轻松的跳跃。便没有对于Java、.net 、 PHP 之间谁强谁弱的争执了。
希望这个介绍PHP5面向对象编程(OOP)的资料能让初学者受益,能让更多的PHPer开始转向OOP的编程过程。
相对PHP4,PHP5在面向对象方面改变了很多。我们将只介绍PHP5环境下的面向对象。而我们必须改变自己来跟随PHP5的发展。如果代码结果在你的环境下执行不一致,请确认你的环境为PHP5。
我们假设读者没有任何面向对象的知识,即使你是第一次听说OOP,也可以读懂这文章。但我希望你必须对PHP有一些了解。
在后面我们将使用一些例子,来逐渐分析PHP5的OOP基础。
面向对象只解决了两个问题,代码的可扩展性、 代码的可维护性。




