vb System.Math.Cosh类(方法)实例源码

下面列出了vb System.Math.Cosh 类(方法)源码代码实例,从而了解它的用法。

作者:VB.NET开发    项目:Syste   
' Example for the hyperbolic Math.Sinh( Double ) and Math.Cosh( Double ) methods.
Module SinhCosh
   
    Sub Main()
        Console.WriteLine( _
            "This example of hyperbolic " & _
            "Math.Sinh( Double ) and Math.Cosh( Double )" & vbCrLf & _
            "generates the following output." & vbCrLf)
        Console.WriteLine( _
            "Evaluate these hyperbolic identities " & _
            "with selected values for X:")
        Console.WriteLine( _
            "   cosh^2(X) - sinh^2(X) = 1" & vbCrLf & _
            "   sinh(2 * X) = 2 * sinh(X) * cosh(X)")
        Console.WriteLine("   cosh(2 * X) = cosh^2(X) + sinh^2(X)")
          
        UseSinhCosh(0.1)
        UseSinhCosh(1.2)
        UseSinhCosh(4.9)
          
        Console.WriteLine( _
            vbCrLf & "Evaluate these hyperbolic " & _
            "identities with selected values for X and Y:")
        Console.WriteLine( _
            "   sinh(X + Y) = sinh(X) * cosh(Y) + cosh(X) * sinh(Y)")
        Console.WriteLine( _
            "   cosh(X + Y) = cosh(X) * cosh(Y) + sinh(X) * sinh(Y)")

        UseTwoArgs(0.1, 1.2)
        UseTwoArgs(1.2, 4.9)
    End Sub
      
    ' Evaluate hyperbolic identities with a given argument.
    Sub UseSinhCosh(arg As Double)
        Dim sinhArg As Double = Math.Sinh(arg)
        Dim coshArg As Double = Math.Cosh(arg)
          
        ' Evaluate cosh^2(X) - sinh^2(X) = 1.
        Console.WriteLine( _
            vbCrLf & "                         Math.Sinh({0}) = {1:E16}" + _
            vbCrLf & "                         Math.Cosh({0}) = {2:E16}", _
            arg, Math.Sinh(arg), Math.Cosh(arg))
        Console.WriteLine( _
            "(Math.Cosh({0}))^2 - (Math.Sinh({0}))^2 = {1:E16}", _
            arg, coshArg * coshArg - sinhArg * sinhArg)
          
        ' Evaluate sinh(2 * X) = 2 * sinh(X) * cosh(X).
        Console.WriteLine( _
            "                         Math.Sinh({0}) = {1:E16}", _
            2.0 * arg, Math.Sinh((2.0 * arg)))
        Console.WriteLine( _
            "    2 * Math.Sinh({0}) * Math.Cosh({0}) = {1:E16}", _
            arg, 2.0 * sinhArg * coshArg)
          
        ' Evaluate cosh(2 * X) = cosh^2(X) + sinh^2(X).
        Console.WriteLine( _
            "                         Math.Cosh({0}) = {1:E16}", _
            2.0 * arg, Math.Cosh((2.0 * arg)))
        Console.WriteLine( _
            "(Math.Cosh({0}))^2 + (Math.Sinh({0}))^2 = {1:E16}", _
            arg, coshArg * coshArg + sinhArg * sinhArg)

    End Sub
       
    ' Evaluate hyperbolic identities that are functions of two arguments.
    Sub UseTwoArgs(argX As Double, argY As Double)

        ' Evaluate sinh(X + Y) = sinh(X) * cosh(Y) + cosh(X) * sinh(Y).
        Console.WriteLine( _
            vbCrLf & "        Math.Sinh({0}) * Math.Cosh({1}) +" + _
            vbCrLf & "        Math.Cosh({0}) * Math.Sinh({1}) = {2:E16}", _
            argX, argY, Math.Sinh(argX) * Math.Cosh(argY) + _
            Math.Cosh(argX) * Math.Sinh(argY))
        Console.WriteLine( _
            "                         Math.Sinh({0}) = {1:E16}", _
            argX + argY, Math.Sinh((argX + argY)))
          
        ' Evaluate cosh(X + Y) = cosh(X) * cosh(Y) + sinh(X) * sinh(Y).
        Console.WriteLine( _
            "        Math.Cosh({0}) * Math.Cosh({1}) +" + _
            vbCrLf & "        Math.Sinh({0}) * Math.Sinh({1}) = {2:E16}", _
            argX, argY, Math.Cosh(argX) * Math.Cosh(argY) + _
            Math.Sinh(argX) * Math.Sinh(argY))
        Console.WriteLine( _
            "                         Math.Cosh({0}) = {1:E16}", _
            argX + argY, Math.Cosh((argX + argY)))

    End Sub
End Module 'SinhCosh

' This example of hyperbolic Math.Sinh( Double ) and Math.Cosh( Double )


问题


面经


文章

微信
公众号

扫码关注公众号