1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

参考ページ

準備

オンラインコンパイラを使用します。

ソースコード

sample.py
import numpy as np

def riemann_zeta(s, num_terms=100000):
    """リーマンゼータ関数 ζ(s) を計算する"""
    zeta = 0.0
    for n in range(1, num_terms + 1):
        zeta += 1 / (n**s)
    return zeta

# 使用例
s_real = 0.5
s_imag = 14.135
s = complex(s_real, s_imag)  # 複素数を代入
result = riemann_zeta(s)
print(f'ζ({s}) = {result}')


実行結果

console
ζ((0.5+14.135j)) = (-12.479784978425174+18.551166454741747j)

[Execution complete with exit code 0]

1
1
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
1
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?