{"id":4729,"date":"2025-03-31T13:29:20","date_gmt":"2025-03-31T04:29:20","guid":{"rendered":"https:\/\/www.ktech.biz\/jp\/?p=4729"},"modified":"2025-05-25T11:51:03","modified_gmt":"2025-05-25T02:51:03","slug":"2-lineq","status":"publish","type":"post","link":"https:\/\/www.ktech.biz\/jp\/tutorial\/2-lineq\/","title":{"rendered":"2. \u9023\u7acb\u4e00\u6b21\u65b9\u7a0b\u5f0f"},"content":{"rendered":"\n<h3>2.1 \u6982\u8981<\/h3>\n<p>\u4f8b\u3048\u3070, \u672a\u77e5\u6570\u304c 2 \u3064\u306e\u9023\u7acb\u4e00\u6b21\u65b9\u7a0b\u5f0f (2 \u5143\u9023\u7acb\u4e00\u6b21\u65b9\u7a0b\u5f0f) \u306f\u6b21\u306e\u3088\u3046\u306a\u3082\u306e\u3067\u3057\u305f.<br \/>\n\\[<br \/>\n  a_{11}x_1 + a_{12}x_2 = b_1 \\\\<br \/>\n  a_{21}x_1 + a_{22}x_2 = b_2 \\\\<br \/>\n\\]\n\\(x_1\\) \u3068 \\(x_2\\) \u306f\u672a\u77e5\u6570\u3067\u3059.<\/p>\n<p>\u3053\u308c\u3092\u884c\u5217\u3092\u4f7f\u3063\u3066\u8868\u3059\u3068\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059.<br \/>\n\\[<br \/>\n\\boldsymbol{A}\\boldsymbol{x} = \\boldsymbol{b}<br \/>\n\\]\n\u305f\u3060\u3057,<br \/>\n\\[<br \/>\n\\boldsymbol{A} =<br \/>\n\\begin{pmatrix}<br \/>\na_{11} &#038; a_{12} \\\\<br \/>\na_{21} &#038; a_{22} \\\\<br \/>\n\\end{pmatrix},<br \/>\n\\boldsymbol{b} =<br \/>\n\\begin{pmatrix}<br \/>\nb_1 \\\\<br \/>\nb_2 \\\\<br \/>\n\\end{pmatrix},<br \/>\n\\boldsymbol{x} =<br \/>\n\\begin{pmatrix}<br \/>\nx_1 \\\\<br \/>\nx_2 \\\\<br \/>\n\\end{pmatrix}<br \/>\n\\]\n\\(\\boldsymbol{A}\\) \u3092\u4fc2\u6570\u884c\u5217, \\(\\boldsymbol{b}\\) \u3092\u53f3\u8fba\u30d9\u30af\u30c8\u30eb, \\(\\boldsymbol{x}\\) \u3092\u89e3\u30d9\u30af\u30c8\u30eb\u3068\u3044\u3044\u307e\u3059. \u672a\u77e5\u6570\u304c n \u500b\u306e\u9023\u7acb\u4e00\u6b21\u65b9\u7a0b\u5f0f (n \u5143\u9023\u7acb\u4e00\u6b21\u65b9\u7a0b\u5f0f) \u306f\u884c\u5217\u3068\u30d9\u30af\u30c8\u30eb\u3092\u4f7f\u3063\u305f\u8868\u8a18\u306f\u540c\u3058\u306b\u306a\u308a\u307e\u3059.<\/p>\n<p>\u9006\u884c\u5217 \\(\\boldsymbol{A^{-1}}\\) \u304c\u308f\u304b\u308c\u3070, \u5de6\u304b\u3089\u65b9\u7a0b\u5f0f\u306e\u4e21\u8fba\u306b\u639b\u3051\u3066\u3084\u308b\u3068,<br \/>\n\\[<br \/>\n\\boldsymbol{A^{-1}Ax = A^{-1}b}<br \/>\n\\]\n\u3068\u306a\u308a, \\(\\boldsymbol{A^{-1}A}\\) \u304c\u6d88\u3048\u3066\u6b21\u306e\u3088\u3046\u306b \\(\\boldsymbol{x}\\) \u3092\u6c42\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059.<br \/>\n\\[<br \/>\n\\boldsymbol{x} = \\boldsymbol{A^{-1}}\\boldsymbol{b}<br \/>\n\\]\nExcel \u3067\u306f MINVERSE \u3068\u3044\u3046\u9006\u884c\u5217\u3092\u6c42\u3081\u308b\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u95a2\u6570\u304c\u3042\u308b\u306e\u3067, \u3053\u308c\u3092\u4f7f\u3063\u3066\u9006\u884c\u5217\u3092\u6c42\u3081, \u53f3\u8fba\u30d9\u30af\u30c8\u30eb \\(\\boldsymbol{b}\\) \u306b\u5de6\u304b\u3089\u639b\u3051\u3066\u3084\u308b\u3053\u3068\u306b\u3088\u308a\u89e3\u30d9\u30af\u30c8\u30eb \\(\\boldsymbol{x}\\) \u3092\u6c42\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059. \u3057\u304b\u3057, \u3053\u306e\u65b9\u6cd5\u306f\u8a08\u7b97\u91cf\u304c\u591a\u304f\u306a\u308b\u3053\u3068\u3068\u7cbe\u5ea6\u304c\u60aa\u304f\u306a\u308a\u3084\u3059\u3044\u3053\u3068\u304b\u3089, \u9006\u884c\u5217\u3092\u6c42\u3081\u306a\u3044\u3067\u76f4\u63a5\u8a08\u7b97\u3059\u308b\u65b9\u304c\u3088\u3044\u3068\u3055\u308c\u3066\u3044\u307e\u3059.<\/p>\n<h3>2.1 \u9023\u7acb\u4e00\u6b21\u65b9\u7a0b\u5f0f\u306e\u89e3\u6cd5<\/h3>\n<p>\u30b3\u30f3\u30d4\u30e5\u30fc\u30bf\u3067\u9023\u7acb\u4e00\u6b21\u65b9\u7a0b\u5f0f\u3092\u89e3\u304f\u4e00\u822c\u7684\u306a\u65b9\u6cd5\u306f\u672c\u8cea\u7684\u306b\u306f\u624b\u8a08\u7b97\u3092\u884c\u3046\u3068\u304d\u3068\u540c\u3058\u3067\u3059. \u3059\u306a\u308f\u3061, 2 \u672c\u306e\u5f0f\u306e\u7247\u65b9\u306b\u5b9a\u6570\u3092\u639b\u3051\u3066\u3082\u3046\u4e00\u65b9\u304b\u3089\u5f15\u304f\u3053\u3068\u306b\u3088\u308a\u5909\u6570\u3092 1 \u3064\u305a\u3064\u6d88\u53bb\u3057\u3066\u3044\u304f\u3053\u3068\u3092\u7e70\u308a\u8fd4\u3057\u307e\u3059. \u3053\u308c\u306f\u30ac\u30a6\u30b9\u306e\u6d88\u53bb\u6cd5\u3068\u547c\u3070\u308c\u308b\u3082\u306e\u3067\u3059.<\/p>\n<p>\u3053\u308c\u3092\u884c\u5217\u306e\u5f0f\u3067\u8868\u3059\u3068\u4fc2\u6570\u884c\u5217\u3092\u4e09\u89d2\u884c\u5217\u306e\u7a4d\u306b\u5206\u89e3\u3057\u3066\u3044\u304f\u904e\u7a0b\u3068\u540c\u3058\u306b\u306a\u308a\u307e\u3059. \u4e09\u89d2\u884c\u5217\u3092\u4fc2\u6570\u3068\u3059\u308b\u9023\u7acb\u4e00\u6b21\u65b9\u7a0b\u5f0f\u306f\u4ee3\u5165\u64cd\u4f5c\u3060\u3051\u3067\u7c21\u5358\u306b\u89e3\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059.<\/p>\n<h5>2.1.1 \u4e00\u822c\u884c\u5217\u306e\u5834\u5408<\/h5>\n<p>\u307e\u305a, \u4fc2\u6570\u884c\u5217 \\(\\boldsymbol{A}\\) \u3092\u6b21\u306e\u3088\u3046\u306b\u5206\u89e3\u3057\u307e\u3059. \u3053\u308c\u3092 LU \u5206\u89e3\u3068\u547c\u3073\u307e\u3059.<br \/>\n\\[<br \/>\n\\boldsymbol{A} = \\boldsymbol{LU} \\space (\u305f\u3060\u3057, \\boldsymbol{L} \u306f\u4e0b\u4e09\u89d2\u884c\u5217, \\boldsymbol{U} \u306f\u4e0a\u4e09\u89d2\u884c\u5217)<br \/>\n\\]\nLU \u5206\u89e3\u306e\u8a08\u7b97\u624b\u9806\u306f\u3044\u304f\u3064\u304b\u306e\u30d0\u30ea\u30a8\u30fc\u30b7\u30e7\u30f3\u304c\u3042\u308a\u307e\u3059\u304c\u57fa\u672c\u7684\u306b\u306f\u30ac\u30a6\u30b9\u306e\u6d88\u53bb\u6cd5\u306b\u57fa\u3065\u3044\u305f\u3082\u306e\u3067\u3059. \u306a\u304a, \u3053\u306e\u904e\u7a0b\u3092\u524d\u9032\u6d88\u53bb\u3068\u3044\u3044\u307e\u3059.<\/p>\n<p>LU \u5206\u89e3\u306e\u8a08\u7b97\u4e2d\u306b\u5bfe\u89d2\u8981\u7d20\u304c 0 \u306b\u306a\u308b\u3068\u8a08\u7b97\u3092\u9032\u3081\u308b\u3053\u3068\u304c\u3067\u304d\u306a\u304f\u306a\u308a\u307e\u3059. \u3053\u306e\u3088\u3046\u306a\u5834\u5408\u306b\u306f, \u5bfe\u89d2\u8981\u7d20\u304c 0 \u3067\u306a\u3044\u6b8b\u308a\u306e\u884c\u306e\u3069\u308c\u304b\u3068\u5165\u308c\u66ff\u3048\u3092\u884c\u3048\u3070\u3088\u3044\u3053\u3068\u306b\u306a\u308a\u307e\u3059. \u306a\u304a, \u8aa4\u5dee\u3092\u3067\u304d\u308b\u3060\u3051\u5c11\u306a\u304f\u3059\u308b\u3068\u3044\u3046\u610f\u5473\u3067\u306f\u5bfe\u89d2\u8981\u7d20\u306e\u5024\u304c\u6700\u5927\u306e\u884c\u3068\u5165\u308c\u66ff\u3048\u308b\u306e\u304c\u3088\u3055\u305d\u3046\u3067\u3059. \u3053\u306e\u3042\u305f\u308a\u3082\u7a2e\u3005\u306e\u3084\u308a\u65b9\u304c\u8003\u3048\u3089\u308c\u307e\u3059. \u3053\u306e\u3088\u3046\u306a\u5165\u308c\u66ff\u3048\u3092\u884c\u3046\u3053\u3068\u3092\u30d4\u30dc\u30c3\u30c8\u306e\u9078\u629e\u3068\u3044\u3044\u307e\u3059.<\/p>\n<p>\u6b21\u306b, \u4ee5\u4e0b\u306e\u3088\u3046\u306b \\(\\boldsymbol{y} = \\boldsymbol{Ux}\\) \u3068\u304a\u3044\u3066, \\(\\boldsymbol{Ly} = \\boldsymbol{b}\\) \u304b\u3089 \\(\\boldsymbol{y}\\) \u3092\u6c42\u3081, \u6700\u5f8c\u306b \\(\\boldsymbol{Ux} = \\boldsymbol{y}\\) \u304b\u3089 \\(\\boldsymbol{x}\\) \u3092\u6c42\u3081\u307e\u3059. \\(\\boldsymbol{L}\\) \u3068 \\(\\boldsymbol{U}\\) \u306f\u4e09\u89d2\u884c\u5217\u306a\u306e\u3067\u4ee3\u5165\u64cd\u4f5c\u3060\u3051\u3067\u5bb9\u6613\u306b\u89e3\u3092\u8a08\u7b97\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059. \u3053\u308c\u3092\u5f8c\u9000\u4ee3\u5165\u3068\u3044\u3044\u307e\u3059.<br \/>\n\\[<br \/>\n\\begin{align}<br \/>\n&#038;\\boldsymbol{LUx} = \\boldsymbol{b} \\\\<br \/>\n&#038;\\boldsymbol{Ly} = \\boldsymbol{b} \\\\<br \/>\n&#038;\\boldsymbol{Ux} = \\boldsymbol{y} \\\\<br \/>\n\\end{align}<br \/>\n\\]\n\u306a\u304a, \u5206\u89e3(\u524d\u9032\u6d88\u53bb)\u3068\u89e3\u306e\u8a08\u7b97(\u5f8c\u9000\u4ee3\u5165)\u3092\u5206\u3051\u3066\u304a\u304f\u3053\u3068\u306b\u3088\u308a, \u540c\u3058\u4fc2\u6570\u884c\u5217\u3067\u53f3\u8fba\u3060\u3051\u7570\u306a\u308b\u9023\u7acb\u4e00\u6b21\u65b9\u7a0b\u5f0f\u3092\u89e3\u304f\u3068\u304d\u306b\u5f8c\u9000\u4ee3\u5165\u306e\u8a08\u7b97\u3060\u3051\u884c\u3048\u3070\u3088\u3044\u3068\u3044\u3046\u5229\u70b9\u304c\u3042\u308a\u307e\u3059.<\/p>\n<h5>2.1.2 \u5bfe\u79f0\u884c\u5217\u306e\u5834\u5408<\/h5>\n<p>\u307e\u305a, \u4fc2\u6570\u884c\u5217 \\(\\boldsymbol{A}\\) \u3092\u6b21\u306e\u3088\u3046\u306b\u5206\u89e3\u3057\u307e\u3059. \u3053\u308c\u3092\u30b3\u30ec\u30b9\u30ad\u30fc\u5206\u89e3\u3068\u547c\u3073\u307e\u3059.<br \/>\n\\[<br \/>\n\\boldsymbol{A} = \\boldsymbol{LL^T} \u307e\u305f\u306f \\boldsymbol{A} = \\boldsymbol{U^TU} \\space (\u305f\u3060\u3057 \\boldsymbol{L} \u306f\u4e0b\u4e09\u89d2\u884c\u5217, \\boldsymbol{U} \u306f\u4e0a\u4e09\u89d2\u884c\u5217)<br \/>\n\\]\n\u30b3\u30ec\u30b9\u30ad\u30fc\u5206\u89e3\u306e\u8a08\u7b97\u624b\u9806\u306f LU \u5206\u89e3\u3068\u540c\u69d8\u3067\u3059\u304c, \u5bfe\u89d2\u8981\u7d20\u304c 0 \u306b\u306a\u308b\u5bfe\u79f0\u884c\u5217\u304c\u73fe\u308c\u308b\u3053\u3068\u306f\u5fdc\u7528\u4e0a\u306a\u3044\u306e\u3067, \u901a\u5e38\u306f\u30d4\u30dc\u30c3\u30c8\u306e\u9078\u629e\u306f\u884c\u3044\u307e\u305b\u3093.<\/p>\n<p>\u5206\u89e3\u304c\u5b8c\u4e86\u3057\u305f\u3089\u4e00\u822c\u884c\u5217\u306e\u5834\u5408\u3068\u540c\u69d8\u306b\u4e09\u89d2\u884c\u5217\u306e\u4ee3\u5165\u64cd\u4f5c\u306b\u3088\u308a\u89e3\u3092\u6c42\u3081\u307e\u3059.<\/p>\n<h5>2.1.3 \u6761\u4ef6\u6570\u306b\u3064\u3044\u3066<\/h5>\n<p>\u9023\u7acb\u4e00\u6b21\u65b9\u7a0b\u5f0f\u3092\u89e3\u304f\u969b\u306b\u306f\u4fc2\u6570\u884c\u5217\u306e\u6761\u4ef6\u6570\u3092\u6c42\u3081\u3066\u304a\u304f\u3068\u6709\u76ca\u3067\u3059.<\/p>\n<p>\u6761\u4ef6\u6570\u306f\u6b21\u306e\u3088\u3046\u306b\u5b9a\u7fa9\u3055\u308c\u307e\u3059.<br \/>\n\\[<br \/>\ncond(\\boldsymbol{A}) = ||\\boldsymbol{A}||\\cdot||\\boldsymbol{A^{-1}}||<br \/>\n\\]\n\u6761\u4ef6\u6570\u306e\u5024\u306f, \u6700\u3082\u6761\u4ef6\u304c\u826f\u3044\u5358\u4f4d\u884c\u5217 \\(\\boldsymbol{I}\\) \u306e\u5834\u5408 1, \u6700\u3082\u6761\u4ef6\u304c\u60aa\u3044\u7279\u7570\u884c\u5217\u306e\u5834\u5408 \\(\\infty\\) \u3067, \u666e\u901a\u306f\u305d\u306e\u9593\u306e\u5024\u3068\u306a\u308a\u307e\u3059. \u6761\u4ef6\u6570\u306f\u5b9a\u7fa9\u3069\u304a\u308a\u306b\u8a08\u7b97\u3059\u308b\u3068\u9006\u884c\u5217\u3092\u6c42\u3081\u306a\u3051\u308c\u3070\u306a\u3089\u305a\u8a08\u7b97\u91cf\u304c\u591a\u304f\u306a\u308b\u305f\u3081, \u901a\u5e38\u306f\u7c21\u4fbf\u306b\u8a08\u7b97\u3067\u304d\u308b\u63a8\u5b9a\u5024\u304c\u4f7f\u308f\u307e\u3059.<\/p>\n<p>\u3053\u308c\u3092\u4f7f\u3063\u3066, \u6c42\u3081\u3089\u308c\u305f\u89e3 \\(\\boldsymbol{x}\\) \u306e\u76f8\u5bfe\u8aa4\u5dee\u3092\u6b21\u306e\u3088\u3046\u306b\u3057\u3066\u63a8\u5b9a\u3059\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059.<br \/>\n\\[<br \/>\n||\\boldsymbol{x^*} &#8211; \\boldsymbol{x}||\/||\\boldsymbol{x}|| \\leq cond(\\boldsymbol{A})\\cdot \\epsilon<br \/>\n\\]\n\u3053\u3053\u3067, \\(\\boldsymbol{x^*}\\) \u306f\u771f\u306e\u89e3, \\(\\epsilon\\) \u306f\u8a08\u7b97\u6a5f\u30a4\u30d7\u30b7\u30ed\u30f3(*)\u3067\u3059. \u6761\u4ef6\u6570\u304c\u975e\u5e38\u306b\u5927\u304d\u3044\u5834\u5408\u3092\u60aa\u6761\u4ef6\u3067\u3042\u308b\u3068\u3044\u3044, \u4f8b\u3048\u3070\u6761\u4ef6\u6570\u304c \\(10^{15}\\) \u7a0b\u5ea6\u3067\u3042\u308c\u3070\u307b\u3068\u3093\u3069\u6709\u52b9\u6841\u304c\u306a\u3044\u53ef\u80fd\u6027\u304c\u3042\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059.<\/p>\n<hr\/>\n<p>(*) \u8a08\u7b97\u6a5f\u30a4\u30d7\u30b7\u30ed\u30f3\u306f\u5b9f\u6570\u3092\u8a08\u7b97\u6a5f\u306e\u6d6e\u52d5\u5c0f\u6570\u3067\u8fd1\u4f3c\u3057\u305f\u305f\u3081\u306e\u8aa4\u5dee\u3067, Excel (IEEE\u5f62\u5f0f\u306e\u500d\u7cbe\u5ea6) \u3067\u306f\u304a\u304a\u3088\u305d \\(1.11 \\times 10^{-16}\\) \u3068\u306a\u308a\u307e\u3059<\/p>\n<hr\/>\n<h3>2.2 XLPack \u3092\u4f7f\u3063\u305f\u9023\u7acb\u4e00\u6b21\u65b9\u7a0b\u5f0f\u306e\u89e3\u304d\u65b9<\/h3>\n<p>LU \u5206\u89e3\u304a\u3088\u3073\u30b3\u30ec\u30b9\u30ad\u30fc\u5206\u89e3\u306e XLPack \u306e VBA \u30b5\u30d6\u30eb\u30fc\u30c1\u30f3\u306f\u305d\u308c\u305e\u308c <strong>Dgesv<\/strong> \u304a\u3088\u3073 <strong>Dposv<\/strong> \u3067\u3059. \u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u95a2\u6570\u306f\u305d\u308c\u305e\u308c, <strong>WDgesv<\/strong>, <strong>WDposv<\/strong>\u3067\u3059.<\/p>\n<p>VBA \u30d7\u30ed\u30b0\u30e9\u30e0\u3067\u6761\u4ef6\u6570\u306e\u63a8\u5b9a\u5024\u3092\u6c42\u3081\u308b\u305f\u3081\u306b\u306f <strong>Dlange<\/strong> \u3068 <strong>Dgecon<\/strong> \u304a\u3088\u3073 <strong>Dlansy<\/strong> \u3068 <strong>Dpocon<\/strong> \u304c\u4f7f\u7528\u3067\u304d\u307e\u3059. \u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u95a2\u6570\u306e\u5834\u5408\u306b\u306f, <strong>WDgesv<\/strong> \u304a\u3088\u3073 <strong>WDposv<\/strong> \u306e\u8a08\u7b97\u7d50\u679c\u306e\u4e00\u90e8\u3068\u3057\u3066\u6761\u4ef6\u6570\u306e\u63a8\u5b9a\u5024\u3082\u8fd4\u3055\u308c\u307e\u3059.<\/p>\n<p>\u3053\u308c\u3089\u306f, \u7dda\u5f62\u8a08\u7b97\u30e9\u30a4\u30d6\u30e9\u30ea LAPACK \u306e\u30b5\u30d6\u30eb\u30fc\u30c1\u30f3 DGESV, DLANGE, DGECON (LU \u5206\u89e3) \u304a\u3088\u3073 DPOSV, DLANSY, DPOCON (\u30b3\u30ec\u30b9\u30ad\u30fc\u5206\u89e3) \u3092\u4f7f\u7528\u3057\u3066\u3044\u307e\u3059.<\/p>\n<h5>\u4f8b\u984c<\/h5>\n<p>\u6b21\u306e\u9023\u7acb\u4e00\u6b21\u65b9\u7a0b\u5f0f\u3092\u89e3\u304f.<br \/>\n\\[<br \/>\n\\begin{align}<br \/>\n&#038; 10x_1 &#8211; 7x_2 = 7 \\\\<br \/>\n&#038; -3x_1 + 2x_2 + 6x_3 = 4 \\\\<br \/>\n&#038; 5x_1 &#8211; x_2 + 5x_3 = 6 \\\\<br \/>\n\\end{align}<br \/>\n\\]\n\u3053\u308c\u306f, \u884c\u5217\u3067\u8868\u3059\u3068\u6b21\u306e\u3088\u3046\u306b\u306a\u308a\u307e\u3059.<br \/>\n\\[<br \/>\n\\boldsymbol{A}\\boldsymbol{x} = \\boldsymbol{b}<br \/>\n\\]\n\u305f\u3060\u3057,<br \/>\n\\[<br \/>\n\\boldsymbol{A} =<br \/>\n\\begin{pmatrix}<br \/>\n10 &#038; -7 &#038;  0 \\\\<br \/>\n-3 &#038;  2 &#038; 6 \\\\<br \/>\n5 &#038; -1 &#038; 5 \\\\<br \/>\n\\end{pmatrix},<br \/>\n\\boldsymbol{b} =<br \/>\n\\begin{pmatrix}<br \/>\n7 \\\\<br \/>\n4 \\\\<br \/>\n6 \\\\<br \/>\n\\end{pmatrix},<br \/>\n\\boldsymbol{x} =<br \/>\n\\begin{pmatrix}<br \/>\nx_1 \\\\<br \/>\nx_2 \\\\<br \/>\nx_3 \\\\<br \/>\n\\end{pmatrix}<br \/>\n\\]\n\u3053\u3053\u3067, \\(\\boldsymbol{A}\\) \u306f\u4fc2\u6570\u884c\u5217, \\(\\boldsymbol{b}\\) \u306f\u53f3\u8fba\u30d9\u30af\u30c8\u30eb, \\(\\boldsymbol{x}\\) \u306f\u89e3\u30d9\u30af\u30c8\u30eb\u3067\u3059.<\/p>\n<hr\/>\n<h4>2.2.1 \u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u95a2\u6570\u3092\u4f7f\u7528\u3057\u305f\u89e3\u304d\u65b9<\/h4>\n<p>\u307e\u305a, \u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u306e\u9069\u5f53\u306a\u5834\u6240\u306b\u4fc2\u6570\u884c\u5217 \\(\\boldsymbol{A}\\) \u3068\u53f3\u8fba\u30d9\u30af\u30c8\u30eb \\(\\boldsymbol{b}\\) \u306e\u30c7\u30fc\u30bf\u3092\u5165\u529b\u3057\u307e\u3059 (\u30aa\u30ec\u30f3\u30b8\u8272\u306e\u30bb\u30eb). \u305d\u3057\u3066, \u89e3\u30d9\u30af\u30c8\u30eb\u3092\u5165\u308c\u308b\u5834\u6240\u3068\u3057\u3066(\u89e3\u306e\u8981\u7d20\u6570 + 2)\u500b\u306e\u30bb\u30eb\u3092\u9078\u629e\u3057\u3066\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u95a2\u6570 <strong>WDgesv<\/strong> \u3092\u5165\u529b\u3057\u307e\u3059 (\u7dd1\u8272\u306e\u30bb\u30eb).<\/p>\n<p><strong>WDgesv<\/strong> \u306e\u5fc5\u8981\u306a\u30d1\u30e9\u30e1\u30fc\u30bf\u306f N, A, B, Nrhs \u3067\u3059.<br \/>\nN: \u8981\u7d20\u6570 (\u3053\u306e\u4f8b\u3067\u306f 3).<br \/>\nA: \u4fc2\u6570\u884c\u5217 \\(\\boldsymbol{A}\\) \u306e\u30bb\u30eb\u7bc4\u56f2.<br \/>\nB: \u53f3\u8fba\u30d9\u30af\u30c8\u30eb \\(\\boldsymbol{b}\\) \u306e\u30bb\u30eb\u7bc4\u56f2.<br \/>\nNrhs: \u53f3\u8fba\u30d9\u30af\u30c8\u30eb\u306e\u672c\u6570 (\\(\\boldsymbol{b}\\) \u3060\u3051\u5909\u3048\u3066\u8907\u6570\u56de\u8a08\u7b97\u3059\u308b\u5834\u5408\u306b\u5165\u529b. \u7701\u7565\u6642\u306f 1 \u3068\u307f\u306a\u3059).<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ktech.biz\/jp\/wp-content\/uploads\/sites\/2\/2022\/10\/Ex2W_1.png\" alt=\"\" width=\"978\" height=\"786\" class=\"aligncenter size-full wp-image-4075\" srcset=\"https:\/\/www.ktech.biz\/jp\/wp-content\/uploads\/sites\/2\/2022\/10\/Ex2W_1.png 978w, https:\/\/www.ktech.biz\/jp\/wp-content\/uploads\/sites\/2\/2022\/10\/Ex2W_1-300x241.png 300w, https:\/\/www.ktech.biz\/jp\/wp-content\/uploads\/sites\/2\/2022\/10\/Ex2W_1-768x617.png 768w\" sizes=\"auto, (max-width: 978px) 100vw, 978px\" \/><\/p>\n<p>\u5165\u529b\u304c\u7d42\u4e86\u3057\u305f\u3089 Ctrl + Shift + Enter \u3092\u62bc\u3057\u307e\u3059.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ktech.biz\/jp\/wp-content\/uploads\/sites\/2\/2022\/10\/Ex2W_2.png\" alt=\"\" width=\"979\" height=\"786\" class=\"aligncenter size-full wp-image-4055\" srcset=\"https:\/\/www.ktech.biz\/jp\/wp-content\/uploads\/sites\/2\/2022\/10\/Ex2W_2.png 979w, https:\/\/www.ktech.biz\/jp\/wp-content\/uploads\/sites\/2\/2022\/10\/Ex2W_2-300x241.png 300w, https:\/\/www.ktech.biz\/jp\/wp-content\/uploads\/sites\/2\/2022\/10\/Ex2W_2-768x617.png 768w\" sizes=\"auto, (max-width: 979px) 100vw, 979px\" \/><\/p>\n<p>\u3053\u308c\u3067, \u89e3 \\(\\boldsymbol{x} = \\begin{pmatrix} 0 &#038; -1 &#038; 1\\end{pmatrix}^T\\) \u304c\u6c42\u3081\u3089\u308c\u307e\u3057\u305f. \u306a\u304a, \u8868\u793a\u3055\u308c\u3066\u3044\u308b 0.078283 \u306f\u6761\u4ef6\u6570\u306e\u63a8\u5b9a\u5024\u306e\u9006\u6570, \u4e00\u756a\u4e0b\u306e 0 \u306f\u30ea\u30bf\u30fc\u30f3\u30b3\u30fc\u30c9 (\u6b63\u5e38\u7d42\u4e86\u3092\u793a\u3059) \u3067\u3059.<\/p>\n<h4>2.2.2 VBA \u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u4f7f\u7528\u3057\u305f\u89e3\u304d\u65b9<\/h4>\n<p>\u4e0a\u3068\u540c\u3058\u4f8b\u984c\u3092 VBA \u30d7\u30ed\u30b0\u30e9\u30e0\u306b\u3088\u308a\u89e3\u304d\u307e\u3059. <strong>Dgesv<\/strong> \u3092\u4f7f\u3063\u305f\u30d7\u30ed\u30b0\u30e9\u30e0\u4f8b\u3092\u793a\u3057\u307e\u3059.<\/p>\n<div class=\"hcb_wrap\">\n<pre class=\"prism line-numbers lang-vb\" data-lang=\"VBA\"><code>Sub Start()\r\n    Const NMax = 10\r\n    Dim N As Long, A(NMax, NMax) As Double, B(NMax) As Double\r\n    Dim Anorm As Double, RCond As Double\r\n    Dim Ipiv(NMax) As Long, Info As Long, I As Long, J As Long\r\n    '--- Input data\r\n    N = 3\r\n    For I = 0 To N - 1\r\n        For J = 0 To N - 1\r\n            A(I, J) = Cells(5 + I, 1 + J)\r\n        Next\r\n        B(I) = Cells(5 + I, 4)\r\n    Next\r\n    '--- Solve equation\r\n    Anorm = Dlange(\"1\", N, N, A())\r\n    Call Dgesv(N, A(), Ipiv(), B(), Info)\r\n    If Info = 0 Then\r\n        '---  Compute condition number\r\n        Call Dgecon(\"1\", N, A(), Anorm, RCond, Info)\r\n    End If\r\n    '--- Output solution\r\n    For I = 0 To N - 1\r\n        Cells(5 + I, 5) = B(I)\r\n    Next\r\n    Cells(8, 5) = RCond\r\n    Cells(9, 5) = Info\r\nEnd Sub<\/code><\/pre>\n<\/div>\n<p>\u30d7\u30ed\u30b0\u30e9\u30e0\u4e2d, <strong>Dlange<\/strong> \u3068 <strong>Dgecon<\/strong> \u306f\u6761\u4ef6\u6570\u3092\u6c42\u3081\u308b\u305f\u3081\u306e\u3082\u306e\u3067\u65b9\u7a0b\u5f0f\u3092\u89e3\u304f\u3060\u3051\u306a\u3089\u3070\u4e0d\u8981\u3067\u3059.<\/p>\n<p>\u6240\u5b9a\u306e\u4f4d\u7f6e(\u4e0b\u306e\u30aa\u30ec\u30f3\u30b8\u8272\u306e\u30bb\u30eb)\u306b\u4fc2\u6570\u884c\u5217 \\(\\boldsymbol{A}\\) \u3068\u53f3\u8fba\u30d9\u30af\u30c8\u30eb \\(\\boldsymbol{b}\\) \u306e\u5024\u3092\u5165\u529b\u3057, \u30de\u30af\u30ed Start \u3068\u3057\u3066\u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u884c\u3059\u308b\u3068\u6b21\u306e\u7d50\u679c\u304c\u5f97\u3089\u308c\u307e\u3059. \u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u95a2\u6570\u3092\u4f7f\u7528\u3057\u305f\u3068\u304d\u3068\u7570\u306a\u308a, \u4fc2\u6570\u884c\u5217 \\(\\boldsymbol{A}\\) \u3068\u53f3\u8fba\u30d9\u30af\u30c8\u30eb \\(\\boldsymbol{b}\\) \u306e\u5024\u3092\u5165\u529b\u3057\u305f\u3060\u3051\u3067\u306f\u7d50\u679c\u304c\u5f97\u3089\u308c\u305a, VBA \u30d7\u30ed\u30b0\u30e9\u30e0\u3092\u5b9f\u884c\u3057\u3066\u3084\u308b\u5fc5\u8981\u304c\u3042\u308a\u307e\u3059.<\/p>\n<p><img loading=\"lazy\" decoding=\"async\" src=\"https:\/\/www.ktech.biz\/jp\/wp-content\/uploads\/sites\/2\/2022\/10\/Ex2_3.png\" alt=\"\" width=\"979\" height=\"786\" class=\"aligncenter size-full wp-image-4052\" srcset=\"https:\/\/www.ktech.biz\/jp\/wp-content\/uploads\/sites\/2\/2022\/10\/Ex2_3.png 979w, https:\/\/www.ktech.biz\/jp\/wp-content\/uploads\/sites\/2\/2022\/10\/Ex2_3-300x241.png 300w, https:\/\/www.ktech.biz\/jp\/wp-content\/uploads\/sites\/2\/2022\/10\/Ex2_3-768x617.png 768w\" sizes=\"auto, (max-width: 979px) 100vw, 979px\" \/><\/p>\n<h4>2.2.3 \u4fc2\u6570\u884c\u5217\u304c\u5bfe\u79f0\u306a\u5834\u5408<\/h4>\n<p>\u4fc2\u6570\u884c\u5217 \\(\\boldsymbol{A}\\) \u304c\u6b63\u5b9a\u5024\u5bfe\u79f0\u884c\u5217\u306e\u5834\u5408\u306b\u306f <strong>WDposv<\/strong> \u3068 <strong>Dposv<\/strong> \u3092\u4f7f\u3063\u305f\u65b9\u304c\u52b9\u7387\u3088\u304f\u8a08\u7b97\u3092\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059. \u624b\u9806\u306f\u4e0a\u3068\u540c\u69d8\u3067\u3059\u304c, A \u306e\u30c7\u30fc\u30bf\u306f\u4e0a\u307e\u305f\u306f\u4e0b\u4e09\u89d2\u90e8\u5206(\u5bfe\u89d2\u8981\u7d20\u3092\u542b\u3080)\u3060\u3051\u8a2d\u5b9a\u3059\u308c\u3070\u3088\u304f\u306a\u308a\u307e\u3059. \u6b8b\u308a\u306e\u90e8\u5206\u306f\u53c2\u7167\u3055\u308c\u307e\u305b\u3093.<\/p>\n<p>\u3053\u3053\u306b\u306f\u63b2\u8f09\u3057\u307e\u305b\u3093\u304c, \u30c0\u30a6\u30f3\u30ed\u30fc\u30c9\u3067\u304d\u308b\u4f8b\u984c\u30ef\u30fc\u30af\u30b7\u30fc\u30c8\u306b\u306f <strong>WDposv<\/strong> \u3068 <strong>Dposv<\/strong> \u3092\u4f7f\u3063\u305f\u4f8b\u304c\u5165\u3063\u3066\u3044\u307e\u3059.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u9023\u7acb\u4e00\u6b21\u65b9\u7a0b\u5f0f\u306e\u89e3\u6cd5\u3068XLPack\u3092\u4f7f\u3063\u305f\u89e3\u304d\u65b9<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_monsterinsights_skip_tracking":false,"_monsterinsights_sitenote_active":false,"_monsterinsights_sitenote_note":"","_monsterinsights_sitenote_category":0,"footnotes":""},"categories":[10],"tags":[],"class_list":["post-4729","post","type-post","status-publish","format-standard","hentry","category-tutorial"],"aioseo_notices":[],"_links":{"self":[{"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/posts\/4729","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/comments?post=4729"}],"version-history":[{"count":5,"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/posts\/4729\/revisions"}],"predecessor-version":[{"id":5066,"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/posts\/4729\/revisions\/5066"}],"wp:attachment":[{"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/media?parent=4729"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/categories?post=4729"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.ktech.biz\/jp\/wp-json\/wp\/v2\/tags?post=4729"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}