The IMTANH function in Google Sheets returns the hyperbolic tangent of a complex number. For a complex number like x+yi, it computes tanh(x+yi). You use it by entering =IMTANH(number) where number is a complex number in the form a+bi or a+bj.
What Is IMTANH and When Would You Use It?
IMTANH is part of Google Sheets’ Engineering functions, which handle complex numbers—numbers that have both a real part and an imaginary part (indicated by i or j). The hyperbolic tangent is a mathematical function that appears in fields like signal processing, control theory, and physics when dealing with hyperbolic geometry or exponential growth/decay models. In a spreadsheet, you might use IMTANH when analyzing AC circuits, wave equations, or any dataset that models phenomena with complex exponentials.
For example, if you have a complex number 1+2i in cell A1, typing =IMTANH(A1) returns the hyperbolic tangent of that complex number, which Google Sheets computes using the formula sinh(z)/cosh(z) for complex z.
How to Use IMTANH in Google Sheets
Using IMTANH is straightforward:
- Open a Google Sheets document in your web browser.
- Click on a cell where you want the result.
- Type
=IMTANH(and then either enter a complex number directly in quotes (e.g.,"1+2i") or reference a cell that contains a complex number. - Press Enter.
The result will appear as a complex number in the same format (with i or j). For instance, =IMTANH("1+2i") returns 1.16673625708092+0.243458201185725i (approximate).
If you’re working with Excel, note that Excel has a similar function called IMTANH as well, but the syntax is identical. In Google Sheets, the function is available in all regions, but if you see a #NAME? error, make sure you’ve typed the function name correctly.
Understanding Complex Numbers in Google Sheets
Google Sheets represents complex numbers as text strings in the format a+bi or a+bj. The real part a and imaginary part b can be positive or negative, and you can use either i or j (common in engineering). For example, 3-4i, -2+5j, and 0.5+0.25i are all valid.
Other related functions include IMTAN (tangent), IMSINH (hyperbolic sine), IMCOSH (hyperbolic cosine), and IMCOT (cotangent). These all follow the same pattern: they take a complex number and return a complex result.
Common Errors and How to Fix Them
- #NUM! error: This occurs if the argument is not a valid complex number. For example, if you type
=IMTANH(1)(without quotes or a cell reference), Sheets may interpret it as a real number and return an error because the function expects a complex format. Use"1+0i"or a cell reference. - #VALUE! error: This happens when the argument is text that isn’t a complex number, like
"abc". Ensure the text is in the correct format. - #NAME? error: This appears if you misspell the function name. Double-check that you typed
IMTANH. - Using
ivsj: Both work, but be consistent. If you mix them, Sheets still understands, but it’s good practice to stick to one.
IMTANH vs. TANH: What’s the Difference?
The regular TANH function in Google Sheets returns the hyperbolic tangent of a real number. For example, =TANH(1) returns approximately 0.761594. IMTANH, on the other hand, is designed for complex numbers. If you try to use TANH on a complex number, you’ll get a #VALUE! error because it only handles real inputs. Conversely, IMTANH can handle real numbers too if you write them in complex form (e.g., "1+0i"), but it’s unnecessary—use TANH for real numbers.
Practical Example: Using IMTANH in a Formula
Suppose you have a list of complex numbers in column A (A2:A10) and you want to compute their hyperbolic tangents in column B. Here’s how:
- Enter complex numbers in A2:A10, e.g.,
0+1i,1+1i, etc. - In B2, type
=IMTANH(A2). - Drag the fill handle down to B10 to apply the formula to all cells.
This will give you the hyperbolic tangent for each complex number. The result is also a complex number, so you can further use it in other complex functions like IMSUM or IMPRODUCT.
Frequently Asked Questions
Can I use IMTANH with a real number?
Yes, but you must format it as a complex number. For example, =IMTANH("2+0i") returns the same as =TANH(2). However, for real numbers, it’s simpler and more efficient to use TANH.
What does the result look like?
The result is a text string representing a complex number, like 0.964027580075817+0i. You can use it in other complex functions, but if you need the real part alone, you can use IMREAL and IMAGINARY to extract components.
Why do I get a #NUM! error when I type =IMTANH(1+2i) without quotes?
Google Sheets interprets 1+2i as a calculation (1 plus 2 times i), but i is not defined as a variable, so it results in a #NAME? error. To treat it as text, you must either put it in double quotes ("1+2i") or reference a cell containing that text.
Is IMTANH available in Excel?
Yes, Excel has an IMTANH function with the same syntax. However, the way complex numbers are displayed may differ slightly depending on Excel’s regional settings, but the function works identically.
Can I use IMTANH with a cell that contains a number like 5?
If the cell contains the number 5 (not text), IMTANH will return a #NUM! error because it expects a text string in complex format. You can convert it using =IMTANH(TEXT(5,"0")&"+0i") or simply use TANH(5).
Alternatives and Related Functions
If you need to perform other complex number operations, Google Sheets offers a suite of engineering functions: IMSUM, IMSUB, IMPRODUCT, IMDIV, IMABS, IMARGUMENT, IMCONJUGATE, IMCOS, IMSIN, IMTAN, IMSINH, IMCOSH, IMCOT, and more. These allow you to perform arithmetic and trigonometric operations on complex numbers directly in your spreadsheet.
For real-number hyperbolic functions, use SINH, COSH, and TANH. If you’re working with matrices or advanced engineering calculations, you might also explore the COMPLEX function to create complex numbers from real and imaginary parts.
Related
- Python Generate N Random Numbers: 4 Easy Ways
- Deutsche Bank Balance Sheet: Key Facts Explained
- IMCONJUGATE in Google Sheets: How to Use It
Try it: the Date Difference Calculator: days, months, years and weekdays between two dates, with the DATEDIF formulas.
More in How-to basics
- Excel Zoom Shortcuts: How to Zoom In and Out QuicklyIn Excel for Microsoft 365 on Windows, hold Ctrl and roll the mouse wheel up to zoom in…
- How to Insert a Manual Line Break in Microsoft WordTo insert a manual line break in Word, place the cursor where the new line should begin and…
- Delete an Unused Page in Word: Causes and Easy FixesTo delete an unused page in Microsoft Word, show formatting marks with Ctrl+Shift+8, then remove the extra paragraph…
- Outlook 2019 Auto Reply Rules: Setup and LimitationsIn Outlook 2019 for Windows, create an automatic reply rule by saving a message as an Outlook template,…
- QuickBooks Excel and CSV Imports: What You Can Bring InYes. QuickBooks can import Excel and CSV files, but the right method depends on whether you use QuickBooks…
- Flash Fill in Excel: How It Works and When to Use ItFlash Fill in Excel automatically completes a column when it recognizes a pattern in examples you provide. In…
Sources: Function behaviour and menu paths: Microsoft Support documentation for Excel. Method & sources
Spotted an error in this guide? Let us know.