User Tools

Site Tools

한국어

cubloc:tan_tanh:index

Differences

This shows you the differences between two versions of the page.

Link to this comparison view

Both sides previous revisionPrevious revision
Next revision
Previous revision
cubloc:tan_tanh:index [2026/02/20 05:06] admincubloc:tan_tanh:index [2026/02/20 15:37] (current) – external edit 127.0.0.1
Line 1: Line 1:
-====== Tan ======Returns the tangent of a numberThe Cubloc uses radians as units for its trigonometric functions. To ensure maximum precision, it is highly recommended to use the ''Single'' data type for both input and output variables.Note: If your input is in degreesyou must convert it to radians using the formula: $rad = deg \times (\frac{\pi}{180})$.<code xbasic>Dim A As SingleDim B As SingleB = 0.785398     ' 45 degrees in radians (PI / 4)A = Tan(B)       ' Returns the tangent of B (approx. 1.0)</code>====== Tanh ======Returns the hyperbolic tangent of a numberThe Cubloc uses radians as units. The resulting value of ''Tanh'' will always range between -1.0 and 1.0. Use the ''Single'' data type to achieve the most precise results.<code xbasic>Dim A As SingleDim B As SingleB 1.0A = Tanh(B)      ' Returns the hyperbolic tangent of B</code>+====== Tan ====== 
 + 
 +The Tan function returns the tangent of a numeric value 
 +Tangent is a fundamental trigonometric function that represents the ratio between the opposite side and the adjacent side ($\frac{opposite}{adjacent}$) of a right triangle for a given angle. It is widely used in calculations involving slopes, camera perspectives in graphics, and various engineering applications where angular ratios are required. 
 + 
 + 
 + 
 +On the Cubloc platform, all trigonometric functions—including Tan—use **radians** to measure angles 
 +For the highest degree of precision, especially when calculating steep slopes or rapid transitions, it is recommended to use the ''Single'' data type for the input value. 
 + 
 +Tan accepts any real number as an angle (except for values where the cosine is zerosuch as $\frac{\pi}{2}, \frac{3\pi}{2}$, etc.) and returns the corresponding tangent ratio. 
 + 
 +Example 
 +<code xbasic> 
 +Dim A As Single 
 +Dim B As Single 
 += 0.785398     ' 45 degrees in radians (PI / 4) 
 +A = Tan(B)       ' Returns the tangent of B (approx. 1.0) 
 +</code> 
 + 
 +==== Explanation: ==== 
 + 
 +  * **B** should contain an angle expressed in radians. (To convert degrees to radians: $rad = deg \times \frac{\pi}{180}$) 
 +  * **Tan B** calculates the tangent of that angle. 
 +  * The resulting value—often used for gradient calculations or mapping angular movement to linear coordinates—is stored in **A**. 
 + 
 +====== Tanh ====== 
 + 
 +The Tanh function returns the hyperbolic tangent of a numeric value 
 +Unlike the standard tangent function used in circular geometry, the hyperbolic tangent is based on the geometry of a hyperbola. It is a crucial function in fields such as neural networks (as an activation function), statistics, and control systems where values need to be smoothly mapped or "squashed" into a specific range. 
 + 
 + 
 + 
 +On the Cubloc platform, hyperbolic functions—including Tanh—use **radians** as the unit for the input value.  
 +For the most accurate results, particularly when used in recursive algorithms or signal processing, the ''Single'' data type is recommended. 
 + 
 +One of the most important characteristics of Tanh is that it always returns a value in the range of **-1.0 to +1.0**, regardless of how large or small the input is. 
 + 
 +Example 
 +<code xbasic> 
 +Dim A As Single 
 +Dim B As Single 
 +0.
 += Tanh(B)      ' Returns the hyperbolic tangent of B 
 +</code> 
 + 
 +==== Explanation: ==== 
 + 
 +  * **B** represents a real number, often serving as an input to a sigmoid-like curve. 
 +  * **Tanh B** computes the hyperbolic tangent using the exponential definition: $$\frac{e^{x} - e^{-x}}{e^{x} + e^{-x}}$$ 
 +  * The resulting value—guaranteed to be between -1.0 and 1.0—is stored in **A**, making it ideal for normalizing data or creating smooth transition thresholds. 
 + 
 +[[cubloc:index#system_library:|Go CUBLOC home]]
cubloc/tan_tanh/index.1771563974.txt.gz · Last modified: by admin