<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>数学定数 アーカイブ - 自動売買を作ろう！</title>
	<atom:link href="https://mql-programing.com/archives/tag/%e6%95%b0%e5%ad%a6%e5%ae%9a%e6%95%b0/feed/" rel="self" type="application/rss+xml" />
	<link>https://mql-programing.com/archives/tag/数学定数/</link>
	<description>MQLプログラミング学習サイト</description>
	<lastBuildDate>Tue, 31 Mar 2026 13:03:49 +0000</lastBuildDate>
	<language>ja</language>
	<sy:updatePeriod>
	hourly	</sy:updatePeriod>
	<sy:updateFrequency>
	1	</sy:updateFrequency>
	<generator>https://wordpress.org/?v=6.9.4</generator>

<image>
	<url>https://mql-programing.com/main29/wp-content/uploads/2021/02/cropped-ブログアイコン-32x32.jpg</url>
	<title>数学定数 アーカイブ - 自動売買を作ろう！</title>
	<link>https://mql-programing.com/archives/tag/数学定数/</link>
	<width>32</width>
	<height>32</height>
</image> 
	<item>
		<title>【MQL4定数】数学定数​（M_○○）</title>
		<link>https://mql-programing.com/archives/2751/math/</link>
		
		<dc:creator><![CDATA[朝日奈りさ]]></dc:creator>
		<pubDate>Sat, 07 May 2022 05:37:19 +0000</pubDate>
				<category><![CDATA[【辞書】MQLリファレンス]]></category>
		<category><![CDATA[定数]]></category>
		<category><![CDATA[MQL]]></category>
		<category><![CDATA[リファレンス]]></category>
		<category><![CDATA[M_]]></category>
		<category><![CDATA[数学定数]]></category>
		<category><![CDATA[math]]></category>
		<guid isPermaLink="false">https://mql-programing.com/?p=2751</guid>

					<description><![CDATA[<p>数学定数​（M_○○） 数学定数​は、数学でよく使われる数値を定数にしたものです。 プログラムで計算させて数値を求めることも可能ですが、定数としてまとめられているので、こちらを使用すると良いでしょう。 数学のロジックを組 [&#8230;]</p>
<p>投稿 <a href="https://mql-programing.com/archives/2751/math/">【MQL4定数】数学定数​（M_○○）</a> は <a href="https://mql-programing.com">自動売買を作ろう！</a> に最初に表示されました。</p>
]]></description>
										<content:encoded><![CDATA[
<h2 class="wp-block-heading"><span id="toc1">数学定数​（M_○○）</span></h2>



<p>数学定数​は、数学でよく使われる数値を定数にしたものです。</p>



<p>プログラムで計算させて数値を求めることも可能ですが、定数としてまとめられているので、こちらを使用すると良いでしょう。</p>



<p>数学のロジックを組み込むときに役に立ちます。</p>



<p>　</p>



<h3 class="wp-block-heading"><span id="toc2">数学定数​（M_○○）</span></h3>



<figure class="wp-block-table alignfull is-style-stripes"><table><tbody><tr><td><strong>定数</strong></td><td><strong>数値</strong></td><td><strong>説明</strong></td></tr><tr><td>M_E</td><td>2.71828182845904523536</td><td>指数関数ネイピア定数：e</td></tr><tr><td>M_LOG2E</td><td>1.44269504088896340736</td><td>対数：log2(e)</td></tr><tr><td>M_LOG10E</td><td>0.434294481903251827651</td><td>対数：log10(e)</td></tr><tr><td>M_LN2</td><td>0.693147180559945309417</td><td>自然対数：ln(2)</td></tr><tr><td>M_LN10</td><td>2.30258509299404568402</td><td>自然対数：ln(10)</td></tr><tr><td>M_PI</td><td>3.14159265358979323846</td><td>円周率：pi</td></tr><tr><td>M_PI_2</td><td>1.57079632679489661923</td><td>円周率：pi/2</td></tr><tr><td>M_PI_4</td><td>0.785398163397448309616</td><td>円周率：pi/4</td></tr><tr><td>M_1_PI</td><td>0.318309886183790671538</td><td>円周率：1/pi</td></tr><tr><td>M_2_PI</td><td>0.636619772367581343076</td><td>円周率：2/pi</td></tr><tr><td>M_2_SQRTPI</td><td>1.12837916709551257390</td><td>平方根：2/sqrt(pi)</td></tr><tr><td>M_SQRT2</td><td>1.41421356237309504880</td><td>平方根：sqrt(2)</td></tr><tr><td>M_SQRT1_2</td><td>0.707106781186547524401</td><td>平方根：1/sqrt(2)</td></tr></tbody></table></figure>



<p>　</p>



<h2 class="wp-block-heading"><span id="toc3">数学定数​（M_○○）の使い方</span></h2>



<p>数学定数を使いたいときに使用します。</p>



<p>主に数学のロジックを組み込みたいときに使うので、使う場面は限られてきます。</p>



<p>例えば、円の面積を計算する場合は、以下のように使用します。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-cpp" data-lang="C++"><code>void OnInit() {
    double hankei = 3.0;
    double menseki = hankei * hankei * M_PI;
    Print("円の面積 = ", menseki);
}</code></pre></div>



<p>　</p>



<h2 class="wp-block-heading"><span id="toc4">数学定数​（M_○○）を使ったプログラム例</span></h2>



<p>以下は、複数の数学定数を使った簡単なプログラム例です。各定数の値をエキスパートログに出力して確認します。</p>



<div class="hcb_wrap"><pre class="prism line-numbers lang-cpp" data-lang="MQL4"><code>//+------------------------------------------------------------------+
//| 数学定数の表示サンプル                                            |
//+------------------------------------------------------------------+
void OnInit()
{
    // ネイピア数 e
    Print("M_E = ", M_E);

    // 円周率 pi
    Print("M_PI = ", M_PI);

    // 円の面積を計算（半径5.0の場合）
    double hankei = 5.0;
    double menseki = hankei * hankei * M_PI;
    Print("半径 ", hankei, " の円の面積 = ", menseki);

    // 自然対数 ln(2) を使った計算例
    // 2のn乗がある値を超えるnを求める
    double targetValue = 1000.0;
    double n = MathLog(targetValue) / M_LN2;
    Print("2の ", n, " 乗 ≒ ", targetValue);

    // 平方根定数の確認
    Print("M_SQRT2 = ", M_SQRT2);
    Print("M_SQRT1_2 = ", M_SQRT1_2);

    // 角度をラジアンに変換する例（90度 → ラジアン）
    double degree = 90.0;
    double radian = degree * M_PI / 180.0;
    Print(degree, "度 = ", radian, " ラジアン");

    // sin, cos の計算例
    Print("sin(M_PI_2) = ", MathSin(M_PI_2));  // sin(pi/2) = 1.0
    Print("cos(M_PI_4) = ", MathCos(M_PI_4));  // cos(pi/4) ≒ 0.7071
}</code></pre></div>



<p>このプログラムでは、円の面積の計算、自然対数を使った計算、角度のラジアン変換、三角関数の計算など、数学定数を活用した基本的な使い方を紹介しています。</p>



<p>　</p>



<div class="wp-block-cocoon-blocks-button-1 button-block"><a href="https://mql-programing.com/sample_program/" class="btn btn-l btn-circle" target="_self">サンプルプログラムはこちら</a></div>



<p>　</p>



<figure class="wp-block-embed is-type-wp-embed is-provider-自動売買を作ろう！ wp-block-embed-自動売買を作ろう！"><div class="wp-block-embed__wrapper">

<a href="https://mql-programing.com/make_autotrade_by_myself/" title="【MQL4プログラミング】自動売買の作り方！FXで使えるテンプレートあり" class="blogcard-wrap external-blogcard-wrap a-wrap cf" target="_blank"><div class="blogcard external-blogcard eb-left cf"><div class="blogcard-label external-blogcard-label"><span class="fa"></span></div><figure class="blogcard-thumbnail external-blogcard-thumbnail"><img decoding="async" src="https://i0.wp.com/mql-programing.com/main29/wp-content/uploads/2021/09/make_autotrade_by_myself.jpg?fit=1200%2C675&#038;ssl=1" alt="" class="blogcard-thumb-image external-blogcard-thumb-image" width="160" height="90" /></figure><div class="blogcard-content external-blogcard-content"><div class="blogcard-title external-blogcard-title">【MQL4プログラミング】自動売買の作り方！FXで使えるテンプレートあり</div><div class="blogcard-snippet external-blogcard-snippet">目次 はじめにFX自動売買とはFX自動売買を作るための準備FX自動売買の作り方口座凍結の対策をするプログラムテンプレートを作る決済ロジックをプログラミングするプログラムテンプレートを作るエントリーロジックをプログラミング</div></div><div class="blogcard-footer external-blogcard-footer cf"><div class="blogcard-site external-blogcard-site"><div class="blogcard-favicon external-blogcard-favicon"><img decoding="async" src="https://www.google.com/s2/favicons?domain=https://mql-programing.com/archives/1605/make_autotrade_by_myself/" alt="" class="blogcard-favicon-image external-blogcard-favicon-image" width="16" height="16" /></div><div class="blogcard-domain external-blogcard-domain">mql-programing.com</div></div></div></div></a>
</div></figure>



<figure class="wp-block-embed is-type-wp-embed is-provider-自動売買を作ろう！ wp-block-embed-自動売買を作ろう！"><div class="wp-block-embed__wrapper">

<a href="https://mql-programing.com/mql-reference/" title="MQL4リファレンス【全データ一覧】" class="blogcard-wrap internal-blogcard-wrap a-wrap cf"><div class="blogcard internal-blogcard ib-left cf"><div class="blogcard-label internal-blogcard-label"><span class="fa"></span></div><figure class="blogcard-thumbnail internal-blogcard-thumbnail"><img decoding="async" width="160" height="90" src="https://mql-programing.com/main29/wp-content/uploads/2021/02/MQLリファレンス-160x90.jpg" class="blogcard-thumb-image internal-blogcard-thumb-image wp-post-image" alt="" srcset="https://mql-programing.com/main29/wp-content/uploads/2021/02/MQLリファレンス-160x90.jpg 160w, https://mql-programing.com/main29/wp-content/uploads/2021/02/MQLリファレンス-300x169.jpg 300w, https://mql-programing.com/main29/wp-content/uploads/2021/02/MQLリファレンス-1024x576.jpg 1024w, https://mql-programing.com/main29/wp-content/uploads/2021/02/MQLリファレンス-768x432.jpg 768w, https://mql-programing.com/main29/wp-content/uploads/2021/02/MQLリファレンス-120x68.jpg 120w, https://mql-programing.com/main29/wp-content/uploads/2021/02/MQLリファレンス-320x180.jpg 320w, https://mql-programing.com/main29/wp-content/uploads/2021/02/MQLリファレンス.jpg 1120w" sizes="(max-width: 160px) 100vw, 160px" /></figure><div class="blogcard-content internal-blogcard-content"><div class="blogcard-title internal-blogcard-title">MQL4リファレンス【全データ一覧】</div><div class="blogcard-snippet internal-blogcard-snippet">/*! elementor - v3.6.5 - 27-04-2022 */.e-container.e-container--row .elementor-spacer-inner{width:var(--spacer-size)}.e-</div></div><div class="blogcard-footer internal-blogcard-footer cf"><div class="blogcard-site internal-blogcard-site"><div class="blogcard-favicon internal-blogcard-favicon"><img loading="lazy" decoding="async" src="https://www.google.com/s2/favicons?domain=https://mql-programing.com" alt="" class="blogcard-favicon-image internal-blogcard-favicon-image" width="16" height="16" /></div><div class="blogcard-domain internal-blogcard-domain">mql-programing.com</div></div></div></div></a>
</div></figure>



<p>　</p>
<p>投稿 <a href="https://mql-programing.com/archives/2751/math/">【MQL4定数】数学定数​（M_○○）</a> は <a href="https://mql-programing.com">自動売買を作ろう！</a> に最初に表示されました。</p>
]]></content:encoded>
					
		
		
			</item>
	</channel>
</rss>
