清水建設のマークwww
フジテレビのマークwww
目ん玉関連の連中はろくでなしばかりwww
- XSS (クロスサイトスクリプティング)
- SQLインジェクション
- LDAPインジェクション
- コードインジェクション
- OSコマンドインジェクション
- メールヘッダーインジェクション
- Nullバイトインジェクション
- サイズ制限の無いファイルアップロード
- 拡張子制限の無いファイルアップロード
- オープンリダイレクト可能なログイン画面
- ブルートフォース攻撃可能なログイン画面
- セッション固定攻撃可能なログイン画面
- 親切過ぎる認証エラーメッセージ
- 危険なファイルインクルード
- パストラバーサル
- 意図しないファイル公開
- CSRF (クロスサイトリクエストフォージェリ)
- クリックジャッキング
- XEE (XMLエンティティ拡張)
- XXE (XML外部エンティティ)
web入力フォームに何か不正な文字やプログラムを入力することによってパスワード等が丸見えになってしまうようなことができるのでは?と以前から思っていた。
虚数の階乗も、ガンマ関数 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="normal">Γ</mi><mo stretchy="false">(</mo><mi>z</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">\Gamma(z)</annotation></semantics></math> を用いることで計算することができます。複素数全体に階乗を拡張するために、ガンマ関数は非常に重要です。
1. ガンマ関数の一般定義(複素数にも対応)
ガンマ関数は複素数 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>z</mi></mrow><annotation encoding="application/x-tex">z</annotation></semantics></math> に対しても以下の積分で定義されます:
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mi mathvariant="normal">Γ</mi><mo stretchy="false">(</mo><mi>z</mi><mo stretchy="false">)</mo><mo>=</mo><msubsup><mo>∫</mo><mn>0</mn><mi mathvariant="normal">∞</mi></msubsup><msup><mi>t</mi><mrow><mi>z</mi><mo>−</mo><mn>1</mn></mrow></msup><msup><mi>e</mi><mrow><mo>−</mo><mi>t</mi></mrow></msup><mtext> </mtext><mi>d</mi><mi>t</mi></mrow><annotation encoding="application/x-tex">\Gamma(z) = \int_0^{\infty} t^{z-1} e^{-t} \,dt</annotation></semantics></math>階乗は次の関係で表せます:
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mi>z</mi><mo stretchy="false">!</mo><mo>=</mo><mi mathvariant="normal">Γ</mi><mo stretchy="false">(</mo><mi>z</mi><mo>+</mo><mn>1</mn><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">z! = \Gamma(z+1)</annotation></semantics></math>2. 虚数の階乗の具体例
虚数 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>i</mi></mrow><annotation encoding="application/x-tex">i</annotation></semantics></math>(虚数単位)の階乗 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>i</mi><mo stretchy="false">!</mo></mrow><annotation encoding="application/x-tex">i!</annotation></semantics></math> を求める場合、ガンマ関数で計算できます。
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mi>i</mi><mo stretchy="false">!</mo><mo>=</mo><mi mathvariant="normal">Γ</mi><mo stretchy="false">(</mo><mi>i</mi><mo>+</mo><mn>1</mn><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">i! = \Gamma(i + 1)</annotation></semantics></math>この積分は解析的に計算できますが、非常に複雑な値を持つため、一般的には数値計算ソフトウェアを使って求めます。
3. Pythonで虚数の階乗を計算する方法
Pythonの scipy
ライブラリを使用して、複素数の階乗を計算する例です。
from scipy.special import gamma
import cmath
# 虚数単位の階乗を計算
z = 1j # 虚数単位
factorial_z = gamma(z + 1)
print(f"{z}! =", factorial_z)
出力結果の例:
1j! = (0.4980156681183561-0.1549498283018107j)
4. 複素数の階乗の可視化
複素平面上でガンマ関数の絶対値や偏角を視覚化すると、美しいフラクタル模様が現れます。特に極が現れる点(負の整数)は、ガンマ関数の特異点です。
5. ガンマ関数の特異点と複素数階乗の注意点
- 負の整数ではガンマ関数は発散(無限大)します。
- 複素数の階乗は多価関数ではなく、一価関数です(ガンマ関数自体が一価関数)。
6. まとめ
- 虚数の階乗はガンマ関数で定義され、<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>z</mi><mo stretchy="false">!</mo><mo>=</mo><mi mathvariant="normal">Γ</mi><mo stretchy="false">(</mo><mi>z</mi><mo>+</mo><mn>1</mn><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">z! = \Gamma(z+1)</annotation></semantics></math> で計算可能。
- 負の整数では未定義(ガンマ関数が特異点を持つ)。
- Pythonのscipyで複素数の階乗計算が可能 (
scipy.special.gamma
)。
小数の階乗は、**ガンマ関数**を使って求めることができます。ガンマ関数は、通常の階乗を連続的に拡張したものです。
負の数の階乗は、通常の整数の階乗のように直接計算することはできません。しかし、階乗を拡張したガンマ関数を用いることで、負の数の階乗を一般化できます。
1. 階乗の定義とガンマ関数
階乗は自然数 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>n</mi></mrow><annotation encoding="application/x-tex">n</annotation></semantics></math> に対して次のように定義されます:
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mi>n</mi><mo stretchy="false">!</mo><mo>=</mo><mi>n</mi><mo>×</mo><mo stretchy="false">(</mo><mi>n</mi><mo>−</mo><mn>1</mn><mo stretchy="false">)</mo><mo>×</mo><mo>…</mo><mo>×</mo><mn>1</mn></mrow><annotation encoding="application/x-tex">n! = n \times (n-1) \times \ldots \times 1</annotation></semantics></math>これを一般化したガンマ関数 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi mathvariant="normal">Γ</mi><mo stretchy="false">(</mo><mi>z</mi><mo stretchy="false">)</mo></mrow><annotation encoding="application/x-tex">\Gamma(z)</annotation></semantics></math> は、複素数領域で以下の積分によって定義されます:
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mi mathvariant="normal">Γ</mi><mo stretchy="false">(</mo><mi>z</mi><mo stretchy="false">)</mo><mo>=</mo><msubsup><mo>∫</mo><mn>0</mn><mi mathvariant="normal">∞</mi></msubsup><msup><mi>t</mi><mrow><mi>z</mi><mo>−</mo><mn>1</mn></mrow></msup><msup><mi>e</mi><mrow><mo>−</mo><mi>t</mi></mrow></msup><mtext> </mtext><mi>d</mi><mi>t</mi></mrow><annotation encoding="application/x-tex">\Gamma(z) = \int_0^{\infty} t^{z-1} e^{-t} \,dt</annotation></semantics></math>この関数は、正の整数 <math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mi>n</mi></mrow><annotation encoding="application/x-tex">n</annotation></semantics></math> に対して次の性質を持ちます:
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mi mathvariant="normal">Γ</mi><mo stretchy="false">(</mo><mi>n</mi><mo stretchy="false">)</mo><mo>=</mo><mo stretchy="false">(</mo><mi>n</mi><mo>−</mo><mn>1</mn><mo stretchy="false">)</mo><mo stretchy="false">!</mo></mrow><annotation encoding="application/x-tex">\Gamma(n) = (n-1)!</annotation></semantics></math>これにより、ガンマ関数は連続的に階乗を拡張しています。
2. 負の数の階乗の定義
負の整数以外の負の数に対して、次のように定義されます:
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mo stretchy="false">(</mo><mo>−</mo><mi>n</mi><mo stretchy="false">)</mo><mo stretchy="false">!</mo><mo>=</mo><mfrac><mrow><mi mathvariant="normal">Γ</mi><mo stretchy="false">(</mo><mo>−</mo><mi>n</mi><mo>+</mo><mn>1</mn><mo stretchy="false">)</mo></mrow><mn>1</mn></mfrac></mrow><annotation encoding="application/x-tex">(-n)! = \frac{\Gamma(-n+1)}{1}</annotation></semantics></math>ただし、負の整数ではガンマ関数は特異点(無限大になる点)を持つため、定義されません。
例:<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo>−</mo><mfrac><mn>1</mn><mn>2</mn></mfrac><mo stretchy="false">!</mo></mrow><annotation encoding="application/x-tex">-\frac{1}{2}!</annotation></semantics></math> の計算
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mi mathvariant="normal">Γ</mi><mrow><mo fence="true">(</mo><mfrac><mn>1</mn><mn>2</mn></mfrac><mo fence="true">)</mo></mrow><mo>=</mo><msqrt><mi>π</mi></msqrt></mrow><annotation encoding="application/x-tex">\Gamma\left(\frac{1}{2}\right) = \sqrt{\pi}</annotation></semantics></math>したがって、<math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mo>−</mo><mfrac><mn>1</mn><mn>2</mn></mfrac><mo stretchy="false">!</mo></mrow><annotation encoding="application/x-tex">-\frac{1}{2}!</annotation></semantics></math> は次のようになります:
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mo>−</mo><mfrac><mn>1</mn><mn>2</mn></mfrac><mo stretchy="false">!</mo><mo>=</mo><mfrac><msqrt><mi>π</mi></msqrt><mn>2</mn></mfrac></mrow><annotation encoding="application/x-tex">-\frac{1}{2}! = \frac{\sqrt{\pi}}{2}</annotation></semantics></math>3. 負の整数の階乗は未定義
負の整数の場合、ガンマ関数は**極(無限大)**となるため、計算不可能です。
例:
<math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><semantics><mrow><mi mathvariant="normal">Γ</mi><mo stretchy="false">(</mo><mn>0</mn><mo stretchy="false">)</mo><mo>=</mo><mi mathvariant="normal">∞</mi><mo separator="true">,</mo><mspace width="1em"></mspace><mi mathvariant="normal">Γ</mi><mo stretchy="false">(</mo><mo>−</mo><mn>1</mn><mo stretchy="false">)</mo><mo>=</mo><mi mathvariant="normal">∞</mi></mrow><annotation encoding="application/x-tex">\Gamma(0) = \infty,\quad \Gamma(-1) = \infty</annotation></semantics></math>4. Pythonでの計算例(scipy使用)
Pythonの scipy
ライブラリを使って負の数の階乗を計算する例です:
from scipy.special import gamma
# -0.5の階乗を計算
n = -0.5
factorial_neg = gamma(n + 1)
print(f"{n}! =", factorial_neg)
出力
-0.5! = 1.7724538509055159 # ≈ √π
5. まとめ
- 負の整数の階乗は未定義(無限大)。
- 負の非整数の階乗はガンマ関数で計算可能。
- Pythonのscipyで計算可能(
scipy.special.gamma
)。