Math.Exp(Double) メソッド
定義
重要
一部の情報は、リリース前に大きく変更される可能性があるプレリリースされた製品に関するものです。 Microsoft は、ここに記載されている情報について、明示または黙示を問わず、一切保証しません。
指定した値で e
を累乗した値を返します。
public:
static double Exp(double d);
public static double Exp (double d);
static member Exp : double -> double
Public Shared Function Exp (d As Double) As Double
パラメーター
- d
- Double
累乗を指定する数値。
戻り値
数値 e
を d
で累乗した値。
d
が NaN または PositiveInfinity のいずれかに等しい場合は、その値が返されます。
d
が NegativeInfinity に等しい場合は、0 が返されます。
例
次の例では、 を使用 Exp して、選択した値の特定の指数 ID と対数 ID を評価します。
// Example for the Math::Exp( double ) method.
using namespace System;
// Evaluate logarithmic/exponential identity with a given argument.
void UseLnExp( double arg )
{
// Evaluate e ^ ln(X) == ln(e ^ X) == X.
Console::WriteLine( "\n Math::Exp(Math::Log({0})) == {1:E16}\n"
" Math::Log(Math::Exp({0})) == {2:E16}", arg, Math::Exp( Math::Log( arg ) ), Math::Log( Math::Exp( arg ) ) );
}
// Evaluate exponential identities that are functions of two arguments.
void UseTwoArgs( double argX, double argY )
{
// Evaluate (e ^ X) * (e ^ Y) == e ^ (X + Y).
Console::WriteLine( "\nMath::Exp({0}) * Math::Exp({1}) == {2:E16}"
"\n Math::Exp({0} + {1}) == {3:E16}", argX, argY, Math::Exp( argX ) * Math::Exp( argY ), Math::Exp( argX + argY ) );
// Evaluate (e ^ X) ^ Y == e ^ (X * Y).
Console::WriteLine( " Math::Pow(Math::Exp({0}), {1}) == {2:E16}"
"\n Math::Exp({0} * {1}) == {3:E16}", argX, argY, Math::Pow( Math::Exp( argX ), argY ), Math::Exp( argX * argY ) );
// Evaluate X ^ Y == e ^ (Y * ln(X)).
Console::WriteLine( " Math::Pow({0}, {1}) == {2:E16}"
"\nMath::Exp({1} * Math::Log({0})) == {3:E16}", argX, argY, Math::Pow( argX, argY ), Math::Exp( argY * Math::Log( argX ) ) );
}
int main()
{
Console::WriteLine( "This example of Math::Exp( double ) "
"generates the following output.\n" );
Console::WriteLine( "Evaluate [e ^ ln(X) == ln(e ^ X) == X] "
"with selected values for X:" );
UseLnExp( 0.1 );
UseLnExp( 1.2 );
UseLnExp( 4.9 );
UseLnExp( 9.9 );
Console::WriteLine( "\nEvaluate these identities with "
"selected values for X and Y:" );
Console::WriteLine( " (e ^ X) * (e ^ Y) == e ^ (X + Y)" );
Console::WriteLine( " (e ^ X) ^ Y == e ^ (X * Y)" );
Console::WriteLine( " X ^ Y == e ^ (Y * ln(X))" );
UseTwoArgs( 0.1, 1.2 );
UseTwoArgs( 1.2, 4.9 );
UseTwoArgs( 4.9, 9.9 );
}
/*
This example of Math::Exp( double ) generates the following output.
Evaluate [e ^ ln(X) == ln(e ^ X) == X] with selected values for X:
Math::Exp(Math::Log(0.1)) == 1.0000000000000001E-001
Math::Log(Math::Exp(0.1)) == 1.0000000000000008E-001
Math::Exp(Math::Log(1.2)) == 1.2000000000000000E+000
Math::Log(Math::Exp(1.2)) == 1.2000000000000000E+000
Math::Exp(Math::Log(4.9)) == 4.9000000000000012E+000
Math::Log(Math::Exp(4.9)) == 4.9000000000000004E+000
Math::Exp(Math::Log(9.9)) == 9.9000000000000004E+000
Math::Log(Math::Exp(9.9)) == 9.9000000000000004E+000
Evaluate these identities with selected values for X and Y:
(e ^ X) * (e ^ Y) == e ^ (X + Y)
(e ^ X) ^ Y == e ^ (X * Y)
X ^ Y == e ^ (Y * ln(X))
Math::Exp(0.1) * Math::Exp(1.2) == 3.6692966676192444E+000
Math::Exp(0.1 + 1.2) == 3.6692966676192444E+000
Math::Pow(Math::Exp(0.1), 1.2) == 1.1274968515793757E+000
Math::Exp(0.1 * 1.2) == 1.1274968515793757E+000
Math::Pow(0.1, 1.2) == 6.3095734448019331E-002
Math::Exp(1.2 * Math::Log(0.1)) == 6.3095734448019344E-002
Math::Exp(1.2) * Math::Exp(4.9) == 4.4585777008251705E+002
Math::Exp(1.2 + 4.9) == 4.4585777008251716E+002
Math::Pow(Math::Exp(1.2), 4.9) == 3.5780924170885260E+002
Math::Exp(1.2 * 4.9) == 3.5780924170885277E+002
Math::Pow(1.2, 4.9) == 2.4433636334442981E+000
Math::Exp(4.9 * Math::Log(1.2)) == 2.4433636334442981E+000
Math::Exp(4.9) * Math::Exp(9.9) == 2.6764450551890982E+006
Math::Exp(4.9 + 9.9) == 2.6764450551891015E+006
Math::Pow(Math::Exp(4.9), 9.9) == 1.1684908531676833E+021
Math::Exp(4.9 * 9.9) == 1.1684908531676829E+021
Math::Pow(4.9, 9.9) == 6.8067718210957060E+006
Math::Exp(9.9 * Math::Log(4.9)) == 6.8067718210956985E+006
*/
// Example for the Math.Exp( double ) method.
using System;
class ExpDemo
{
public static void Main()
{
Console.WriteLine(
"This example of Math.Exp( double ) " +
"generates the following output.\n" );
Console.WriteLine(
"Evaluate [e ^ ln(X) == ln(e ^ X) == X] " +
"with selected values for X:" );
UseLnExp(0.1);
UseLnExp(1.2);
UseLnExp(4.9);
UseLnExp(9.9);
Console.WriteLine(
"\nEvaluate these identities with " +
"selected values for X and Y:" );
Console.WriteLine( " (e ^ X) * (e ^ Y) == e ^ (X + Y)" );
Console.WriteLine( " (e ^ X) ^ Y == e ^ (X * Y)" );
Console.WriteLine( " X ^ Y == e ^ (Y * ln(X))" );
UseTwoArgs(0.1, 1.2);
UseTwoArgs(1.2, 4.9);
UseTwoArgs(4.9, 9.9);
}
// Evaluate logarithmic/exponential identity with a given argument.
static void UseLnExp(double arg)
{
// Evaluate e ^ ln(X) == ln(e ^ X) == X.
Console.WriteLine(
"\n Math.Exp(Math.Log({0})) == {1:E16}\n" +
" Math.Log(Math.Exp({0})) == {2:E16}",
arg, Math.Exp(Math.Log(arg)), Math.Log(Math.Exp(arg)) );
}
// Evaluate exponential identities that are functions of two arguments.
static void UseTwoArgs(double argX, double argY)
{
// Evaluate (e ^ X) * (e ^ Y) == e ^ (X + Y).
Console.WriteLine(
"\nMath.Exp({0}) * Math.Exp({1}) == {2:E16}" +
"\n Math.Exp({0} + {1}) == {3:E16}",
argX, argY, Math.Exp(argX) * Math.Exp(argY),
Math.Exp(argX + argY) );
// Evaluate (e ^ X) ^ Y == e ^ (X * Y).
Console.WriteLine(
" Math.Pow(Math.Exp({0}), {1}) == {2:E16}" +
"\n Math.Exp({0} * {1}) == {3:E16}",
argX, argY, Math.Pow(Math.Exp(argX), argY),
Math.Exp(argX * argY) );
// Evaluate X ^ Y == e ^ (Y * ln(X)).
Console.WriteLine(
" Math.Pow({0}, {1}) == {2:E16}" +
"\nMath.Exp({1} * Math.Log({0})) == {3:E16}",
argX, argY, Math.Pow(argX, argY),
Math.Exp(argY * Math.Log(argX)) );
}
}
/*
This example of Math.Exp( double ) generates the following output.
Evaluate [e ^ ln(X) == ln(e ^ X) == X] with selected values for X:
Math.Exp(Math.Log(0.1)) == 1.0000000000000001E-001
Math.Log(Math.Exp(0.1)) == 1.0000000000000008E-001
Math.Exp(Math.Log(1.2)) == 1.2000000000000000E+000
Math.Log(Math.Exp(1.2)) == 1.2000000000000000E+000
Math.Exp(Math.Log(4.9)) == 4.9000000000000012E+000
Math.Log(Math.Exp(4.9)) == 4.9000000000000004E+000
Math.Exp(Math.Log(9.9)) == 9.9000000000000004E+000
Math.Log(Math.Exp(9.9)) == 9.9000000000000004E+000
Evaluate these identities with selected values for X and Y:
(e ^ X) * (e ^ Y) == e ^ (X + Y)
(e ^ X) ^ Y == e ^ (X * Y)
X ^ Y == e ^ (Y * ln(X))
Math.Exp(0.1) * Math.Exp(1.2) == 3.6692966676192444E+000
Math.Exp(0.1 + 1.2) == 3.6692966676192444E+000
Math.Pow(Math.Exp(0.1), 1.2) == 1.1274968515793757E+000
Math.Exp(0.1 * 1.2) == 1.1274968515793757E+000
Math.Pow(0.1, 1.2) == 6.3095734448019331E-002
Math.Exp(1.2 * Math.Log(0.1)) == 6.3095734448019344E-002
Math.Exp(1.2) * Math.Exp(4.9) == 4.4585777008251705E+002
Math.Exp(1.2 + 4.9) == 4.4585777008251716E+002
Math.Pow(Math.Exp(1.2), 4.9) == 3.5780924170885260E+002
Math.Exp(1.2 * 4.9) == 3.5780924170885277E+002
Math.Pow(1.2, 4.9) == 2.4433636334442981E+000
Math.Exp(4.9 * Math.Log(1.2)) == 2.4433636334442981E+000
Math.Exp(4.9) * Math.Exp(9.9) == 2.6764450551890982E+006
Math.Exp(4.9 + 9.9) == 2.6764450551891015E+006
Math.Pow(Math.Exp(4.9), 9.9) == 1.1684908531676833E+021
Math.Exp(4.9 * 9.9) == 1.1684908531676829E+021
Math.Pow(4.9, 9.9) == 6.8067718210957060E+006
Math.Exp(9.9 * Math.Log(4.9)) == 6.8067718210956985E+006
*/
// Example for the Math.Exp( double ) method.
// The exp function may be used instead.
open System
printfn "This example of Math.Exp( double ) generates the following output.\n"
printfn "Evaluate [e ^ ln(X) = ln(e ^ X) = X] with selected values for X:"
// Evaluate logarithmic/exponential identity with a given argument.
let useLnExp arg =
// Evaluate e ^ ln(X) = ln(e ^ X) = X.
printfn $"\n Math.Exp(Math.Log({arg})) = {Math.Exp(Math.Log arg):E16}\n Math.Log(Math.Exp({arg})) = {Math.Log(Math.Exp arg):E16}"
// Evaluate exponential identities that are functions of two arguments.
let useTwoArgs argX argY =
// Evaluate (e ^ X) * (e ^ Y) = e ^ (X + Y).
printfn $"""
Math.Exp({argX}) * Math.Exp({argY}) = {Math.Exp argX * Math.Exp argY:E16}" +
Math.Exp({argX} + {argY}) = {Math.Exp(argX + argY):E16}"""
// Evaluate (e ^ X) ^ Y = e ^ (X * Y).
printfn $" Math.Pow(Math.Exp({argX}), {argY}) = {Math.Pow(Math.Exp argX, argY):E16}\n Math.Exp({argX} * {argY}) = {Math.Exp(argX * argY):E16}"
// Evaluate X ^ Y = e ^ (Y * ln(X)).
printfn $" Math.Pow({argX}, {argY}) = {Math.Pow(argX, argY):E16}\nMath.Exp({argY} * Math.Log({argX})) = {Math.Exp(argY * Math.Log argX):E16}"
useLnExp 0.1
useLnExp 1.2
useLnExp 4.9
useLnExp 9.9
printfn "\nEvaluate these identities with selected values for X and Y:"
printfn " (e ^ X) * (e ^ Y) = e ^ (X + Y)"
printfn " (e ^ X) ^ Y = e ^ (X * Y)"
printfn " X ^ Y = e ^ (Y * ln(X))"
useTwoArgs 0.1 1.2
useTwoArgs 1.2 4.9
useTwoArgs 4.9 9.9
// This example of Math.Exp( double ) generates the following output.
//
// Evaluate [e ^ ln(X) = ln(e ^ X) = X] with selected values for X:
//
// Math.Exp(Math.Log(0.1)) = 1.0000000000000001E-001
// Math.Log(Math.Exp(0.1)) = 1.0000000000000008E-001
//
// Math.Exp(Math.Log(1.2)) = 1.2000000000000000E+000
// Math.Log(Math.Exp(1.2)) = 1.2000000000000000E+000
//
// Math.Exp(Math.Log(4.9)) = 4.9000000000000012E+000
// Math.Log(Math.Exp(4.9)) = 4.9000000000000004E+000
//
// Math.Exp(Math.Log(9.9)) = 9.9000000000000004E+000
// Math.Log(Math.Exp(9.9)) = 9.9000000000000004E+000
//
// Evaluate these identities with selected values for X and Y:
// (e ^ X) * (e ^ Y) = e ^ (X + Y)
// (e ^ X) ^ Y = e ^ (X * Y)
// X ^ Y = e ^ (Y * ln(X))
//
// Math.Exp(0.1) * Math.Exp(1.2) = 3.6692966676192444E+000
// Math.Exp(0.1 + 1.2) = 3.6692966676192444E+000
// Math.Pow(Math.Exp(0.1), 1.2) = 1.1274968515793757E+000
// Math.Exp(0.1 * 1.2) = 1.1274968515793757E+000
// Math.Pow(0.1, 1.2) = 6.3095734448019331E-002
// Math.Exp(1.2 * Math.Log(0.1)) = 6.3095734448019344E-002
//
// Math.Exp(1.2) * Math.Exp(4.9) = 4.4585777008251705E+002
// Math.Exp(1.2 + 4.9) = 4.4585777008251716E+002
// Math.Pow(Math.Exp(1.2), 4.9) = 3.5780924170885260E+002
// Math.Exp(1.2 * 4.9) = 3.5780924170885277E+002
// Math.Pow(1.2, 4.9) = 2.4433636334442981E+000
// Math.Exp(4.9 * Math.Log(1.2)) = 2.4433636334442981E+000
//
// Math.Exp(4.9) * Math.Exp(9.9) = 2.6764450551890982E+006
// Math.Exp(4.9 + 9.9) = 2.6764450551891015E+006
// Math.Pow(Math.Exp(4.9), 9.9) = 1.1684908531676833E+021
// Math.Exp(4.9 * 9.9) = 1.1684908531676829E+021
// Math.Pow(4.9, 9.9) = 6.8067718210957060E+006
// Math.Exp(9.9 * Math.Log(4.9)) = 6.8067718210956985E+006
' Example for the Math.Exp( Double ) method.
Module ExpDemo
Sub Main()
Console.WriteLine( _
"This example of Math.Exp( Double ) " & _
"generates the following output." & vbCrLf)
Console.WriteLine( _
"Evaluate [e ^ ln(X) == ln(e ^ X) == X] " & _
"with selected values for X:")
UseLnExp(0.1)
UseLnExp(1.2)
UseLnExp(4.9)
UseLnExp(9.9)
Console.WriteLine( vbCrLf & _
"Evaluate these identities with selected values for X and Y:")
Console.WriteLine(" (e ^ X) * (e ^ Y) = e ^ (X + Y)")
Console.WriteLine(" (e ^ X) ^ Y = e ^ (X * Y)")
Console.WriteLine(" X ^ Y = e ^ (Y * ln(X))")
UseTwoArgs(0.1, 1.2)
UseTwoArgs(1.2, 4.9)
UseTwoArgs(4.9, 9.9)
End Sub
' Evaluate logarithmic/exponential identity with a given argument.
Sub UseLnExp(arg As Double)
' Evaluate e ^ ln(X) = ln(e ^ X) = X.
Console.WriteLine( _
vbCrLf & " Math.Exp(Math.Log({0})) = {1:E16}" + _
vbCrLf & " Math.Log(Math.Exp({0})) = {2:E16}", _
arg, Math.Exp(Math.Log(arg)), Math.Log(Math.Exp(arg)))
End Sub
' Evaluate exponential identities that are functions of two arguments.
Sub UseTwoArgs(argX As Double, argY As Double)
' Evaluate (e ^ X) * (e ^ Y) = e ^ (X + Y).
Console.WriteLine( _
vbCrLf & "Math.Exp({0}) * Math.Exp({1}) = {2:E16}" + _
vbCrLf & " Math.Exp({0} + {1}) = {3:E16}", _
argX, argY, Math.Exp(argX) * Math.Exp(argY), _
Math.Exp((argX + argY)))
' Evaluate (e ^ X) ^ Y = e ^ (X * Y).
Console.WriteLine( _
" Math.Pow(Math.Exp({0}), {1}) = {2:E16}" + _
vbCrLf & " Math.Exp({0} * {1}) = {3:E16}", _
argX, argY, Math.Pow(Math.Exp(argX), argY), _
Math.Exp((argX * argY)))
' Evaluate X ^ Y = e ^ (Y * ln(X)).
Console.WriteLine( _
" Math.Pow({0}, {1}) = {2:E16}" + _
vbCrLf & "Math.Exp({1} * Math.Log({0})) = {3:E16}", _
argX, argY, Math.Pow(argX, argY), _
Math.Exp((argY * Math.Log(argX))))
End Sub
End Module 'ExpDemo
' This example of Math.Exp( Double ) generates the following output.
'
' Evaluate [e ^ ln(X) == ln(e ^ X) == X] with selected values for X:
'
' Math.Exp(Math.Log(0.1)) = 1.0000000000000001E-001
' Math.Log(Math.Exp(0.1)) = 1.0000000000000008E-001
'
' Math.Exp(Math.Log(1.2)) = 1.2000000000000000E+000
' Math.Log(Math.Exp(1.2)) = 1.2000000000000000E+000
'
' Math.Exp(Math.Log(4.9)) = 4.9000000000000012E+000
' Math.Log(Math.Exp(4.9)) = 4.9000000000000004E+000
'
' Math.Exp(Math.Log(9.9)) = 9.9000000000000004E+000
' Math.Log(Math.Exp(9.9)) = 9.9000000000000004E+000
'
' Evaluate these identities with selected values for X and Y:
' (e ^ X) * (e ^ Y) = e ^ (X + Y)
' (e ^ X) ^ Y = e ^ (X * Y)
' X ^ Y = e ^ (Y * ln(X))
'
' Math.Exp(0.1) * Math.Exp(1.2) = 3.6692966676192444E+000
' Math.Exp(0.1 + 1.2) = 3.6692966676192444E+000
' Math.Pow(Math.Exp(0.1), 1.2) = 1.1274968515793757E+000
' Math.Exp(0.1 * 1.2) = 1.1274968515793757E+000
' Math.Pow(0.1, 1.2) = 6.3095734448019331E-002
' Math.Exp(1.2 * Math.Log(0.1)) = 6.3095734448019344E-002
'
' Math.Exp(1.2) * Math.Exp(4.9) = 4.4585777008251705E+002
' Math.Exp(1.2 + 4.9) = 4.4585777008251716E+002
' Math.Pow(Math.Exp(1.2), 4.9) = 3.5780924170885260E+002
' Math.Exp(1.2 * 4.9) = 3.5780924170885277E+002
' Math.Pow(1.2, 4.9) = 2.4433636334442981E+000
' Math.Exp(4.9 * Math.Log(1.2)) = 2.4433636334442981E+000
'
' Math.Exp(4.9) * Math.Exp(9.9) = 2.6764450551890982E+006
' Math.Exp(4.9 + 9.9) = 2.6764450551891015E+006
' Math.Pow(Math.Exp(4.9), 9.9) = 1.1684908531676833E+021
' Math.Exp(4.9 * 9.9) = 1.1684908531676829E+021
' Math.Pow(4.9, 9.9) = 6.8067718210957060E+006
' Math.Exp(9.9 * Math.Log(4.9)) = 6.8067718210956985E+006
注釈
e
は、値が約 2.71828 である数学定数です。
メソッドを Pow 使用して、他の基底の累乗を計算します。
このメソッドは基になる C ランタイムを呼び出します。正確な結果または有効な入力範囲は、オペレーティング システムやアーキテクチャによって異なる場合があります。
適用対象
こちらもご覧ください
GitHub で Microsoft と共同作業する
このコンテンツのソースは GitHub にあります。そこで、issue や pull request を作成および確認することもできます。 詳細については、共同作成者ガイドを参照してください。
.NET