⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 elementaryfunctions.vb

📁 这里是用VB写的数学库。以前用C、C++写的比较多。内容有:复数运算、矩阵运算、解方程、积分微分等。非常有用。
💻 VB
字号:
' The ElementaryFunctions class resides in the Extreme.Mathematics 
' namespace.
Imports Extreme.Mathematics

Namespace Extreme.Mathematics.QuickStart.VB
    ' Illustrates the use of the elementary functions implemented
    ' by the ElementaryFunctions class in the Extreme.Mathematics.Curve namespace of 
    ' the Extreme Optimization Mathematics Library for .NET.
    Module UsingElementaryFunctions

        Sub Main()
            ' The special functions are implemented as static
            ' methods. Special functions of the same general
            ' category are grouped together in one class.
            '
            ' There are classes for: elementary functions,
            ' number theoretic functions, combinatorics,
            ' probability, hyperbolic functions, the gamma
            ' function and related functions, Bessel functions,
            ' Airy functions, and exponential integrals.
            '
            ' This QuickStart sample deals with elementary 
            ' functions, implemented in the ElementaryFunctions class.

            '
            ' ElementaryFunctions functions
            '

            ' Evaluating Log(1+x) directly causes significant
            ' round-off error when x is close to 0. The
            ' Log1PlusX function allows high precision evaluation
            ' of this expression for values of x close to 0:
            Console.WriteLine("Logarithm of 1+1e-12")
            Console.WriteLine("  Math.Log: {0}", _
                Math.Log(1 + 0.000000000001))
            Console.WriteLine("  Log1PlusX: {0}", _
            ElementaryFunctions.Log1PlusX(0.000000000001))

            ' In a similar way, Exp(x) - 1 has a variant, 
            ' ExpXMinus1, for values of x close to 0:
            Console.WriteLine("Exponential of 1e-12 minus 1.")
            Console.WriteLine("  Math.Exp: {0}", _
                Math.Exp(0.000000000001) - 1)
            Console.WriteLine("  ExpMinus1: {0}", _
                ElementaryFunctions.ExpMinus1(0.000000000001))

            ' The hypotenuse of two numbers that are very large
            ' may cause an overflow when not evaluated properly:
            Console.WriteLine("Hypotenuse:")
            Dim a As Double = 3.0E+200
            Dim b As Double = 4.0E+200
            Console.Write("  Simple method: ")
            Try
                Console.WriteLine(Math.Sqrt(a * a + b * b))
            Catch e As OverflowException
                Console.WriteLine("Overflow!")
            End Try
            Console.WriteLine("  ElementaryFunctions.Hypot: {0}", _
                ElementaryFunctions.Hypot(a, b))

            ' Raising numbers to integer powers is much faster
            ' than raising numbers to real numbers. The
            ' overloaded Pow method implements this:
            Console.WriteLine("2.5^19 = {0}", ElementaryFunctions.Pow(2.5, 19))
            ' You can raise numbers to negative integer powers
            ' as well:
            Console.WriteLine("2.5^-19 = {0}", ElementaryFunctions.Pow(2.5, -19))

            Console.Write("Press Enter key to exit...")
            Console.ReadLine()
        End Sub

    End Module

End Namespace

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -