This shows you the differences between two versions of the page.
| Both sides previous revisionPrevious revisionNext revision | Previous revision | ||
| cubloc:tan_tanh:index [2026/02/20 05:07] – admin | cubloc:tan_tanh:index [2026/02/20 15:37] (current) – external edit 127.0.0.1 | ||
|---|---|---|---|
| Line 1: | Line 1: | ||
| ====== Tan ====== | ====== Tan ====== | ||
| - | Returns | + | The Tan function returns |
| + | Tangent is a fundamental trigonometric function that represents | ||
| - | If your input is in degrees, you must convert it to radians: | + | On the Cubloc platform, all trigonometric functions—including Tan—use **radians** to measure angles. |
| - | $rad = deg \times (\frac{\pi}{180})$ | + | For the highest degree of precision, especially when calculating steep slopes or rapid transitions, |
| + | Tan accepts any real number as an angle (except for values where the cosine is zero, such as $\frac{\pi}{2}, | ||
| + | |||
| + | Example | ||
| <code xbasic> | <code xbasic> | ||
| Dim A As Single | Dim A As Single | ||
| Dim B As Single | Dim B As Single | ||
| - | B = 0.785398 | + | B = 0.785398 |
| - | A = Tan(B) | + | A = Tan(B) |
| </ | </ | ||
| + | |||
| + | ==== 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 ====== | ====== Tanh ====== | ||
| - | Returns | + | The Tanh function returns |
| + | Unlike the standard tangent function used in circular geometry, the hyperbolic tangent is based on the geometry | ||
| + | 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 '' | ||
| + | |||
| + | 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> | <code xbasic> | ||
| Dim A As Single | Dim A As Single | ||
| Dim B As Single | Dim B As Single | ||
| B = 0.5 | B = 0.5 | ||
| - | A = Tanh(B) | + | A = Tanh(B) |
| </ | </ | ||
| - | [[..: | + | ==== 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# | ||