2011-01-01から1年間の記事一覧

iPad2を一週間ほど使ってみて

いろいろソフトをインストールしたところ、iPad専用ソフト、iPadとiPhoneと両対応するソフト、iPhone用のソフトの三種類があることがわかった。両対応のソフトはひとつのパッケージに別個のソフトが入っているイメージ。リソースのいくつかは共有してるのか…

iPad2が届いて3時間ほど使ってみた感想

薄いけど微妙に重い。 ソフトウェア・キーボードは思ったよりもスムーズに入力できる。 とりあえずi文庫HDとGood Readerを購入。あとはiPhoneで買ったソフトを使うなど。 Good Readerが便利すぎる。iBooksもStanzaもKindleもi文庫HDもいらないかも、という雰…

自分のところでEmacsコンパイルしてみたものの・・・

銭谷氏のCarbon Emacsは何の問題もなく使えているのですが、目新しいものを使ってみたくなったので、Cocoa Emacsを試してみることにしました。海上氏の記事を参考に、現時点での最新版であるEmacs 23.3をダウンロードしてきて、インラインパッチをあててコン…

正規分布の累積分布関数の近似式

昨日、Common Lispで正規分布の累積分布関数を作成しました。テイラー展開された式でいちいち計算するものですが、もっと単純で高精度な近似式があれば、そのほうが計算速度も向上します。ちょっと探してみたところ、以下のようなものがよく使われるとのこと…

Octaveでの実装を参考にCommon Lispで正規分布の累積分布関数を計算

(2023-01-23追記:正規分布の計算を見直してみました →正規分布の確率密度関数と累積分布関数の計算 - 丸井綜研)正規分布の確率密度関数は定義通りに ;; Normal Distribution ;; (normpdf 2 0 1) => 0.05399096581690089 ;; (defun normpdf (x mu sigma) (…

Project Euler No.14

数日ぶりにProject Euler。第14問。 The following iterative sequence is defined for the set of positive integers:n -> n/2 (n is even) n -> 3n + 1 (n is odd)Using the rule above and starting with 13, we generate the following sequence:13 -> 4…

Octave 3.4.0 for Mac OS Xのgnuplot同梱版

SourceForgeで公開されているMac OS X用のOctave 3.4.0の2011-04-08版にはgnuplotが入っておらず、plotなどが使えません。それに応える形で、現在のメンテナーであるJulien Salort氏のサイトでgnuplot同梱版が公開されました。2011-04-21版が本日時点での最…

MP3は元音源からサンプルずれするのか

MP3のエンコード/デコード時にどのくらいもとの音源からサンプルずれがあるのかを調べてみました。方法は、インパルスが1発だけ入ったWAVファイルをLAME 3.98.4で符号化し、同じくLAMEで復号化、そしてインパルス周辺部だけを拡大して見てみる、というもの。…

配列を宣言してから中身を入れると速い

「R in a Nutshell」を読み進んでいます。第8章に、配列というのはあらかじめメモリを確保してから中身を入れた方が速いということが説明されています。たとえば create.vector.of.ones <- function(n) { return.vector <- NA; for (i in 1:n) { return.vect…

Project Euler No.13

Project Euler第13問。 Work out the first ten digits of the sum of the following one-hundred 50-digit numbers.(数表省略)以下に100桁の数が50個ある。すべて加算したときに、最上位の10桁の数は何か。 これはMatlabではラクチン。この程度の桁数なら問…

Project Euler No.12

Project Euler続き。12問目。 The sequence of triangle numbers is generated by adding the natural numbers. So the 7th triangle number would be 1 + 2 + 3 + 4 + 5 + 6 + 7 = 28. The first ten terms would be:1, 3, 6, 10, 15, 21, 28, 36, 45, 55, …

Project Euler No.11

Project Eulerの11問目。 In the 2020 grid below, four numbers along a diagonal line have been marked in red.(数表省略)The product of these numbers is 26 × 63 × 78 × 14 = 1788696.What is the greatest product of four adjacent numbers in any d…

Project Euler No.10

さてさて第10問目のProject Euler。 The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17.Find the sum of all the primes below two million.10未満の素数の和は17である。2百万未満の全素数の和はいくつか。 Matlabにはprimes関数があるので楽勝です。…

Project Euler No.9

次々行くよ。Project Eulerの9問目。 A Pythagorean triplet is a set of three natural numbers, a b c, for which,a2 + b2 = c2 For example, 32 + 42 = 9 + 16 = 25 = 52.There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find…

Project Euler No.8

引き続きProject Eulerの8問目。 Find the greatest product of five consecutive digits in the 1000-digit number.73167176531330624919225119674426574742355349194934 96983520312774506326239578318016984801869478851843 8586156078911294949545950173…

Project Euler No.7

MatlabでProject Eulerを解く第7問。 By listing the first six prime numbers: 2, 3, 5, 7, 11, and 13, we can see that the 6th prime is 13.What is the 10001st prime number?最初の6つの素数を並べると2、3、5、7、11、13となる。6番目の素数は13だと…

Project Euler No.6

Project EulerをMatlab/Octaveで解く6問目。いったい何問あるんだ、これ? The sum of the squares of the first ten natural numbers is,12 + 22 + ... + 102 = 385 The square of the sum of the first ten natural numbers is,(1 + 2 + ... + 10)2 = 552 …

Project Euler No.5

引き続きProject EulerをMatlab/Octaveで解いてます。 2520 is the smallest number that can be divided by each of the numbers from 1 to 10 without any remainder.What is the smallest positive number that is evenly divisible by all of the number…

Project Euler No.4

Project Eulerの第4問は「数字の回文」。 A palindromic number reads the same both ways. The largest palindrome made from the product of two 2-digit numbers is 9009 = 91 × 99.Find the largest palindrome made from the product of two 3-digit nu…

Project Euler No.3

Project Eulerの問題をMatlab/Octaveで解いてみる3問目。 The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ?13195の素因数は5、7、13、29である。600851475143の素因数のうち最大のものは何…

Project Euler No.2

Project Eulerの問題をMatlabで解いてみる2問目。 Each new term in the Fibonacci sequence is generated by adding the previous two terms. By starting with 1 and 2, the first 10 terms will be:1, 2, 3, 5, 8, 13, 21, 34, 55, 89, ...By considering…

Project Euler No.1

Project Eulerはコンピュータで解くための問題集を公開しているサイトです。その第1問目をMatlabでやってみました。Octaveでも動きます。 If we list all the natural numbers below 10 that are multiples of 3 or 5, we get 3, 5, 6 and 9. The sum of the…

相互相関と畳み込み

相互相関と畳み込みは処理が似ているので、どちらかを使ってもう一方を計算できないかと考えた。で、Matlabで実験したところ、xcorr(a, b)はconv(a, flipud(b))と同じだということがわかった。convの代わりにFFTを用いて処理してみたが*1、xcorrのほうが若干…

Parallels Desktop 6にWindows 2000をインストール

Windows 7をBoot Campで使っていたんですが、どことなく気にくわなかったので、Parallels Desktop 6にWindows 2000のインストールをしました。インストールディスクを仮想マシンで起動すると STOP: 0x0000001E ... KMODE_EXCEPTION_NOT_HANDLEDというメッセ…

GXR購入

Ricoh GXR+Ricoh Lens P10 28-300mm F3.5-5.6 VC購入。S10レンズユニットと迷ったものの、(1)A12 28mmを購入予定であること(高画質はA12まかせにできる)、(2)APS-Cサイズの28-100mm程度のユニットが開発予定という噂があること(ズーム域がS10とかぶる)、…

自転車購入

バイクを売って、その返す刀で自転車購入。通勤仕様チャリです。暗くなると自動で灯りがつくし、オプションで自動パンク穴塞ぎジェルも注入したし、なんか15年ほど自転車に乗らなかった間にいろいろと進化してるんですね。バイクについてはまた乗れる環境が…

Kawasaki Versys売却

本日、バイクワンとバイクボーイの2社に競っていただき*1、Versysを売却。就職して1年目に買った思い出の一台でしたが、2009年8月に乗ったのを最後に、その後は忙しかったりなんだったりで全く乗れていなかったのでした。僕のところで動けないままでいるより…

Snow Leopard(およびLeopard)でOctave.appを動かす

Octave Forgeで配布されているOctaveのMac OS Xバイナリがありますが、2009年10月に作成されたものが現時点での最新版で、Mac OS X 10.6.5 Snow Leopardおよび10.5.8に対応していません。そのため、Gnuplotを用いたグラフのプロットなどができなくなっていま…

MBAが欲しい

MacBook Air 11インチ欲しい!と書くといいという噂を聞いたので、書いておきます。

Googleが使っているプログラミング言語

どのプログラミング言語を使うと良いのだろうかと考えるとき、「あのGoogleも使う言語なので安心」といった雰囲気があったりしますが、Googleで使われている言語にはどのようなものがあるのでしょうか?AndroidはJavaでアプリ開発するらしいですし、おそらく…