• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

VB.NET Math.Log方法代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了VB.NET中System.Math.Log方法的典型用法代码示例。如果您正苦于以下问题:VB.NET Math.Log方法的具体用法?VB.NET Math.Log怎么用?VB.NET Math.Log使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在System.Math的用法示例。



在下文中一共展示了Math.Log方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的VB.NET代码示例。

示例1: Example

Module Example
   Sub Main()
      Console.WriteLine( _
         "  Evaluate this identity with selected values for X:")
      Console.WriteLine("                              ln(x) = 1 / log[X](B)")
      Console.WriteLine()
          
      Dim XArgs() As Double = { 1.2, 4.9, 9.9, 0.1 }
   
      For Each argX As Double In XArgs
         ' Find natural log of argX.
         Console.WriteLine("                      Math.Log({0}) = {1:E16}", _
                           argX, Math.Log(argX))

         ' Evaluate 1 / log[X](e).
         Console.WriteLine("             1.0 / Math.Log(e, {0}) = {1:E16}", _
                           argX, 1.0 / Math.Log(Math.E, argX))
         Console.WriteLine()
      Next
   End Sub 
End Module
开发者ID:VB.NET开发者,项目名称:System,代码行数:21,代码来源:Math.Log

输出:

Evaluate this identity with selected values for X:
ln(x) = 1 / log[X](B)

Math.Log(1.2) = 1.8232155679395459E-001
1.0 / Math.Log(e, 1.2) = 1.8232155679395459E-001

Math.Log(4.9) = 1.5892352051165810E+000
1.0 / Math.Log(e, 4.9) = 1.5892352051165810E+000

Math.Log(9.9) = 2.2925347571405443E+000
1.0 / Math.Log(e, 9.9) = 2.2925347571405443E+000

Math.Log(0.1) = -2.3025850929940455E+000
1.0 / Math.Log(e, 0.1) = -2.3025850929940455E+000


示例2: LogDLogDD

' Example for the Math.Log( Double ) and Math.Log( Double, Double ) methods.
Module LogDLogDD
   
    Sub Main()
        Console.WriteLine( _
            "This example of Math.Log( Double ) and " + _
            "Math.Log( Double, Double )" & vbCrLf & _
            "generates the following output." & vbCrLf)
        Console.WriteLine( _
            "Evaluate these identities with selected " & _
            "values for X and B (base):")
        Console.WriteLine("   log(B)[X] = 1 / log(X)[B]")
        Console.WriteLine("   log(B)[X] = ln[X] / ln[B]")
        Console.WriteLine("   log(B)[X] = log(B)[e] * ln[X]")
          
        UseBaseAndArg(0.1, 1.2)
        UseBaseAndArg(1.2, 4.9)
        UseBaseAndArg(4.9, 9.9)
        UseBaseAndArg(9.9, 0.1)
    End Sub
       
    ' Evaluate logarithmic identities that are functions of two arguments.
    Sub UseBaseAndArg(argB As Double, argX As Double)

        ' Evaluate log(B)[X] = 1 / log(X)[B].
        Console.WriteLine( _
            vbCrLf & "                   Math.Log({1}, {0}) = {2:E16}" + _
            vbCrLf & "             1.0 / Math.Log({0}, {1}) = {3:E16}", _
            argB, argX, Math.Log(argX, argB), _
            1.0 / Math.Log(argB, argX))
          
        ' Evaluate log(B)[X] = ln[X] / ln[B].
        Console.WriteLine( _
            "        Math.Log({1}) / Math.Log({0}) = {2:E16}", _
            argB, argX, Math.Log(argX) / Math.Log(argB))
          
        ' Evaluate log(B)[X] = log(B)[e] * ln[X].
        Console.WriteLine( _
            "Math.Log(Math.E, {0}) * Math.Log({1}) = {2:E16}", _
            argB, argX, Math.Log(Math.E, argB) * Math.Log(argX))

    End Sub
End Module 'LogDLogDD

' This example of Math.Log( Double ) and Math.Log( Double, Double )
开发者ID:VB.NET开发者,项目名称:System,代码行数:45,代码来源:Math.Log

输出:

Evaluate these identities with selected values for X and B (base):
log(B)[X] = 1 / log(X)[B]
log(B)[X] = ln[X] / ln[B]
log(B)[X] = log(B)[e] * ln[X]

Math.Log(1.2, 0.1) = -7.9181246047624818E-002
1.0 / Math.Log(0.1, 1.2) = -7.9181246047624818E-002
Math.Log(1.2) / Math.Log(0.1) = -7.9181246047624818E-002
Math.Log(Math.E, 0.1) * Math.Log(1.2) = -7.9181246047624804E-002

Math.Log(4.9, 1.2) = 8.7166610085093179E+000
1.0 / Math.Log(1.2, 4.9) = 8.7166610085093161E+000
Math.Log(4.9) / Math.Log(1.2) = 8.7166610085093179E+000
Math.Log(Math.E, 1.2) * Math.Log(4.9) = 8.7166610085093179E+000

Math.Log(9.9, 4.9) = 1.4425396251981288E+000
1.0 / Math.Log(4.9, 9.9) = 1.4425396251981288E+000
Math.Log(9.9) / Math.Log(4.9) = 1.4425396251981288E+000
Math.Log(Math.E, 4.9) * Math.Log(9.9) = 1.4425396251981288E+000

Math.Log(0.1, 9.9) = -1.0043839404494075E+000
1.0 / Math.Log(9.9, 0.1) = -1.0043839404494075E+000
Math.Log(0.1) / Math.Log(9.9) = -1.0043839404494075E+000
Math.Log(Math.E, 9.9) * Math.Log(0.1) = -1.0043839404494077E+000



注:本文中的System.Math.Log方法示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
VB.NET Math.Max方法代码示例发布时间:2022-05-24
下一篇:
VB.NET Math.Exp方法代码示例发布时间:2022-05-24
热门推荐
热门话题
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap