SST Lab Dokuwiki Header header picture

ユーザ用ツール

サイト用ツール


lectures:numeric15

差分

このページの2つのバージョン間の差分を表示します。

この比較画面へのリンク

次のリビジョン
前のリビジョン
最新のリビジョン両方とも次のリビジョン
lectures:numeric15 [2023/01/24 22:33] – 作成 kimilectures:numeric15 [2023/01/24 23:02] – [数値積分] kimi
行 18: 行 18:
 $$ $$
  
-* $N分割して$$L$重積分を行うためには$N^L$回の和の計算が必要 +  * $N$分割して$L$重積分を行うためには$N^L$回の和の計算が必要 
-* $L=100$ならば$N=2$でも $2^{100}\simeq 10^{30}$回の和が必要 +  * $L=100$ならば$N=2$でも $2^{100}\simeq 10^{30}$回の和が必要 
-* 1PFLOPSの計算機=毎秒$10^{15}$回の実数計算が可能 +  * 1PFLOPSの計算機=毎秒$10^{15}$回の実数計算が可能 
-* 1年が$3\times 10^{7}$秒なので$10^{30}\div 10^{15}\div (3\times 10^{7}) = 0.3\times 10^{8}$年 +  * 1年が$3\times 10^{7}$秒なので$10^{30}\div 10^{15}\div (3\times 10^{7}) = 0.3\times 10^{8}$年 
-* 1PFLOPSの計算機でも3000万年かかる → **モンテカルロ法**+  * 1PFLOPSの計算機でも3000万年かかる → **モンテカルロ法** 
 + 
 + 
 +===== 数値積分 ===== 
 + 
 +$$ 
 +\int_a^bf(x)dx\simeq\sum_{k=0}^{N-1}w_kf(x_k) 
 +$$ 
 + 
 +<code python> 
 +#@title Left Riemann sum 
 +import matplotlib.pyplot as plt 
 +import numpy as np 
 + 
 +def f(x): 
 +  return 1 - 3*x**2/5 
 + 
 +xlist = np.arange(-0.2, 1.2, 0.01) 
 +ylist = [f(x) for x in xlist] 
 +xsample = [0.0, 0.5] 
 +ysample = [f(x) for x in xsample] 
 +xbar = [0.25, 0.75] 
 +# plot 
 +fig, ax = plt.subplots() 
 + 
 + 
 +ax.plot(xlist, ylist, color="black"
 +ax.bar(xbar, ysample, width=0.5, edgecolor="white", alpha=.5, linewidth=0.7) 
 +ax.scatter(xsample, ysample, s = 80, c = "red"
 + 
 +ax.set(xlim=(-0.1, 1.1), ylim=(0, 1.1)) 
 + 
 +plt.show() 
 + 
 +</code>
  
lectures/numeric15.txt · 最終更新: 2023/01/24 23:40 by kimi

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki