2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 1 year has passed since last update.

数列1,1,4,5,1,4の一般項を求める

Last updated at Posted at 2020-12-26

問題

\displaylines{
f(0) = 1 \quad f(1) = 1 \quad f(2) = 4 \\
f(3) = 5 \quad f(4) = 1 \quad f(5) = 4
}

を満たす多項式関数$f(x) \ (x \in \{ 0, 1, 2, 3, 4, 5 \})$を求めよ。

求める

$x \in \{ 0, 1, 2, 3, 4, 5 \}$として

\displaylines{
f(x) = g_0(x) + g_1(x) + 4g_2(x) + 5g_3(x) + g_4(x) + 4g_5(x) \ \cdots i

\\ \\

g_0(x) = \left\{
\begin{array}{ll}
1 & (x = 0) \\
0 & (x \neq 0)
\end{array}
\right.

\quad

g_1(x) = \left\{
\begin{array}{ll}
1 & (x = 1) \\
0 & (x \neq 1)
\end{array}
\right.

\quad

g_2(x) = \left\{
\begin{array}{ll}
1 & (x = 2) \\
0 & (x \neq 2)
\end{array}
\right.

\\

g_3(x) = \left\{
\begin{array}{ll}
1 & (x = 3) \\
0 & (x \neq 3)
\end{array}
\right.

\quad

g_4(x) = \left\{
\begin{array}{ll}
1 & (x = 4) \\
0 & (x \neq 4)
\end{array}
\right.

\quad

g_5(x) = \left\{
\begin{array}{ll}
1 & (x = 5) \\
0 & (x \neq 5)
\end{array}
\right.
}

上記の多項式関数$f$は問題の解を満たす。
よって多項式関数$g_n \ (n \in \{ 0, 1, 2, 3, 4, 5 \})$を求めればよい。

せっかちなのでいきなり解を書くが、以下の多項式関数は求めている$g_n$を満たす。

g_n(x) = \frac{x(x-1)(x-2)(x-3)(x-4)(x-5)}{(-1)^{5-n}n!(5-n)!(x-n)}

\quad (n \in \{0, 1, 2, 3, 4, 5\}) \ \cdots ii
確認用プログラム(ES6)
const fact = x => x === 0 ? 1 : x * fact(x - 1);

function g(n) {
    return function(x) {
        let bunsi = 1;
        for (let i = 0; i <= 5; i++) {
            if (i !== n) bunsi *= x - i;
        }
        const bunbo = Math.pow(-1, 5 - n) * fact(n) * fact(5 - n);
        return bunsi / bunbo;
    }
}

for (let n = 0; n <= 5; n++) {
    const gn = g(n)
    for (let x = 0; x <= 5; x++) {
        const rtn = gn(x);
        if (rtn === (x === n ? 1 : 0)) console.log(`g(${n})(${x}) -> ${rtn}: やりますねえ!`);
        else console.log(`g(${n})(${x}) -> ${rtn}: ダメみたいですね・・・`);
    }
}

実行結果は省略

$i, ii$より

f(x) = \frac{1}{120}(13x^5 - 120x^4 + 295x^3 - 60x^2 - 128x + 120)
確認用プログラム(ES6)
const yaju = x => (13 * Math.pow(x, 5) - 120 * Math.pow(x, 4) + 295 * Math.pow(x, 3) - 60 * Math.pow(x, 2) - 128 * x + 120) / 120;

console.log(yaju(0)); // 1
console.log(yaju(1)); // 1
console.log(yaju(2)); // 4
console.log(yaju(3)); // 5
console.log(yaju(4)); // 1
console.log(yaju(5)); // 4

以上より野獣先輩は多項式関数である。
Q.E.D 証明終了

あとがき

昔、某掲示板で以下のプログラムを見て感銘を受け、感化されて今回の数式を求めました。

#include<stdio.h>
#include<math.h>
int main()
{
	int i;
	double t;
	for (i=0;i<10;i++) { 
		t = 0.6283*i; 
		putchar(77+7*cos(t+3)+cos(t*2+4.6)+cos(t*3+4)+3.4*cos(t*4+0.3)); 
	} 
	return 0;
}

何度見てもすごい。どうやってこの数式を求めたのか分からない。

(追記)
↑の元ネタを発見

2
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
2
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?