{"id":803,"date":"2024-05-26T20:56:11","date_gmt":"2024-05-26T11:56:11","guid":{"rendered":"https:\/\/chocottopro.com\/?p=803"},"modified":"2024-06-02T13:48:32","modified_gmt":"2024-06-02T04:48:32","slug":"%e3%80%90%e5%ae%8c%e5%85%a8%e7%89%88%e3%80%91numpy-linspace%e3%81%ae%e4%bd%bf%e3%81%84%e6%96%b9%e3%82%92%e5%be%b9%e5%ba%95%e8%a7%a3%e8%aa%ac%ef%bc%81%e5%88%9d%e5%bf%83%e8%80%85%e3%81%a7%e3%82%82","status":"publish","type":"post","link":"https:\/\/chocottopro.com\/?p=803","title":{"rendered":"\u3010\u5b8c\u5168\u7248\u3011NumPy linspace\u306e\u4f7f\u3044\u65b9\u3092\u5fb9\u5e95\u89e3\u8aac\uff01\u521d\u5fc3\u8005\u3067\u3082\u308f\u304b\u308b\u5177\u4f53\u4f8b5\u9078"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\">Python\u3067\u30c7\u30fc\u30bf\u5206\u6790\u3084\u79d1\u5b66\u8a08\u7b97\u3092\u884c\u3046\u4e0a\u3067\u6b20\u304b\u305b\u306a\u3044\u30e9\u30a4\u30d6\u30e9\u30ea\u3068\u3044\u3048\u3070\u3001Numpy\u3067\u3059\u3002Numpy\u306b\u306f\u6570\u591a\u304f\u306e\u4fbf\u5229\u306a\u95a2\u6570\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u4e2d\u3067\u3082<code>linspace<\/code>\u306f\u7279\u306b\u91cd\u8981\u306a\u95a2\u6570\u306e\u4e00\u3064\u3067\u3059\u3002\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001<code>linspace<\/code>\u306e\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9\u304b\u3089\u5fdc\u7528\u4f8b\u307e\u3067\u3001\u521d\u5fc3\u8005\u306b\u3082\u308f\u304b\u308a\u3084\u3059\u304f\u4e01\u5be7\u306b\u89e3\u8aac\u3057\u307e\u3059\u3002\u3055\u3089\u306b\u3001Numpy\u306e\u4ed6\u306e\u4fbf\u5229\u306a\u95a2\u6570\u306b\u3064\u3044\u3066\u3082\u89e6\u308c\u307e\u3059\u306e\u3067\u3001\u305c\u3072\u6700\u5f8c\u307e\u3067\u304a\u4ed8\u304d\u5408\u3044\u304f\u3060\u3055\u3044\u3002<\/p>\n\n\n\n<div class=\"wp-block-sgb-block-simple sgb-box-simple sgb-box-simple--title-normal sgb-box-simple--with-border\"><div style=\"background-color:var(--wp--preset--color--sango-main);color:#FFF\" class=\"sgb-box-simple__title\">\u3053\u306e\u8a18\u4e8b\u3092\u8aad\u3093\u3060\u3089\u308f\u304b\u308b\u3053\u3068<\/div><div class=\"sgb-box-simple__body\" style=\"border-color:var(--wp--preset--color--sango-main);background-color:#FFF\">\n<ul class=\"wp-block-list\">\n<li>linspace\u306e\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9\u3068\u5f79\u5272 <\/li>\n\n\n\n<li>linspace\u306e\u5f15\u6570\uff08start\u3001stop\u3001num\uff09\u306e\u610f\u5473\u3068\u4f7f\u3044\u65b9 <\/li>\n\n\n\n<li>linspace\u3092\u4f7f\u3063\u305f\u30c7\u30fc\u30bf\u53ef\u8996\u5316\u306e\u65b9\u6cd5 <\/li>\n\n\n\n<li>linspace\u306e\u5fdc\u7528\u4f8b\uff08\u6570\u5024\u7a4d\u5206\u3001\u5fae\u5206\u65b9\u7a0b\u5f0f\u306e\u89e3\u6cd5\u3001\u6a5f\u68b0\u5b66\u7fd2\u306e\u30c7\u30fc\u30bf\u524d\u51e6\u7406\uff09 <\/li>\n\n\n\n<li>Numpy\u306e\u4ed6\u306e\u4fbf\u5229\u306a\u95a2\u6570\uff08arange\u3001random\u3001zeros\u3001ones\u306a\u3069\uff09\u306e\u6982\u8981<\/li>\n<\/ul>\n<\/div><\/div>\n\n\n\n<div class=\"toc\"><br \/>\n<b>Warning<\/b>:  Undefined array key \"is_admin\" in <b>\/home\/c7479301\/public_html\/chocottopro.com\/wp-content\/themes\/sango-theme\/library\/gutenberg\/dist\/classes\/Toc.php<\/b> on line <b>116<\/b><br \/>\n<br \/>\n<b>Warning<\/b>:  Undefined array key \"is_category_top\" in <b>\/home\/c7479301\/public_html\/chocottopro.com\/wp-content\/themes\/sango-theme\/library\/gutenberg\/dist\/classes\/Toc.php<\/b> on line <b>121<\/b><br \/>\n<br \/>\n<b>Warning<\/b>:  Undefined array key \"is_top\" in <b>\/home\/c7479301\/public_html\/chocottopro.com\/wp-content\/themes\/sango-theme\/library\/gutenberg\/dist\/classes\/Toc.php<\/b> on line <b>128<\/b><br \/>\n    <div id=\"toc_container\" class=\"sgb-toc--bullets js-smooth-scroll\" data-dialog-title=\"Table of Contents\">\n      <p class=\"toc_title\">\u76ee\u6b21 <\/p>\n      <ul class=\"toc_list\">  <li class=\"first\">    <a href=\"#i-0\">1. linspace\u3068\u306f\uff1fNumpy\u306e\u5f37\u529b\u306a\u6a5f\u80fd\u3092\u7406\u89e3\u3057\u3088\u3046<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-1\">1-1. linspace\u306e\u5f79\u5272\u3068\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-2\">1-2. linspace\u3092\u4f7f\u3046\u30e1\u30ea\u30c3\u30c8 \u2013 \u30b3\u30fc\u30c9\u4f8b\u3067\u78ba\u8a8d<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-3\">2. linspace\u306e\u5f15\u6570\u3092\u5b8c\u5168\u30de\u30b9\u30bf\u30fc\uff01start, stop, num\u306e\u610f\u5473\u3092\u5fb9\u5e95\u89e3\u8aac<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-4\">2-1. start\u3068stop \u2013 \u751f\u6210\u3059\u308b\u6570\u5024\u7bc4\u56f2\u3092\u6307\u5b9a\u3057\u3088\u3046<\/a>      <\/li>      <li>        <a href=\"#i-5\">2-2. num \u2013 \u751f\u6210\u3059\u308b\u8981\u7d20\u6570\u3092\u6c7a\u3081\u3088\u3046<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-6\">2-3. endpoint\u3068retstep \u2013 \u3088\u308a\u7d30\u3084\u304b\u306a\u8a2d\u5b9a\u304c\u53ef\u80fd\u306b<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-7\">3. linspace\u3067\u30c7\u30fc\u30bf\u53ef\u8996\u5316\u306b\u6311\u6226\uff01Matplotlib\u3068\u7d44\u307f\u5408\u308f\u305b\u3088\u3046<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-8\">3-1. \u7b49\u9593\u9694\u306ax\u8ef8\u30c7\u30fc\u30bf\u3092linspace\u3067\u4f5c\u308d\u3046<\/a>      <\/li>      <li>        <a href=\"#i-9\">3-2. sin\u95a2\u6570\u3068cos\u95a2\u6570\u306e\u30b0\u30e9\u30d5\u3092\u63cf\u753b\u3057\u3066\u307f\u3088\u3046<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-10\">3-3. \u30b0\u30e9\u30d5\u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba \u2013 \u30bf\u30a4\u30c8\u30eb\u3084\u51e1\u4f8b\u3092\u8ffd\u52a0\u3057\u3088\u3046<\/a>      <\/li>    <\/ul>  <\/li>  <li>    <a href=\"#i-11\">4. linspace\u306e\u5fdc\u7528\u4f8b \u2013 \u79d1\u5b66\u8a08\u7b97\u304b\u3089\u6a5f\u68b0\u5b66\u7fd2\u307e\u3067<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-12\">4-1. \u6570\u5024\u7a4d\u5206\u3067\u9762\u7a4d\u3092\u6c42\u3081\u3088\u3046<\/a>      <\/li>      <li>        <a href=\"#i-13\">4-2. \u5e38\u5fae\u5206\u65b9\u7a0b\u5f0f\u3092\u89e3\u3044\u3066\u307f\u3088\u3046<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-14\">4-3. \u6a5f\u68b0\u5b66\u7fd2\u306e\u30c7\u30fc\u30bf\u524d\u51e6\u7406\u306blinspace\u3092\u6d3b\u7528\u3057\u3088\u3046<\/a>      <\/li>    <\/ul>  <\/li>  <li class=\"last\">    <a href=\"#i-15\">5. Numpy\u306e\u305d\u306e\u4ed6\u306e\u4fbf\u5229\u6a5f\u80fd\u3082\u8981\u30c1\u30a7\u30c3\u30af\uff01<\/a>    <ul class=\"menu_level_1\">      <li class=\"first\">        <a href=\"#i-16\">5-1. arange \u2013 \u7b49\u5dee\u6570\u5217\u3092\u751f\u6210\u3057\u3088\u3046<\/a>      <\/li>      <li>        <a href=\"#i-17\">5-2. random \u2013 \u4e71\u6570\u751f\u6210\u306e\u5f37\u3044\u5473\u65b9<\/a>      <\/li>      <li class=\"last\">        <a href=\"#i-18\">5-3. \u305d\u306e\u4ed6\u306eNumpy\u95a2\u6570\u3082\u899a\u3048\u3066\u304a\u3053\u3046<\/a>      <\/li>    <\/ul>  <\/li><\/ul>\n      \n    <\/div><\/div><h2 class=\"wp-block-heading\" id=\"i-0\">1. linspace\u3068\u306f\uff1fNumpy\u306e\u5f37\u529b\u306a\u6a5f\u80fd\u3092\u7406\u89e3\u3057\u3088\u3046<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">Python\u3067\u30c7\u30fc\u30bf\u5206\u6790\u3084\u79d1\u5b66\u8a08\u7b97\u3092\u884c\u3046\u4e0a\u3067\u3001Numpy\u306f\u6b20\u304b\u305b\u306a\u3044\u30e9\u30a4\u30d6\u30e9\u30ea\u306e\u4e00\u3064\u3067\u3059\u3002Numpy\u306b\u306f\u591a\u6570\u306e\u4fbf\u5229\u306a\u95a2\u6570\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u305d\u306e\u4e2d\u3067\u3082\u7279\u306b\u91cd\u8981\u306a\u3082\u306e\u306e\u4e00\u3064\u304c<code>linspace<\/code>\u95a2\u6570\u3067\u3059\u3002\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001<code>linspace<\/code>\u306e\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9\u304b\u3089\u3001\u305d\u306e\u6d3b\u7528\u65b9\u6cd5\u307e\u3067\u8a73\u3057\u304f\u89e3\u8aac\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-1\">1-1. linspace\u306e\u5f79\u5272\u3068\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>linspace<\/code>\u306f\u3001\u6307\u5b9a\u3055\u308c\u305f\u533a\u9593\u3092\u7b49\u5206\u5272\u3057\u305f\u6570\u5217\u3092\u751f\u6210\u3059\u308b\u95a2\u6570\u3067\u3059\u3002\u4f8b\u3048\u3070\u30010\u304b\u30891\u307e\u3067\u306e\u533a\u9593\u30925\u7b49\u5206\u3057\u305f\u6570\u5217\u304c\u6b32\u3057\u3044\u5834\u5408\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b<code>linspace<\/code>\u3092\u4f7f\u7528\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import numpy as np\n\narr = np.linspace(0, 1, 5)\nprint(arr)  # \u51fa\u529b\uff1a[0.   0.25 0.5  0.75 1.  ]<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u306e\u3088\u3046\u306b\u3001\u958b\u59cb\u5024\u3001\u7d42\u4e86\u5024\u3001\u8981\u7d20\u6570\u3092\u6307\u5b9a\u3059\u308b\u3060\u3051\u3067\u3001\u7c21\u5358\u306b\u7b49\u9593\u9694\u306a\u6570\u5217\u3092\u751f\u6210\u3067\u304d\u308b\u306e\u304c<code>linspace<\/code>\u306e\u5f37\u307f\u3067\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-2\">1-2. linspace\u3092\u4f7f\u3046\u30e1\u30ea\u30c3\u30c8 \u2013 \u30b3\u30fc\u30c9\u4f8b\u3067\u78ba\u8a8d<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>linspace<\/code>\u3092\u4f7f\u3046\u30e1\u30ea\u30c3\u30c8\u306f\u3001\u6570\u5024\u8a08\u7b97\u3084\u30c7\u30fc\u30bf\u53ef\u8996\u5316\u306e\u5834\u9762\u3067\u7279\u306b\u767a\u63ee\u3055\u308c\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u30b0\u30e9\u30d5\u306ex\u8ef8\u306e\u5024\u3092\u751f\u6210\u3059\u308b\u969b\u306b\u3001<code>linspace<\/code>\u3092\u6d3b\u7528\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import numpy as np\nimport matplotlib.pyplot as plt\n\nx = np.linspace(0, 2*np.pi, 100)\ny = np.sin(x)\n\nplt.plot(x, y)\nplt.title(\"Sine Wave\")\nplt.xlabel(\"x\")\nplt.ylabel(\"sin(x)\")\nplt.show()<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u306e\u30b3\u30fc\u30c9\u3067\u306f\u30010\u304b\u30892\u03c0\u307e\u3067\u306e\u533a\u9593\u3092100\u7b49\u5206\u3057\u305f\u6570\u5217\u3092x\u8ef8\u306e\u5024\u3068\u3057\u3066\u751f\u6210\u3057\u3001sin\u95a2\u6570\u306e\u30b0\u30e9\u30d5\u3092\u63cf\u753b\u3057\u3066\u3044\u307e\u3059\u3002<code>linspace<\/code>\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u30b0\u30e9\u30d5\u306ex\u8ef8\u306e\u5024\u3092\u7c21\u5358\u306b\u7528\u610f\u3067\u304d\u308b\u306e\u3067\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>linspace<\/code>\u306f\u3001\u6570\u5024\u7a4d\u5206\u3084\u5fae\u5206\u65b9\u7a0b\u5f0f\u306e\u89e3\u6cd5\u306a\u3069\u3001\u69d8\u3005\u306a\u6570\u5024\u8a08\u7b97\u306e\u5834\u9762\u3067\u3082\u6d3b\u8e8d\u3057\u307e\u3059\u3002\u3053\u308c\u3089\u306e\u5fdc\u7528\u4f8b\u306b\u3064\u3044\u3066\u306f\u3001\u5f8c\u306e\u7ae0\u3067\u8a73\u3057\u304f\u8aac\u660e\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Numpy\u306e<code>linspace<\/code>\u95a2\u6570\u306f\u3001\u7b49\u9593\u9694\u306a\u6570\u5217\u3092\u751f\u6210\u3059\u308b\u30b7\u30f3\u30d7\u30eb\u304b\u3064\u5f37\u529b\u306a\u30c4\u30fc\u30eb\u3067\u3059\u3002\u3053\u306e\u95a2\u6570\u3092\u4f7f\u3044\u3053\u306a\u3059\u3053\u3068\u3067\u3001\u30c7\u30fc\u30bf\u5206\u6790\u3084\u79d1\u5b66\u8a08\u7b97\u306e\u52b9\u7387\u3092\u5927\u5e45\u306b\u5411\u4e0a\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u308b\u3067\u3057\u3087\u3046\u3002\u6b21\u306e\u7ae0\u3067\u306f\u3001<code>linspace<\/code>\u306e\u5f15\u6570\u306b\u3064\u3044\u3066\u3001\u3088\u308a\u8a73\u7d30\u306b\u89e3\u8aac\u3057\u3066\u3044\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-3\">2. linspace\u306e\u5f15\u6570\u3092\u5b8c\u5168\u30de\u30b9\u30bf\u30fc\uff01start, stop, num\u306e\u610f\u5473\u3092\u5fb9\u5e95\u89e3\u8aac<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u524d\u306e\u7ae0\u3067\u306f\u3001<code>linspace<\/code>\u95a2\u6570\u306e\u57fa\u672c\u7684\u306a\u4f7f\u3044\u65b9\u306b\u3064\u3044\u3066\u5b66\u3073\u307e\u3057\u305f\u3002\u3053\u3053\u3067\u306f\u3001<code>linspace<\/code>\u306e\u5f15\u6570\u3067\u3042\u308b<code>start<\/code>\u3001<code>stop<\/code>\u3001<code>num<\/code>\u306b\u3064\u3044\u3066\u3001\u3088\u308a\u8a73\u7d30\u306b\u8aac\u660e\u3057\u3066\u3044\u304d\u307e\u3059\u3002\u3053\u308c\u3089\u306e\u5f15\u6570\u3092\u7406\u89e3\u3059\u308b\u3053\u3068\u3067\u3001<code>linspace<\/code>\u3092\u3088\u308a\u67d4\u8edf\u306b\u4f7f\u3044\u3053\u306a\u305b\u308b\u3088\u3046\u306b\u306a\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-4\">2-1. start\u3068stop \u2013 \u751f\u6210\u3059\u308b\u6570\u5024\u7bc4\u56f2\u3092\u6307\u5b9a\u3057\u3088\u3046<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>linspace<\/code>\u95a2\u6570\u306e<code>start<\/code>\u3068<code>stop<\/code>\u5f15\u6570\u306f\u3001\u751f\u6210\u3059\u308b\u6570\u5217\u306e\u958b\u59cb\u5024\u3068\u7d42\u4e86\u5024\u3092\u6307\u5b9a\u3059\u308b\u305f\u3081\u306b\u4f7f\u7528\u3057\u307e\u3059\u3002\u4f8b\u3048\u3070\u30011\u304b\u308910\u307e\u3067\u306e\u6570\u5217\u3092\u751f\u6210\u3059\u308b\u5834\u5408\u306f\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import numpy as np\n\narr = np.linspace(start=1, stop=10, num=10)\nprint(arr)  # \u51fa\u529b\uff1a[ 1.  2.  3.  4.  5.  6.  7.  8.  9. 10.]<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u3053\u3067\u6ce8\u610f\u304c\u5fc5\u8981\u306a\u306e\u306f\u3001<code>start<\/code>\u306e\u5024\u306f\u5e38\u306b<code>stop<\/code>\u3088\u308a\u5c0f\u3055\u304f\u306a\u3051\u308c\u3070\u306a\u3089\u306a\u3044\u3068\u3044\u3046\u3053\u3068\u3067\u3059\u3002\u307e\u305f\u3001<code>stop<\/code>\u306e\u5024\u306f\u3001<code>num<\/code>\u3092\u6307\u5b9a\u3057\u306a\u3044\u9650\u308a\u3001\u751f\u6210\u3055\u308c\u305f\u6570\u5217\u306b\u542b\u307e\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-5\">2-2. num \u2013 \u751f\u6210\u3059\u308b\u8981\u7d20\u6570\u3092\u6c7a\u3081\u3088\u3046<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>num<\/code>\u5f15\u6570\u306f\u3001\u751f\u6210\u3059\u308b\u6570\u5217\u306e\u8981\u7d20\u6570\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u3067\u306f50\u306b\u306a\u3063\u3066\u3044\u307e\u3059\u304c\u3001\u5fc5\u8981\u306b\u5fdc\u3058\u3066\u5909\u66f4\u3067\u304d\u307e\u3059\u3002\u4ee5\u4e0b\u306e\u4f8b\u3067\u306f\u30010\u304b\u30891\u307e\u3067\u306e\u533a\u9593\u309220\u7b49\u5206\u3057\u305f\u6570\u5217\u3092\u751f\u6210\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import numpy as np\n\narr = np.linspace(0, 1, num=20)\nprint(arr)  # \u51fa\u529b\uff1a[0.         0.05263158 0.10526316 0.15789474 0.21052632 0.26315789\n             #       0.31578947 0.36842105 0.42105263 0.47368421 0.52631579 0.57894737\n             #       0.63157895 0.68421053 0.73684211 0.78947368 0.84210526 0.89473684\n             #       0.94736842 1.        ]<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>num<\/code>\u306e\u5024\u3092\u5927\u304d\u304f\u3059\u308c\u3070\u3001\u3088\u308a\u7d30\u304b\u3044\u9593\u9694\u306e\u6570\u5217\u304c\u751f\u6210\u3055\u308c\u307e\u3059\u3002\u9006\u306b\u3001<code>num<\/code>\u3092\u5c0f\u3055\u304f\u3059\u308c\u3070\u3001\u7c97\u3044\u9593\u9694\u306e\u6570\u5217\u304c\u751f\u6210\u3055\u308c\u307e\u3059\u3002\u7528\u9014\u306b\u5fdc\u3058\u3066\u9069\u5207\u306a\u5024\u3092\u8a2d\u5b9a\u3057\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-6\">2-3. endpoint\u3068retstep \u2013 \u3088\u308a\u7d30\u3084\u304b\u306a\u8a2d\u5b9a\u304c\u53ef\u80fd\u306b<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>linspace<\/code>\u306b\u306f\u3001<code>endpoint<\/code>\u3068<code>retstep<\/code>\u3068\u3044\u30462\u3064\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u5f15\u6570\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><code>endpoint<\/code>\u306f\u3001<code>stop<\/code>\u306e\u5024\u3092\u751f\u6210\u3055\u308c\u308b\u6570\u5217\u306b\u542b\u3081\u308b\u304b\u3069\u3046\u304b\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u306f<code>True<\/code>\u3067\u3001<code>stop<\/code>\u306e\u5024\u304c\u542b\u307e\u308c\u307e\u3059\u304c\u3001<code>False<\/code>\u306b\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067\u9664\u5916\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import numpy as np\n\narr = np.linspace(0, 1, num=5, endpoint=False)\nprint(arr)  # \u51fa\u529b\uff1a[0.  0.2 0.4 0.6 0.8]<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><code>retstep<\/code>\u306f\u3001\u751f\u6210\u3055\u308c\u305f\u6570\u5217\u306e\u8981\u7d20\u9593\u306e\u9593\u9694\u3092\u8fd4\u3059\u304b\u3069\u3046\u304b\u3092\u6307\u5b9a\u3057\u307e\u3059\u3002\u30c7\u30d5\u30a9\u30eb\u30c8\u306f<code>False<\/code>\u3067\u3059\u304c\u3001<code>True<\/code>\u306b\u8a2d\u5b9a\u3059\u308b\u3068\u3001\u6570\u5217\u3068\u5171\u306b\u9593\u9694\u304c\u8fd4\u3055\u308c\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import numpy as np\n\narr, step = np.linspace(0, 1, num=5, retstep=True)\nprint(arr)   # \u51fa\u529b\uff1a[0.   0.25 0.5  0.75 1.  ]\nprint(step)  # \u51fa\u529b\uff1a0.25<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u308c\u3089\u306e\u30aa\u30d7\u30b7\u30e7\u30f3\u5f15\u6570\u3092\u4f7f\u3044\u3053\u306a\u3059\u3053\u3068\u3067\u3001<code>linspace<\/code>\u306e\u51fa\u529b\u3092\u3088\u308a\u7d30\u304b\u304f\u5236\u5fa1\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee5\u4e0a\u3001<code>linspace<\/code>\u306e\u5f15\u6570\u306b\u3064\u3044\u3066\u8a73\u3057\u304f\u89e3\u8aac\u3057\u307e\u3057\u305f\u3002<code>start<\/code>\u3001<code>stop<\/code>\u3001<code>num<\/code>\u3092\u9069\u5207\u306b\u8a2d\u5b9a\u3059\u308b\u3053\u3068\u3067\u3001\u7528\u9014\u306b\u5fdc\u3058\u305f\u6570\u5217\u3092\u751f\u6210\u3067\u304d\u308b\u3088\u3046\u306b\u306a\u308b\u3067\u3057\u3087\u3046\u3002\u6b21\u306e\u7ae0\u3067\u306f\u3001<code>linspace<\/code>\u3092\u4f7f\u3063\u305f\u30c7\u30fc\u30bf\u53ef\u8996\u5316\u306e\u65b9\u6cd5\u306b\u3064\u3044\u3066\u5b66\u3073\u307e\u3059\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-7\">3. linspace\u3067\u30c7\u30fc\u30bf\u53ef\u8996\u5316\u306b\u6311\u6226\uff01Matplotlib\u3068\u7d44\u307f\u5408\u308f\u305b\u3088\u3046<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><code>linspace<\/code>\u306f\u3001\u30c7\u30fc\u30bf\u53ef\u8996\u5316\u306e\u5834\u9762\u3067\u3082\u5927\u6d3b\u8e8d\u3057\u307e\u3059\u3002\u3053\u3053\u3067\u306f\u3001Python\u306e\u4ee3\u8868\u7684\u306a\u30b0\u30e9\u30d5\u63cf\u753b\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3042\u308b\u300cMatplotlib\u300d\u3068<code>linspace<\/code>\u3092\u7d44\u307f\u5408\u308f\u305b\u3066\u3001\u7f8e\u3057\u3044\u30b0\u30e9\u30d5\u3092\u4f5c\u6210\u3059\u308b\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-8\">3-1. \u7b49\u9593\u9694\u306ax\u8ef8\u30c7\u30fc\u30bf\u3092linspace\u3067\u4f5c\u308d\u3046<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u30b0\u30e9\u30d5\u3092\u63cf\u753b\u3059\u308b\u969b\u3001x\u8ef8\u306e\u5024\u306f\u7b49\u9593\u9694\u3067\u3042\u308b\u3053\u3068\u304c\u671b\u307e\u3057\u3044\u3053\u3068\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u306e\u3088\u3046\u306a\u5834\u5408\u3001<code>linspace<\/code>\u3092\u4f7f\u3063\u3066\u7b49\u9593\u9694\u306a\u6570\u5217\u3092\u751f\u6210\u3059\u308b\u3068\u4fbf\u5229\u3067\u3059\u3002\u4f8b\u3048\u3070\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b<code>linspace<\/code>\u3092\u4f7f\u3063\u3066x\u8ef8\u306e\u5024\u3092\u751f\u6210\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import numpy as np\nimport matplotlib.pyplot as plt\n\nx = np.linspace(-10, 10, 100)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u306e\u4f8b\u3067\u306f\u3001-10\u304b\u308910\u307e\u3067\u306e\u533a\u9593\u3092100\u7b49\u5206\u3057\u305f\u6570\u5217\u3092x\u8ef8\u306e\u5024\u3068\u3057\u3066\u751f\u6210\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-9\">3-2. sin\u95a2\u6570\u3068cos\u95a2\u6570\u306e\u30b0\u30e9\u30d5\u3092\u63cf\u753b\u3057\u3066\u307f\u3088\u3046<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>linspace<\/code>\u3067\u751f\u6210\u3057\u305fx\u8ef8\u306e\u5024\u3092\u5143\u306b\u3001y\u8ef8\u306e\u5024\u3092\u8a08\u7b97\u3057\u3001\u30b0\u30e9\u30d5\u3092\u63cf\u753b\u3057\u3066\u307f\u307e\u3057\u3087\u3046\u3002\u3053\u3053\u3067\u306f\u3001sin\u95a2\u6570\u3068cos\u95a2\u6570\u3092\u4f8b\u306b\u4f7f\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import numpy as np\nimport matplotlib.pyplot as plt\n\nx = np.linspace(-np.pi, np.pi, 100)\ny_sin = np.sin(x)\ny_cos = np.cos(x)\n\nplt.plot(x, y_sin, label=\"sin\")\nplt.plot(x, y_cos, label=\"cos\")\nplt.xlabel(\"x\")\nplt.ylabel(\"y\")\nplt.title(\"Sine and Cosine Functions\")\nplt.legend()\nplt.show()<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001\u4ee5\u4e0b\u306e\u624b\u9806\u3067\u30b0\u30e9\u30d5\u3092\u63cf\u753b\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li><code>linspace<\/code>\u3067-\u03c0\u304b\u3089\u03c0\u307e\u3067\u306e\u533a\u9593\u3092100\u7b49\u5206\u3057\u305fx\u8ef8\u306e\u5024\u3092\u751f\u6210\u3059\u308b\u3002<\/li>\n\n\n\n<li>x\u8ef8\u306e\u5024\u3092\u5143\u306b\u3001sin\u95a2\u6570\u3068cos\u95a2\u6570\u306e\u5024\u3092\u8a08\u7b97\u3057\u3001y\u8ef8\u306e\u5024\u3068\u3059\u308b\u3002<\/li>\n\n\n\n<li><code>plot<\/code>\u95a2\u6570\u3092\u4f7f\u3063\u3066\u3001x\u8ef8\u3068y\u8ef8\u306e\u5024\u304b\u3089\u30b0\u30e9\u30d5\u3092\u63cf\u753b\u3059\u308b\u3002<\/li>\n\n\n\n<li><code>xlabel<\/code>\u3001<code>ylabel<\/code>\u3001<code>title<\/code>\u95a2\u6570\u3092\u4f7f\u3063\u3066\u3001\u30b0\u30e9\u30d5\u306b\u30e9\u30d9\u30eb\u3084\u30bf\u30a4\u30c8\u30eb\u3092\u8ffd\u52a0\u3059\u308b\u3002<\/li>\n\n\n\n<li><code>legend<\/code>\u95a2\u6570\u3067\u30b0\u30e9\u30d5\u306e\u51e1\u4f8b\u3092\u8868\u793a\u3059\u308b\u3002<\/li>\n<\/ol>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-10\">3-3. \u30b0\u30e9\u30d5\u306e\u30ab\u30b9\u30bf\u30de\u30a4\u30ba \u2013 \u30bf\u30a4\u30c8\u30eb\u3084\u51e1\u4f8b\u3092\u8ffd\u52a0\u3057\u3088\u3046<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u30b0\u30e9\u30d5\u3092\u3088\u308a\u898b\u3084\u3059\u304f\u3059\u308b\u305f\u3081\u306b\u3001\u30bf\u30a4\u30c8\u30eb\u3084\u51e1\u4f8b\u3092\u8ffd\u52a0\u3057\u307e\u3057\u3087\u3046\u3002\u5148\u307b\u3069\u306e\u30b3\u30fc\u30c9\u3067\u306f\u3001\u4ee5\u4e0b\u306e\u95a2\u6570\u3092\u4f7f\u3063\u3066\u30b0\u30e9\u30d5\u3092\u30ab\u30b9\u30bf\u30de\u30a4\u30ba\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>xlabel<\/code>\uff1ax\u8ef8\u306e\u30e9\u30d9\u30eb\u3092\u8a2d\u5b9a\u3059\u308b\u3002<\/li>\n\n\n\n<li><code>ylabel<\/code>\uff1ay\u8ef8\u306e\u30e9\u30d9\u30eb\u3092\u8a2d\u5b9a\u3059\u308b\u3002<\/li>\n\n\n\n<li><code>title<\/code>\uff1a\u30b0\u30e9\u30d5\u306e\u30bf\u30a4\u30c8\u30eb\u3092\u8a2d\u5b9a\u3059\u308b\u3002<\/li>\n\n\n\n<li><code>legend<\/code>\uff1a\u30b0\u30e9\u30d5\u306e\u51e1\u4f8b\u3092\u8868\u793a\u3059\u308b\u3002<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u308c\u3089\u306e\u95a2\u6570\u3092\u4f7f\u3046\u3053\u3068\u3067\u3001\u30b0\u30e9\u30d5\u306e\u5185\u5bb9\u3092\u5206\u304b\u308a\u3084\u3059\u304f\u4f1d\u3048\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee5\u4e0a\u3001<code>linspace<\/code>\u3068Matplotlib\u3092\u7d44\u307f\u5408\u308f\u305b\u305f\u30c7\u30fc\u30bf\u53ef\u8996\u5316\u306e\u65b9\u6cd5\u3092\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002<code>linspace<\/code>\u3067\u7b49\u9593\u9694\u306ax\u8ef8\u306e\u5024\u3092\u751f\u6210\u3057\u3001Matplotlib\u3067\u30b0\u30e9\u30d5\u3092\u63cf\u753b\u3059\u308b\u3053\u3068\u3067\u3001\u7f8e\u3057\u304f\u5206\u304b\u308a\u3084\u3059\u3044\u30b0\u30e9\u30d5\u3092\u4f5c\u6210\u3067\u304d\u307e\u3059\u3002\u6b21\u306e\u7ae0\u3067\u306f\u3001<code>linspace<\/code>\u306e\u5b9f\u8df5\u7684\u306a\u5fdc\u7528\u4f8b\u3092\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-11\">4. linspace\u306e\u5fdc\u7528\u4f8b \u2013 \u79d1\u5b66\u8a08\u7b97\u304b\u3089\u6a5f\u68b0\u5b66\u7fd2\u307e\u3067<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\"><code>linspace<\/code>\u306f\u3001\u30c7\u30fc\u30bf\u53ef\u8996\u5316\u3060\u3051\u3067\u306a\u304f\u3001\u79d1\u5b66\u8a08\u7b97\u3084\u6a5f\u68b0\u5b66\u7fd2\u306e\u5206\u91ce\u3067\u3082\u5e83\u304f\u6d3b\u7528\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u3053\u3053\u3067\u306f\u3001<code>linspace<\/code>\u3092\u4f7f\u3063\u305f\u6570\u5024\u7a4d\u5206\u3001\u5fae\u5206\u65b9\u7a0b\u5f0f\u306e\u89e3\u6cd5\u3001\u6a5f\u68b0\u5b66\u7fd2\u306e\u30c7\u30fc\u30bf\u524d\u51e6\u7406\u306e\u4f8b\u3092\u7d39\u4ecb\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-12\">4-1. \u6570\u5024\u7a4d\u5206\u3067\u9762\u7a4d\u3092\u6c42\u3081\u3088\u3046<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u6570\u5024\u7a4d\u5206\u306f\u3001\u95a2\u6570\u306e\u5b9a\u7a4d\u5206\u3092\u6570\u5024\u7684\u306b\u8a08\u7b97\u3059\u308b\u65b9\u6cd5\u3067\u3059\u3002<code>linspace<\/code>\u3092\u4f7f\u3063\u3066\u7a4d\u5206\u533a\u9593\u3092\u7b49\u5206\u5272\u3057\u3001\u53f0\u5f62\u516c\u5f0f\u3084Simpson\u2019s rule\u3092\u9069\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u6570\u5024\u7a4d\u5206\u3092\u884c\u3046\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4ee5\u4e0b\u306f\u3001<code>linspace<\/code>\u3068<code>scipy<\/code>\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u3063\u305f\u6570\u5024\u7a4d\u5206\u306e\u4f8b\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import numpy as np\nfrom scipy import integrate\n\ndef f(x):\n    return np.sin(x)\n\na, b = 0, np.pi\nx = np.linspace(a, b, 100)\ny = f(x)\n\nintegral_trapz = integrate.trapz(y, x)\nprint(f\"Trapezoidal rule: {integral_trapz}\")<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u306e\u4f8b\u3067\u306f\u3001sin\u95a2\u6570\u306e0\u304b\u3089\u03c0\u307e\u3067\u306e\u5b9a\u7a4d\u5206\u3092\u53f0\u5f62\u516c\u5f0f\u3067\u8a08\u7b97\u3057\u3066\u3044\u307e\u3059\u3002<code>linspace<\/code>\u3067\u7a4d\u5206\u533a\u9593\u3092100\u7b49\u5206\u3057\u3001<code>scipy.integrate.trapz<\/code>\u95a2\u6570\u3067\u6570\u5024\u7a4d\u5206\u3092\u5b9f\u884c\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-13\">4-2. \u5e38\u5fae\u5206\u65b9\u7a0b\u5f0f\u3092\u89e3\u3044\u3066\u307f\u3088\u3046<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u5e38\u5fae\u5206\u65b9\u7a0b\u5f0f\u306f\u3001\u7269\u7406\u73fe\u8c61\u3084\u5de5\u5b66\u554f\u984c\u3092\u6570\u5b66\u7684\u306b\u30e2\u30c7\u30eb\u5316\u3059\u308b\u969b\u306b\u983b\u7e41\u306b\u767b\u5834\u3057\u307e\u3059\u3002<code>linspace<\/code>\u3092\u4f7f\u3063\u3066\u6642\u9593\u8ef8\u3092\u7b49\u5206\u5272\u3057\u3001Euler\u6cd5\u3084Runge-Kutta\u6cd5\u306a\u3069\u306e\u6570\u5024\u89e3\u6cd5\u3092\u9069\u7528\u3059\u308b\u3053\u3068\u3067\u3001\u5e38\u5fae\u5206\u65b9\u7a0b\u5f0f\u3092\u89e3\u304f\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4ee5\u4e0b\u306f\u3001<code>linspace<\/code>\u3068<code>scipy<\/code>\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u3063\u305f\u5e38\u5fae\u5206\u65b9\u7a0b\u5f0f\u306e\u89e3\u6cd5\u4f8b\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import numpy as np\nfrom scipy.integrate import odeint\n\ndef model(y, t):\n    dydt = -2 * y\n    return dydt\n\nt = np.linspace(0, 10, 100)\ny0 = 1\ny = odeint(model, y0, t)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u306e\u4f8b\u3067\u306f\u3001<code>dy\/dt = -2y<\/code>\u3068\u3044\u3046\u5e38\u5fae\u5206\u65b9\u7a0b\u5f0f\u3092\u89e3\u3044\u3066\u3044\u307e\u3059\u3002<code>linspace<\/code>\u3067\u6642\u9593\u8ef8\u3092100\u7b49\u5206\u3057\u3001<code>scipy.integrate.odeint<\/code>\u95a2\u6570\u3067\u6570\u5024\u89e3\u3092\u6c42\u3081\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-14\">4-3. \u6a5f\u68b0\u5b66\u7fd2\u306e\u30c7\u30fc\u30bf\u524d\u51e6\u7406\u306blinspace\u3092\u6d3b\u7528\u3057\u3088\u3046<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">\u6a5f\u68b0\u5b66\u7fd2\u3067\u306f\u3001\u30c7\u30fc\u30bf\u306e\u524d\u51e6\u7406\u304c\u91cd\u8981\u306a\u5f79\u5272\u3092\u679c\u305f\u3057\u307e\u3059\u3002<code>linspace<\/code>\u3092\u4f7f\u3063\u3066\u30c7\u30fc\u30bf\u3092\u30ea\u30b5\u30f3\u30d7\u30ea\u30f3\u30b0\u3057\u305f\u308a\u3001\u7279\u5fb4\u91cf\u306e\u7bc4\u56f2\u3092\u6b63\u898f\u5316\u3057\u305f\u308a\u3059\u308b\u3053\u3068\u3067\u3001\u6a5f\u68b0\u5b66\u7fd2\u30e2\u30c7\u30eb\u306e\u6027\u80fd\u3092\u5411\u4e0a\u3055\u305b\u308b\u3053\u3068\u304c\u3067\u304d\u307e\u3059\u3002\u4ee5\u4e0b\u306f\u3001<code>linspace<\/code>\u3068<code>scikit-learn<\/code>\u30e9\u30a4\u30d6\u30e9\u30ea\u3092\u4f7f\u3063\u305f\u30c7\u30fc\u30bf\u524d\u51e6\u7406\u306e\u4f8b\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import numpy as np\nfrom sklearn.preprocessing import MinMaxScaler\n\ndata = np.random.randint(0, 100, size=(10, 3))\nresampled_data = np.linspace(data.min(), data.max(), num=50)\n\nscaler = MinMaxScaler()\nnormalized_data = scaler.fit_transform(data)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u306e\u4f8b\u3067\u306f\u3001\u30e9\u30f3\u30c0\u30e0\u306b\u751f\u6210\u3057\u305f10\u00d73\u306e\u884c\u5217\u30c7\u30fc\u30bf\u3092\u3001<code>linspace<\/code>\u3092\u4f7f\u3063\u3066\u6700\u5c0f\u5024\u304b\u3089\u6700\u5927\u5024\u307e\u3067\u306e\u7bc4\u56f2\u306750\u500b\u306e\u7b49\u9593\u9694\u306a\u5024\u306b\u30ea\u30b5\u30f3\u30d7\u30ea\u30f3\u30b0\u3057\u3066\u3044\u307e\u3059\u3002\u307e\u305f\u3001<code>MinMaxScaler<\/code>\u3092\u4f7f\u3063\u3066\u30c7\u30fc\u30bf\u30920\u304b\u30891\u306e\u7bc4\u56f2\u306b\u6b63\u898f\u5316\u3057\u3066\u3044\u307e\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee5\u4e0a\u3001<code>linspace<\/code>\u306e\u5b9f\u8df5\u7684\u306a\u5fdc\u7528\u4f8b\u3092\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002\u6570\u5024\u7a4d\u5206\u3001\u5fae\u5206\u65b9\u7a0b\u5f0f\u306e\u89e3\u6cd5\u3001\u6a5f\u68b0\u5b66\u7fd2\u306e\u30c7\u30fc\u30bf\u524d\u51e6\u7406\u306a\u3069\u3001\u69d8\u3005\u306a\u5206\u91ce\u3067<code>linspace<\/code>\u304c\u6d3b\u8e8d\u3057\u3066\u3044\u308b\u3053\u3068\u304c\u308f\u304b\u308a\u307e\u3059\u3002\u6b21\u306e\u7ae0\u3067\u306f\u3001Numpy\u306e\u4ed6\u306e\u4fbf\u5229\u306a\u95a2\u6570\u306b\u3064\u3044\u3066\u3082\u898b\u3066\u3044\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h2 class=\"wp-block-heading\" id=\"i-15\">5. Numpy\u306e\u305d\u306e\u4ed6\u306e\u4fbf\u5229\u6a5f\u80fd\u3082\u8981\u30c1\u30a7\u30c3\u30af\uff01<\/h2>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001<code>linspace<\/code>\u3092\u4e2d\u5fc3\u306bNumpy\u306e\u6a5f\u80fd\u3092\u7d39\u4ecb\u3057\u3066\u304d\u307e\u3057\u305f\u3002\u3057\u304b\u3057\u3001Numpy\u306b\u306f\u307e\u3060\u307e\u3060\u4fbf\u5229\u306a\u95a2\u6570\u304c\u3042\u308a\u307e\u3059\u3002\u3053\u3053\u3067\u306f\u3001<code>arange<\/code>\u3001<code>random<\/code>\u3001\u305d\u3057\u3066\u305d\u306e\u4ed6\u306eNumpy\u95a2\u6570\u306b\u3064\u3044\u3066\u7c21\u5358\u306b\u89e6\u308c\u3066\u304a\u304d\u307e\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-16\">5-1. arange \u2013 \u7b49\u5dee\u6570\u5217\u3092\u751f\u6210\u3057\u3088\u3046<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>arange<\/code>\u306f\u3001<code>linspace<\/code>\u3068\u540c\u69d8\u306b\u7b49\u9593\u9694\u306a\u6570\u5217\u3092\u751f\u6210\u3059\u308b\u95a2\u6570\u3067\u3059\u304c\u3001\u30b9\u30c6\u30c3\u30d7\u5e45\u3092\u6307\u5b9a\u3067\u304d\u308b\u70b9\u304c\u7570\u306a\u308a\u307e\u3059\u3002\u4ee5\u4e0b\u306f\u3001<code>arange<\/code>\u306e\u4f7f\u7528\u4f8b\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import numpy as np\n\narr = np.arange(0, 10, 2)\nprint(arr)  # \u51fa\u529b\uff1a[0 2 4 6 8]<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u306e\u4f8b\u3067\u306f\u30010\u304b\u308910\u307e\u3067\u306e\u7bc4\u56f2\u3067\u3001\u30b9\u30c6\u30c3\u30d7\u5e452\u306e\u7b49\u5dee\u6570\u5217\u3092\u751f\u6210\u3057\u3066\u3044\u307e\u3059\u3002<code>linspace<\/code>\u306f\u8981\u7d20\u6570\u3092\u6307\u5b9a\u3059\u308b\u306e\u306b\u5bfe\u3057\u3001<code>arange<\/code>\u306f\u30b9\u30c6\u30c3\u30d7\u5e45\u3092\u6307\u5b9a\u3059\u308b\u306e\u3067\u3001\u72b6\u6cc1\u306b\u5fdc\u3058\u3066\u4f7f\u3044\u5206\u3051\u308b\u3068\u826f\u3044\u3067\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-17\">5-2. random \u2013 \u4e71\u6570\u751f\u6210\u306e\u5f37\u3044\u5473\u65b9<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\"><code>random<\/code>\u306f\u3001\u4e71\u6570\u3092\u751f\u6210\u3059\u308b\u305f\u3081\u306e\u95a2\u6570\u7fa4\u3067\u3059\u3002\u69d8\u3005\u306a\u78ba\u7387\u5206\u5e03\u306b\u5f93\u3046\u4e71\u6570\u3092\u751f\u6210\u3067\u304d\u307e\u3059\u3002\u4ee5\u4e0b\u306f\u3001<code>random<\/code>\u306e\u4f7f\u7528\u4f8b\u3067\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import numpy as np\n\nnp.random.seed(0)\narr = np.random.rand(3, 3)\nprint(arr)  # \u51fa\u529b\uff1a[[0.5488135  0.71518937 0.60276338]\n            #       [0.54488318 0.4236548  0.64589411]\n            #       [0.43758721 0.891773   0.96366276]]<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u306e\u4f8b\u3067\u306f\u3001<code>seed<\/code>\u95a2\u6570\u3067\u4e71\u6570\u306e\u30b7\u30fc\u30c9\u5024\u3092\u8a2d\u5b9a\u3057\u3001<code>rand<\/code>\u95a2\u6570\u30670\u304b\u30891\u306e\u9593\u306e\u4e00\u69d8\u4e71\u6570\u30923\u00d73\u306e\u884c\u5217\u3067\u751f\u6210\u3057\u3066\u3044\u307e\u3059\u3002\u4ed6\u306b\u3082\u3001\u6b63\u898f\u5206\u5e03\u306b\u5f93\u3046\u4e71\u6570\u3092\u751f\u6210\u3059\u308b<code>randn<\/code>\u3001\u6574\u6570\u306e\u4e71\u6570\u3092\u751f\u6210\u3059\u308b<code>randint<\/code>\u3084<code>random_integer<\/code>\u306a\u3069\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i-18\">5-3. \u305d\u306e\u4ed6\u306eNumpy\u95a2\u6570\u3082\u899a\u3048\u3066\u304a\u3053\u3046<\/h3>\n\n\n\n<p class=\"wp-block-paragraph\">Numpy\u306b\u306f\u3001\u6570\u5b66\u7684\u306a\u8a08\u7b97\u306b\u5f79\u7acb\u3064\u95a2\u6570\u304c\u6570\u591a\u304f\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u4f8b\u3048\u3070\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306a\u95a2\u6570\u304c\u3042\u308a\u307e\u3059\u3002<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li><code>zeros<\/code>\u3001<code>ones<\/code>\uff1a\u6307\u5b9a\u3055\u308c\u305f\u5f62\u72b6\u306e\u914d\u5217\u3092\u3001\u5168\u30660\u307e\u305f\u306f1\u3067\u521d\u671f\u5316\u3059\u308b\u3002<\/li>\n\n\n\n<li><code>eye<\/code>\uff1a\u5358\u4f4d\u884c\u5217\u3092\u751f\u6210\u3059\u308b\u3002<\/li>\n\n\n\n<li><code>diag<\/code>\uff1a\u5bfe\u89d2\u884c\u5217\u3092\u751f\u6210\u3059\u308b\u3002<\/li>\n\n\n\n<li><code>tri<\/code>\uff1a\u4e09\u89d2\u884c\u5217\u3092\u751f\u6210\u3059\u308b\u3002<\/li>\n<\/ul>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u308c\u3089\u306e\u95a2\u6570\u3092\u4f7f\u3046\u5834\u5408\u3001\u4ee5\u4e0b\u306e\u3088\u3046\u306b\u3057\u307e\u3059\u3002<\/p>\n\n\n\n<pre class=\"EnlighterJSRAW\" data-enlighter-language=\"generic\" data-enlighter-theme=\"\" data-enlighter-highlight=\"\" data-enlighter-linenumbers=\"\" data-enlighter-lineoffset=\"\" data-enlighter-title=\"\" data-enlighter-group=\"\">import numpy as np\n\nzeros_arr = np.zeros((2, 2))\nones_arr = np.ones((3, 3))\neye_arr = np.eye(3)\ndiag_arr = np.diag([1, 2, 3])\ntri_arr = np.tri(3)<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u3053\u308c\u3089\u306e\u95a2\u6570\u306f\u3001\u884c\u5217\u8a08\u7b97\u3084\u6570\u5024\u8a08\u7b97\u306e\u969b\u306b\u983b\u7e41\u306b\u4f7f\u308f\u308c\u307e\u3059\u3002Numpy\u3092\u4f7f\u3044\u3053\u306a\u3059\u305f\u3081\u306b\u306f\u3001\u3053\u308c\u3089\u306e\u95a2\u6570\u306b\u3082\u6163\u308c\u89aa\u3057\u3093\u3067\u304a\u304f\u3053\u3068\u304c\u5927\u5207\u3067\u3059\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u4ee5\u4e0a\u3001Numpy\u306e<code>arange<\/code>\u3001<code>random<\/code>\u3001\u305d\u3057\u3066\u305d\u306e\u4ed6\u306e\u4fbf\u5229\u306a\u95a2\u6570\u306b\u3064\u3044\u3066\u7d39\u4ecb\u3057\u307e\u3057\u305f\u3002Numpy\u306f\u3001\u6570\u5024\u8a08\u7b97\u3084\u30c7\u30fc\u30bf\u5206\u6790\u306b\u6b20\u304b\u305b\u306a\u3044\u30e9\u30a4\u30d6\u30e9\u30ea\u3067\u3059\u3002\u3053\u306e\u8a18\u4e8b\u3067\u7d39\u4ecb\u3057\u305f\u95a2\u6570\u3092\u4f7f\u3044\u3053\u306a\u305b\u308b\u3088\u3046\u306b\u306a\u308c\u3070\u3001Python\u3067\u306e\u30c7\u30fc\u30bf\u51e6\u7406\u306e\u5e45\u304c\u5927\u304d\u304f\u5e83\u304c\u308b\u3067\u3057\u3087\u3046\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">Numpy\u306e\u516c\u5f0f\u30c9\u30ad\u30e5\u30e1\u30f3\u30c8\u306b\u306f\u3001\u3055\u3089\u306b\u591a\u304f\u306e\u95a2\u6570\u3084\u4f7f\u7528\u4f8b\u304c\u63b2\u8f09\u3055\u308c\u3066\u3044\u307e\u3059\u3002\u305c\u3072\u4e00\u5ea6\u76ee\u3092\u901a\u3057\u3066\u307f\u3066\u304f\u3060\u3055\u3044\u3002\u304d\u3063\u3068\u3042\u306a\u305f\u306ePython\u30d7\u30ed\u30b0\u30e9\u30df\u30f3\u30b0\u306b\u5f79\u7acb\u3064\u306f\u305a\u3067\u3059\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>Python\u3067\u30c7\u30fc\u30bf\u5206\u6790\u3084\u79d1\u5b66\u8a08\u7b97\u3092\u884c\u3046\u4e0a\u3067\u6b20\u304b\u305b\u306a\u3044\u30e9\u30a4\u30d6\u30e9\u30ea\u3068\u3044\u3048\u3070\u3001Numpy\u3067\u3059\u3002Numpy\u306b\u306f\u6570\u591a\u304f\u306e\u4fbf\u5229\u306a\u95a2\u6570\u304c\u7528\u610f\u3055\u308c\u3066\u3044\u307e\u3059\u304c\u3001\u4e2d\u3067\u3082linspace\u306f\u7279\u306b\u91cd\u8981\u306a\u95a2\u6570\u306e\u4e00\u3064\u3067\u3059\u3002\u3053\u306e\u8a18\u4e8b\u3067\u306f\u3001linspa &#8230; <\/p>\n","protected":false},"author":1,"featured_media":839,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-803","post","type-post","status-publish","format-standard","has-post-thumbnail","category-python"],"_links":{"self":[{"href":"https:\/\/chocottopro.com\/index.php?rest_route=\/wp\/v2\/posts\/803","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/chocottopro.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/chocottopro.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/chocottopro.com\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/chocottopro.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=803"}],"version-history":[{"count":1,"href":"https:\/\/chocottopro.com\/index.php?rest_route=\/wp\/v2\/posts\/803\/revisions"}],"predecessor-version":[{"id":804,"href":"https:\/\/chocottopro.com\/index.php?rest_route=\/wp\/v2\/posts\/803\/revisions\/804"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/chocottopro.com\/index.php?rest_route=\/wp\/v2\/media\/839"}],"wp:attachment":[{"href":"https:\/\/chocottopro.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=803"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/chocottopro.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=803"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/chocottopro.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=803"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}