Math.Tanh(Double) 메서드
정의
중요
일부 정보는 릴리스되기 전에 상당 부분 수정될 수 있는 시험판 제품과 관련이 있습니다. Microsoft는 여기에 제공된 정보에 대해 어떠한 명시적이거나 묵시적인 보증도 하지 않습니다.
지정된 각도의 하이퍼볼릭 탄젠트를 반환합니다.
public:
static double Tanh(double value);
public static double Tanh (double value);
static member Tanh : double -> double
Public Shared Function Tanh (value As Double) As Double
매개 변수
- value
- Double
라디안 단위의 각도입니다.
반환
value
의 쌍곡선 접선입니다.
value
가 NegativeInfinity와 같으면 이 메서드는 -1을 반환하고 값이 PositiveInfinity와 같으면 이 메서드는 1을 반환합니다.
value
가 NaN과 같으면 이 메서드는 NaN을 반환합니다.
예제
다음 예제에서는 를 사용하여 Tanh 선택한 값에 대한 특정 쌍곡선 탄젠트 ID를 평가합니다.
// Example for the hyperbolic Math::Tanh( double ) method.
using namespace System;
// Evaluate hyperbolic identities with a given argument.
void UseTanh( double arg )
{
double tanhArg = Math::Tanh( arg );
// Evaluate tanh(X) == sinh(X) / cosh(X).
Console::WriteLine( "\n Math::Tanh({0}) == {1:E16}\n"
" Math::Sinh({0}) / Math::Cosh({0}) == {2:E16}", arg, tanhArg, (Math::Sinh( arg ) / Math::Cosh( arg )) );
// Evaluate tanh(2 * X) == 2 * tanh(X) / (1 + tanh^2(X)).
Console::WriteLine( " 2 * Math::Tanh({0}) /", arg, 2.0 * tanhArg );
Console::WriteLine( " (1 + (Math::Tanh({0}))^2) == {1:E16}", arg, 2.0 * tanhArg / (1.0 + tanhArg * tanhArg) );
Console::WriteLine( " Math::Tanh({0}) == {1:E16}", 2.0 * arg, Math::Tanh( 2.0 * arg ) );
}
// Evaluate a hyperbolic identity that is a function of two arguments.
void UseTwoArgs( double argX, double argY )
{
// Evaluate tanh(X + Y) == (tanh(X) + tanh(Y)) / (1 + tanh(X) * tanh(Y)).
Console::WriteLine( "\n (Math::Tanh({0}) + Math::Tanh({1})) /\n"
"(1 + Math::Tanh({0}) * Math::Tanh({1})) == {2:E16}", argX, argY, (Math::Tanh( argX ) + Math::Tanh( argY )) / (1.0 + Math::Tanh( argX ) * Math::Tanh( argY )) );
Console::WriteLine( " Math::Tanh({0}) == {1:E16}", argX + argY, Math::Tanh( argX + argY ) );
}
int main()
{
Console::WriteLine( "This example of hyperbolic Math::Tanh( double )\n"
"generates the following output." );
Console::WriteLine( "\nEvaluate these hyperbolic identities "
"with selected values for X:" );
Console::WriteLine( " tanh(X) == sinh(X) / cosh(X)" );
Console::WriteLine( " tanh(2 * X) == 2 * tanh(X) / (1 + tanh^2(X))" );
UseTanh( 0.1 );
UseTanh( 1.2 );
UseTanh( 4.9 );
Console::WriteLine( "\nEvaluate [tanh(X + Y) == "
"(tanh(X) + tanh(Y)) / (1 + tanh(X) * tanh(Y))]"
"\nwith selected values for X and Y:" );
UseTwoArgs( 0.1, 1.2 );
UseTwoArgs( 1.2, 4.9 );
}
/*
This example of hyperbolic Math::Tanh( double )
generates the following output.
Evaluate these hyperbolic identities with selected values for X:
tanh(X) == sinh(X) / cosh(X)
tanh(2 * X) == 2 * tanh(X) / (1 + tanh^2(X))
Math::Tanh(0.1) == 9.9667994624955819E-002
Math::Sinh(0.1) / Math::Cosh(0.1) == 9.9667994624955819E-002
2 * Math::Tanh(0.1) /
(1 + (Math::Tanh(0.1))^2) == 1.9737532022490401E-001
Math::Tanh(0.2) == 1.9737532022490401E-001
Math::Tanh(1.2) == 8.3365460701215521E-001
Math::Sinh(1.2) / Math::Cosh(1.2) == 8.3365460701215521E-001
2 * Math::Tanh(1.2) /
(1 + (Math::Tanh(1.2))^2) == 9.8367485769368024E-001
Math::Tanh(2.4) == 9.8367485769368024E-001
Math::Tanh(4.9) == 9.9988910295055444E-001
Math::Sinh(4.9) / Math::Cosh(4.9) == 9.9988910295055433E-001
2 * Math::Tanh(4.9) /
(1 + (Math::Tanh(4.9))^2) == 9.9999999385024030E-001
Math::Tanh(9.8) == 9.9999999385024030E-001
Evaluate [tanh(X + Y) == (tanh(X) + tanh(Y)) / (1 + tanh(X) * tanh(Y))]
with selected values for X and Y:
(Math::Tanh(0.1) + Math::Tanh(1.2)) /
(1 + Math::Tanh(0.1) * Math::Tanh(1.2)) == 8.6172315931330645E-001
Math::Tanh(1.3) == 8.6172315931330634E-001
(Math::Tanh(1.2) + Math::Tanh(4.9)) /
(1 + Math::Tanh(1.2) * Math::Tanh(4.9)) == 9.9998993913939649E-001
Math::Tanh(6.1) == 9.9998993913939649E-001
*/
// Example for the hyperbolic Math.Tanh( double ) method.
using System;
class DemoTanh
{
public static void Main()
{
Console.WriteLine(
"This example of hyperbolic Math.Tanh( double )\n" +
"generates the following output." );
Console.WriteLine(
"\nEvaluate these hyperbolic identities " +
"with selected values for X:" );
Console.WriteLine( " tanh(X) == sinh(X) / cosh(X)" );
Console.WriteLine(
" tanh(2 * X) == 2 * tanh(X) / (1 + tanh^2(X))" );
UseTanh(0.1);
UseTanh(1.2);
UseTanh(4.9);
Console.WriteLine(
"\nEvaluate [tanh(X + Y) == (tanh(X) + tanh(Y)) " +
"/ (1 + tanh(X) * tanh(Y))]" +
"\nwith selected values for X and Y:" );
UseTwoArgs(0.1, 1.2);
UseTwoArgs(1.2, 4.9);
}
// Evaluate hyperbolic identities with a given argument.
static void UseTanh(double arg)
{
double tanhArg = Math.Tanh(arg);
// Evaluate tanh(X) == sinh(X) / cosh(X).
Console.WriteLine(
"\n Math.Tanh({0}) == {1:E16}\n" +
" Math.Sinh({0}) / Math.Cosh({0}) == {2:E16}",
arg, tanhArg, (Math.Sinh(arg) / Math.Cosh(arg)) );
// Evaluate tanh(2 * X) == 2 * tanh(X) / (1 + tanh^2(X)).
Console.WriteLine(
" 2 * Math.Tanh({0}) /",
arg, 2.0 * tanhArg );
Console.WriteLine(
" (1 + (Math.Tanh({0}))^2) == {1:E16}",
arg, 2.0 * tanhArg / (1.0 + tanhArg * tanhArg ) );
Console.WriteLine(
" Math.Tanh({0}) == {1:E16}",
2.0 * arg, Math.Tanh(2.0 * arg) );
}
// Evaluate a hyperbolic identity that is a function of two arguments.
static void UseTwoArgs(double argX, double argY)
{
// Evaluate tanh(X + Y) == (tanh(X) + tanh(Y)) / (1 + tanh(X) * tanh(Y)).
Console.WriteLine(
"\n (Math.Tanh({0}) + Math.Tanh({1})) /\n" +
"(1 + Math.Tanh({0}) * Math.Tanh({1})) == {2:E16}",
argX, argY, (Math.Tanh(argX) + Math.Tanh(argY)) /
(1.0 + Math.Tanh(argX) * Math.Tanh(argY)) );
Console.WriteLine(
" Math.Tanh({0}) == {1:E16}",
argX + argY, Math.Tanh(argX + argY));
}
}
/*
This example of hyperbolic Math.Tanh( double )
generates the following output.
Evaluate these hyperbolic identities with selected values for X:
tanh(X) == sinh(X) / cosh(X)
tanh(2 * X) == 2 * tanh(X) / (1 + tanh^2(X))
Math.Tanh(0.1) == 9.9667994624955819E-002
Math.Sinh(0.1) / Math.Cosh(0.1) == 9.9667994624955819E-002
2 * Math.Tanh(0.1) /
(1 + (Math.Tanh(0.1))^2) == 1.9737532022490401E-001
Math.Tanh(0.2) == 1.9737532022490401E-001
Math.Tanh(1.2) == 8.3365460701215521E-001
Math.Sinh(1.2) / Math.Cosh(1.2) == 8.3365460701215521E-001
2 * Math.Tanh(1.2) /
(1 + (Math.Tanh(1.2))^2) == 9.8367485769368024E-001
Math.Tanh(2.4) == 9.8367485769368024E-001
Math.Tanh(4.9) == 9.9988910295055444E-001
Math.Sinh(4.9) / Math.Cosh(4.9) == 9.9988910295055433E-001
2 * Math.Tanh(4.9) /
(1 + (Math.Tanh(4.9))^2) == 9.9999999385024030E-001
Math.Tanh(9.8) == 9.9999999385024030E-001
Evaluate [tanh(X + Y) == (tanh(X) + tanh(Y)) / (1 + tanh(X) * tanh(Y))]
with selected values for X and Y:
(Math.Tanh(0.1) + Math.Tanh(1.2)) /
(1 + Math.Tanh(0.1) * Math.Tanh(1.2)) == 8.6172315931330645E-001
Math.Tanh(1.3) == 8.6172315931330634E-001
(Math.Tanh(1.2) + Math.Tanh(4.9)) /
(1 + Math.Tanh(1.2) * Math.Tanh(4.9)) == 9.9998993913939649E-001
Math.Tanh(6.1) == 9.9998993913939649E-001
*/
// Example for the hyperbolic Math.Tanh( double ) method.
// In F#, the tanh function may be used instead
open System
// Evaluate hyperbolic identities with a given argument.
let useTanh arg =
let tanhArg = Math.Tanh arg
// Evaluate tanh(X) = sinh(X) / cosh(X).
printfn $"""
Math.Tanh({arg}) = {tanhArg:E16}
Math.Sinh({arg}) / Math.Cosh({arg}) = {Math.Sinh arg / Math.Cosh arg:E16}"""
// Evaluate tanh(2 * X) = 2 * tanh(X) / (1 + tanh^2(X)).
printfn $" 2 * Math.Tanh({arg}) / {2. * tanhArg}"
printfn $" (1 + (Math.Tanh({arg}))^2) = {2. * tanhArg / (1. + tanhArg * tanhArg):E16}"
printfn $" Math.Tanh({2. * arg}) = {Math.Tanh(2. * arg):E16}"
// Evaluate a hyperbolic identity that is a function of two arguments.
let useTwoArgs argX argY =
// Evaluate tanh(X + Y) = (tanh(X) + tanh(Y)) / (1 + tanh(X) * tanh(Y)).
printfn $"\n (Math.Tanh({argX}) + Math.Tanh({argY})) /\n(1 + Math.Tanh({argX}) * Math.Tanh({argY})) = {(Math.Tanh argX + Math.Tanh argY) / (1. + Math.Tanh argX * Math.Tanh argY):E16}"
printfn $" Math.Tanh({argX + argY}) = {Math.Tanh(argX + argY):E16}"
printfn "This example of hyperbolic Math.Tanh( double )\ngenerates the following output."
printfn "\nEvaluate these hyperbolic identities with selected values for X:"
printfn " tanh(X) = sinh(X) / cosh(X)"
printfn " tanh(2 * X) = 2 * tanh(X) / (1 + tanh^2(X))"
useTanh 0.1
useTanh 1.2
useTanh 4.9
printfn "\nEvaluate [tanh(X + Y) = (tanh(X) + tanh(Y)) / (1 + tanh(X) * tanh(Y))]\nwith selected values for X and Y:"
useTwoArgs 0.1 1.2
useTwoArgs 1.2 4.9
// This example of hyperbolic Math.Tanh( double )
// generates the following output.
//
// Evaluate these hyperbolic identities with selected values for X:
// tanh(X) = sinh(X) / cosh(X)
// tanh(2 * X) = 2 * tanh(X) / (1 + tanh^2(X))
//
// Math.Tanh(0.1) = 9.9667994624955819E-002
// Math.Sinh(0.1) / Math.Cosh(0.1) = 9.9667994624955819E-002
// 2 * Math.Tanh(0.1) /
// (1 + (Math.Tanh(0.1))^2) = 1.9737532022490401E-001
// Math.Tanh(0.2) = 1.9737532022490401E-001
//
// Math.Tanh(1.2) = 8.3365460701215521E-001
// Math.Sinh(1.2) / Math.Cosh(1.2) = 8.3365460701215521E-001
// 2 * Math.Tanh(1.2) /
// (1 + (Math.Tanh(1.2))^2) = 9.8367485769368024E-001
// Math.Tanh(2.4) = 9.8367485769368024E-001
//
// Math.Tanh(4.9) = 9.9988910295055444E-001
// Math.Sinh(4.9) / Math.Cosh(4.9) = 9.9988910295055433E-001
// 2 * Math.Tanh(4.9) /
// (1 + (Math.Tanh(4.9))^2) = 9.9999999385024030E-001
// Math.Tanh(9.8) = 9.9999999385024030E-001
//
// Evaluate [tanh(X + Y) = (tanh(X) + tanh(Y)) / (1 + tanh(X) * tanh(Y))]
// with selected values for X and Y:
//
// (Math.Tanh(0.1) + Math.Tanh(1.2)) /
// (1 + Math.Tanh(0.1) * Math.Tanh(1.2)) = 8.6172315931330645E-001
// Math.Tanh(1.3) = 8.6172315931330634E-001
//
// (Math.Tanh(1.2) + Math.Tanh(4.9)) /
// (1 + Math.Tanh(1.2) * Math.Tanh(4.9)) = 9.9998993913939649E-001
// Math.Tanh(6.1) = 9.9998993913939649E-001
' Example for the hyperbolic Math.Tanh( Double ) method.
Module DemoTanh
Sub Main()
Console.WriteLine( _
"This example of hyperbolic Math.Tanh( Double )" & _
vbCrLf & "generates the following output.")
Console.WriteLine( _
vbCrLf & "Evaluate these hyperbolic " & _
"identities with selected values for X:")
Console.WriteLine(" tanh(X) = sinh(X) / cosh(X)")
Console.WriteLine(" tanh(2 * X) = 2 * tanh(X) / (1 + tanh^2(X))")
UseTanh(0.1)
UseTanh(1.2)
UseTanh(4.9)
Console.WriteLine( _
vbCrLf & "Evaluate [tanh(X + Y) == (tanh(X) + " & _
"tanh(Y)) / (1 + tanh(X) * tanh(Y))]" & _
vbCrLf & "with selected values for X and Y:")
UseTwoArgs(0.1, 1.2)
UseTwoArgs(1.2, 4.9)
End Sub
' Evaluate hyperbolic identities with a given argument.
Sub UseTanh(arg As Double)
Dim tanhArg As Double = Math.Tanh(arg)
' Evaluate tanh(X) = sinh(X) / cosh(X).
Console.WriteLine( _
vbCrLf & " Math.Tanh({0}) = {1:E16}" & _
vbCrLf & " Math.Sinh({0}) / Math.Cosh({0}) = {2:E16}", _
arg, tanhArg, Math.Sinh(arg) / Math.Cosh(arg))
' Evaluate tanh(2 * X) = 2 * tanh(X) / (1 + tanh^2(X)).
Console.WriteLine( _
" 2 * Math.Tanh({0}) /", _
arg, 2.0 * tanhArg)
Console.WriteLine( _
" (1 + (Math.Tanh({0}))^2) = {1:E16}", _
arg, 2.0 * tanhArg /(1.0 + tanhArg * tanhArg))
Console.WriteLine( _
" Math.Tanh({0}) = {1:E16}", _
2.0 * arg, Math.Tanh((2.0 * arg)))
End Sub
' Evaluate a hyperbolic identity that is a function of two arguments.
Sub UseTwoArgs(argX As Double, argY As Double)
' Evaluate tanh(X + Y) = (tanh(X) + tanh(Y)) / (1 + tanh(X) * tanh(Y)).
Console.WriteLine( _
vbCrLf & " (Math.Tanh({0}) + Math.Tanh({1})) /" & _
vbCrLf & "(1 + Math.Tanh({0}) * Math.Tanh({1})) = {2:E16}", _
argX, argY, (Math.Tanh(argX) + Math.Tanh(argY)) / _
(1.0 + Math.Tanh(argX) * Math.Tanh(argY)))
Console.WriteLine( _
" Math.Tanh({0}) = {1:E16}", _
argX + argY, Math.Tanh(argX + argY))
End Sub
End Module 'DemoTanh
' This example of hyperbolic Math.Tanh( Double )
' generates the following output.
'
' Evaluate these hyperbolic identities with selected values for X:
' tanh(X) = sinh(X) / cosh(X)
' tanh(2 * X) = 2 * tanh(X) / (1 + tanh^2(X))
'
' Math.Tanh(0.1) = 9.9667994624955819E-002
' Math.Sinh(0.1) / Math.Cosh(0.1) = 9.9667994624955819E-002
' 2 * Math.Tanh(0.1) /
' (1 + (Math.Tanh(0.1))^2) = 1.9737532022490401E-001
' Math.Tanh(0.2) = 1.9737532022490401E-001
'
' Math.Tanh(1.2) = 8.3365460701215521E-001
' Math.Sinh(1.2) / Math.Cosh(1.2) = 8.3365460701215521E-001
' 2 * Math.Tanh(1.2) /
' (1 + (Math.Tanh(1.2))^2) = 9.8367485769368024E-001
' Math.Tanh(2.4) = 9.8367485769368024E-001
'
' Math.Tanh(4.9) = 9.9988910295055444E-001
' Math.Sinh(4.9) / Math.Cosh(4.9) = 9.9988910295055433E-001
' 2 * Math.Tanh(4.9) /
' (1 + (Math.Tanh(4.9))^2) = 9.9999999385024030E-001
' Math.Tanh(9.8) = 9.9999999385024030E-001
'
' Evaluate [tanh(X + Y) == (tanh(X) + tanh(Y)) / (1 + tanh(X) * tanh(Y))]
' with selected values for X and Y:
'
' (Math.Tanh(0.1) + Math.Tanh(1.2)) /
' (1 + Math.Tanh(0.1) * Math.Tanh(1.2)) = 8.6172315931330645E-001
' Math.Tanh(1.3) = 8.6172315931330634E-001
'
' (Math.Tanh(1.2) + Math.Tanh(4.9)) /
' (1 + Math.Tanh(1.2) * Math.Tanh(4.9)) = 9.9998993913939649E-001
' Math.Tanh(6.1) = 9.9998993913939649E-001
설명
각도는 value
라디안이어야 합니다. /180을 Math.PI곱하여 도를 라디안으로 변환합니다.
이 메서드는 기본 C 런타임을 호출하며 정확한 결과 또는 유효한 입력 범위는 서로 다른 운영 체제 또는 아키텍처 간에 다를 수 있습니다.
적용 대상
GitHub에서 Microsoft와 공동 작업
이 콘텐츠의 원본은 GitHub에서 찾을 수 있으며, 여기서 문제와 끌어오기 요청을 만들고 검토할 수도 있습니다. 자세한 내용은 참여자 가이드를 참조하세요.
.NET