2008-06-01から1ヶ月間の記事一覧

曲線で遊ぼう4

トーラス結び目 自由変数がとても多いです。 a=1, b=0, c=1, p=1, q=1 これだと何の変哲もないただの円を描くだけです。値を少しいじると、 a=8, b=3, c=5, p=2, q=5 すこし歪んできます。これでもよくわからないので、もう少し値を極端にとってみましょう。…

曲線で遊ぼう3

ベルヌーイのレムニスケート 無限大の形を書きます。 a=2,4,6,8を同時に で、毎度のごとく1つの関数にしてみました。単純なインクリメントのfor文なら、floor関数で代用できる場合が多いです。 これでめでたく1つの式に。 なんかうねうね ちゃんとした名前が…

Project Euler 10

The sum of the primes below 10 is 2 + 3 + 5 + 7 = 17. Find the sum of all the primes below two million.

Project Euler 9

A Pythagorean triplet is a set of three natural numbers, a < b < c, for which, a^2 + b^2 = c^2 For example, 3^2 + 4^2 = 9 + 16 = 25 = 5^2. There exists exactly one Pythagorean triplet for which a + b + c = 1000. Find the product abc.

Project Euler 8

Find the greatest product of five consecutive digits in the 1000-digit number. 7316717653133062491922511967442657474235534919493496983520312774506326239578318016984801869478851843858615607891129494954595017379583319528532088055111254069874…

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?

Project Euler 6

The sum of the squares of the first ten natural numbers is, 1^2 + 2^2 + ... + 10^2 = 385 The square of the sum of the first ten natural numbers is, (1 + 2 + ... + 10)^2 = 55^2 = 3025 Hence the difference between the sum of the squares of t…

Project Euler 5

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 number that is evenly divisible by all of the numbers from 1 to 20?

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 numbers.

Project Euler 3

The prime factors of 13195 are 5, 7, 13 and 29. What is the largest prime factor of the number 600851475143 ?

Project Euler 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, ... Find the sum of all the even-valued terms in the sequence w…

Project Euler 1

Project Eulerというものを見つけました。 プログラムを使って解く数学の問題集、のようなものらしいです。登録をするときに、自分の国や使用する言語を入力します。 言語入力のところに「Pencil/Paper」って選択肢があるんだけど・・・・・・。Mathematica…

曲線で遊ぼう2

前回の続きです。

曲線で遊ぼう1

プログラムでオブジェクトを動かしたいときなど、線形や円運動などの数式を入れて動かしたりしますが、もう少し複雑な動きをさせるために、いろいろな曲線関数を使って動かしてみましょう。 いろいろある曲線を描く関数を紹介します。

Cライクな使い方

MathematicaでもCや他の手続き型言語のように、for文を回して、各値ごとに答えを出したいときなどがあるでしょう。 二重ループを簡単に書いてみました。

ブラックジャック・カードカウンティング

「ラスベガスをぶっつぶせ」(原題「21」)という映画を見てきました。 ブラックジャックをカウンティングという手法を用いてプレイし、大儲けしたMITの学生の実話を映画にしたものです。一緒に見に行った人たちが「カウンティングがよくわからなかった」とい…

多項式電卓プログラム

actionScriptの練習ということで、多項式の四則演算ができる電卓を自力で作ってみました。 かっこ()にも対応しています。 ちょっとがんばったのは、キーボードから入力しても答えを出すことができます。 まだバグがあると思われるので、どういう式がエラーを…