當前位置: 首頁>>代碼示例>>VB.NET>>正文


VB.NET Math.Exp方法代碼示例

本文整理匯總了VB.NET中System.Math.Exp方法的典型用法代碼示例。如果您正苦於以下問題:VB.NET Math.Exp方法的具體用法?VB.NET Math.Exp怎麽用?VB.NET Math.Exp使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在System.Math的用法示例。


在下文中一共展示了Math.Exp方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的VB.NET代碼示例。

示例1: ExpDemo

' 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
開發者ID:VB.NET開發者,項目名稱:System,代碼行數:63,代碼來源:Math.Exp

輸出:

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


注:本文中的System.Math.Exp方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。