抄一堆Fortran语录 ZZ

CITED FROM http://en.wikipedia.org/wiki/Fortran#FORTRAN_quotations

 

FORTRAN quotations

For a programming language with a half-century legacy, FORTRAN not surprisingly has accumulated its share of jokes and folklore.

 

[edit] From the historical record

  • God is Real, unless declared Integer. J. Allan Toogood, FORTRAN programmer.[15]
  • FORTRAN, the infantile disorder, by now nearly 20 years old, is hopelessly inadequate for whatever computer application you have in mind today: it is now too clumsy, too risky, and too expensive to use.Edsger Dijkstra, circa 1970.
  • "The sooner the world forgets that FORTRAN ever existed, the better." (imputed to Joseph Weizenbaum)
  • "95 percent of the people who programmed in the early years would never have done it without Fortran."Ken Thompson, circa 2005[16]
  • "The primary purpose of the DATA statement is to give names to constants; instead of referring to pi as 3.141592653589793 at every appearance, the variable PI can be given that value with a DATA statement and used instead of the longer form of the constant. This also simplifies modifying the program, should the value of pi change." —Early FORTRAN manual for Xerox Computers[17]
  • "Consistently separating words by spaces became a general custom about the tenth century A.D., and lasted until about 1957, when FORTRAN abandoned the practice."Sun FORTRAN Reference Manual
  • "People are very flexible and learn to adjust to strange surroundings — they can become accustomed to read Lisp and Fortran programs, for example."Art of PROLOG, Leon Sterling and Ehud Shapiro, MIT Press
  • "Warning: Go directly to Jail. Do not pass GO. Do not collect $200."Easter egg in the SDS/Xerox Sigma 7 FORTRAN compiler, when the statement GO TO JAIL was encountered. The message is from a Chance card in Monopoly.
  • "A computer without COBOL and FORTRAN is like a piece of chocolate cake without ketchup or mustard." — a fortune cookie from the Unix program fortune.

 

[edit] References in popular culture

  • Computer folklore has incorrectly attributed the loss of the Mariner 1 space probe to a typographical error in a Fortran program. For example, "Recall the first American space probe to Venus, reportedly lost because Fortran cannot recognize a missing comma in a DO statement…"[18].
  • In 1982, 10,000 Maniacs released a song named "Planned Obsolescence" that includes the repeated line — "Science [is] truth for life, in Fortran tongue the answer".

Viktor的Fortran手记之三 风格、选择与效果

 

implicit none

 

 

以绕过I--N规则。(呵呵,一句名言,"God is Real until claimed as Integer. "嗯……然则min一类习惯的名字就要小心了……)

  • 在subroutine和function里,所有的local var.都默认是STORE的。什么意思呢?比如说,
    function xxoo(...)
        ...
        integer :: ooxx = 1
        ...

        ooxx = ooxx + 1
       
        ...
    end function xxoo

只有第一次xxoo(...)的时候,ooxx才是1.以后就会变成2,3,4,5,……如果要避免这个副作用,就得写

 

function xxoo(...)
    ...
    integer :: ooxx
    ...

    ooxx = 1 !Here to initialize ooxx
   
    ...
end function xxoo

C里面可是默认全都毁掉的,不要混了……

  • 有的地方说inout要写成in out,goto要写成go to,然则得视编译器而定。
  • 注释写感叹号,续行就用&,从第9列写起(兼容Tab和古典FORTRAN格式)。第5列(按一个Tab)写行号的个位。第6列一定要让它空着!除非续行的时候,可以写&。需要兼容性的时候,这是必须的。
  • 虽然新Fortran支持长名字,然则还是写6字符以内的短名比较好。小猫见过hankei和takasa之类诡异的名字……
  • 循环里严格禁止改循环变量:
    do i = 1, n
        i = exFlag !Compile error!
        ...
    end do
  • 最应该记住的,是调用function的时候得事先在块中声明……
  • module是个好东西,声明什么的都可以往里装。还可以用它实现运算符重载和多态函数……C++用的是类,这里用的就是TYPE……

Viktor的Fortran手记之二 从FORTRAN到Fortran

(接上回……)

话说搞到了编译器之后,才发现全是F90的编译器。而且在科学界使Fortran的人也不少。据说Fortran在数值算法里也比C快一点。从77改成90吧。大字的FORTRAN也改成了小字的Fortran.

编译器嘛,是IFC和CFC。CFC太老了,95年的,很怀旧,但是在Vista下好歹还能正常工作,除了没办法运行和调试之外。IFC要嵌入到VS里用。Compaq也出过一版VFC,那个要嵌到VS 6里的,偶没装VS 6,当然要报错啦……

续行一律用&。什么第6列用+的办法,恐怕已经土偶了吧……

所谓Vector Subscription和Segment很有意思。然则CFC对Segment的处理不是很好。

do 9, **** 之类的文法已经obsolute了……同样还有character*9之类。

比C省事的地方是数组可以整个处理。还有Implied DO,也是个很好的特性。

其实VB的一些特性和Fortran是相通的。比如块结构的IF。

做C太久了,写if的时候总是忘then.

还有C里{}搞定的东西在Fortran中却要有专门的符号……

 

搞来了编译器,做了课本上的几个题目。要尝试一下Windows开发。

 

 

Viktor的FORTRAN手记之一 引子

Viktor其实也刚刚入门……要不是做科学,纯开发的话Viktor一辈子也不会碰这东西……先说说FORTRAN和C不一样的几个地方吧……目前Viktor还停留在纸上谈兵的阶段,因为暂时找不到Vista下好用的FORTRAN编译器……最近几天也在一直找。经典的Visual Fortran就是不和Vista兼容……总不能因为这点破事开个虚拟机吧……卡到在其次,怕的主要是发热。

  1. 不用打;以结束语句。
  2. 实用的语句要空六格。也就是说,得打上六个空格才能开门见山……好像也不要写到70列还是什么的……续行怎么续来着?
  3. 行首打*表示注释。
  4. 程序的第一行一定是
    program ooxx
  5. 做完的时候还得
    stop

    end
  6. 调用子程序要
    call xxoo
  7. 子程序还得写成
    subroutine xxoo
        ...
        return
    end
  8. 打印居然要加个"*,",还得用print,而且更神奇的是自动换行。
  9. 名字不许超过6个字母。
  10. 传统中的I~N规则……I,J,K,L,M,N打头的是整数……
  11. 有乘方运算符……然则要写成**……
  12. 除法取整时一律向下取整。
  13. DO循环要写出CONTINUE的行号……DO 100 I=1,5
  14. 整数叫integer
  15. 字符串和字符居然一样……声明要写
    character*5 ooxxx
  16.  更强大的是居然用单引号围住字符串(而不是C中的双引号)……

图像形态学的开操作和闭操作

明天考试用

 

开操作是先减后加(术语叫先腐蚀后膨胀,不管啦……)

 

闭操作是先加后减

 

真犯迷糊的时候,记得开字的写法,先写“-”后写“+”就想起来了……

 

Hit和Miss都是用的减法(很理解)

 

加法是直接叠合,而减法是找能容得下模板的地方……

 

其实加法的定义不是直接叠合,而是要先求对称再什么玩意……然则算的时候都是直接叠合,其中奥妙,颇有反弹琵琶之意味。

VC++ 2005里CFile类ReadHuge和WriteHuge废了

统一转入Read()和Write(),望周知。

 

The process of atmospheric scattering, deflects light rays from a straight path and thus causes blurring or haziness. It affects the blue end of the visible spectrum more than the red end, and consequently the blue waveband is not used in many remote-sensing systems.

为灾区默哀

5月19日至5月21日为全国哀悼日。

停止公共娱乐活动。

5月19日14时28分起,全国人民默哀3分钟。

我靠,大囧~

好不容易找个能用的代理登到Wiki...

 

连number theory都成了关钅建字……

 

靠……正在考虑转向直通厕所……

关于素数分布的一点MEMO(转载,轻拍)

素数定理(Legendre, Gauss, 1800)

\pi(x)\sim\frac{x}{\ln(x)}

复变函数的证明 J.Hadamard, Poussin 1896

初等证明 Selberg & Erd\"os, 1949

Riemann的假设是个大长篇

查Britannica上写得太简明,连个式子都没给

Wiki这几天穿不出去。。。

hyperref包很有用

是造左边那个索引的……i了……

**********************************************************

以后还是写^\prime吧,'特别不靠谱……