ELLY66
16十/100

Matlab中的幽默

Matlab是一个科学计算的软件。我们数学系的小学期会专门学习这个软件。数学建模课需要用这个软件。数值计算也有专门的上机课操练它。在我心目中,它一直是一个一本正经的严肃的软件。直到今天。

NO.1 报错信息

Matlab中有一个函数reshape.可以把一个矩阵重新排列。例如,下列代码可以把4*4的方阵变成2*8的矩阵。

A=magic(4);
reshape(A,[2,8])

结果是:

ans =

    16     9     2     7     3     6    13    12
     5     4    11    14    10    15     8     1

 

明显,reshape的第二个参数你不能输入负数。如果在Matlab 2010a中输入负数:

A=magic(4);
reshape(A,[-2,-8])

报错:

??? Error using ==> reshape

Size vector elements should be nonnegative.

 

到这里,没有什么好玩的。但是,在Matlab 6.5.1中,这个错误信息是很有意思的。(这周四去学校机房上机的时候,我要试验一下。)下面的内容为Walking Randomly中的测试:

reshape(A,[-2,-8])

报错:

??? Error using ==> reshape

Don't do this again!.

哼。你不让我再来,我偏要来:

reshape(A,[-2,-8])

报错:

??? Error using ==> reshape

Cleve says you should be doing something more useful.

我偏偏就没事做。

reshape(A,[-2,-8])

报错:

??? Error using ==> reshape

Seriously, size arguments cannot be negative.

上面这个小幽默。在Matlab 2010a中已经不复存在了。下面说说两个Matlab 2010a还存在的小幽默

NO.2 spy

输入

spy

啦啦啦。。。会出现什么呢?点击查看

NO.3 why

输入

why

到底会出来什么呢?这个要看你RP的!以下是一下我得到的回答:

  • To fool the tall good and smart system manager.
  • The rich rich and tall and good system manager suggested it.
  • He wanted it that way.
  • The programmer suggested it.
  • Barney suggested it.
  • To please a very terrified and smart and tall engineer.
  • The tall system manager obeyed some engineer.
  • To satisfy some programmer.
  • Damian wanted it that way.
  • Can you rephrase that?
  • Because Damian wanted it that way.
  • How should I know?
  • Because they asked the terrified and smart and tall and tall programmer.
  • To fool a young tall hamster(仓鼠).
  • For the love of a bald and terrified mathematician.
  • It's your karma.
  • Some terrified and rich system manager knew it was a good idea.
  • Don't you have something better to do?
  • …………………………………………

Reference:

Walking Randomly的Has MATLAB lost its sense of humour?

原创文章,转载请注明: 转载自ELLY66

本文链接地址: Matlab中的幽默

文章的脚注信息由WordPress的wp-posturl插件自动生成

Evernote lets you save all the interesting things you see online into a single place. Access all those saved pages from your computer, phone or the web. Sign up now or learn more. It's free!

 
评论 (0) 引用 (0)

还没有评论.


Leave a comment

(required)

还没有引用.

Switch to our mobile site