Absolute Value of Real and Complex Numbers in Python - abs(), math.fabs(), math.copysign() Tutorial

Опубликовано: 31 Май 2026
на канале: MCC Py Tutorials
634
6

Discussion of what an absolute value (aka magnitude or modulus) is in mathematics and how to use Python to get the absolute value of a real or complex number using abs(), the difference between abs() and math.fabs(), and what math.copysign() does and how it relates to absolute value. Time stamps below:

Explanation of Absolute Value - 1:35
--Absolute value as the "magnitude" of a vector - 3:51
--Visualizing Absolute Value with the Graph y = |x| - 6:24
--Using the Absolute Value Vertical Bars for Your User's Benefit (programming an "Absolute Value Machine") - 9:48
Taking the Absolute Value with abs() - 14:22
--Taking the Absolute Value of an Expression - 16:34
--Taking the Absolute Value of Infinity and Negative Infinity - 18:30
--Taking the Absolute Value of "Not a Number"? - 19:13
--Taking the Absolute Value of Scientific Notation - 21:00
Taking the Absolute Value of a Complex Number - 23:36
--Visualizing the Absolute Value of Complex Numbers Graphically - 29:33
----Absolute Value of a Complex Number That Has a Real Part and an Imaginary Part - 31:56
Using math.fabs() and how it Differs From abs() - 38:58
Using math.copysign() - 44:30
--Using math.copysign() with Infinity - 48:01
--Using math.copysign() with Decimals - 48:22
--Using math.copysign() with Zero - 49:24
--Using math.copysign() with "Not a Number" - 50:07
--Using math.copysign() with Expressions - 51:18
--Complex numbers with math.copysign()? - 51:47

For more information on abs(), visit: https://docs.python.org/3/library/fun...

For more information on math.fabs() and math.copysign(), visit: https://docs.python.org/3/library/mat...

The graphs in this video were made with matplotlib. For more information on matplotlib, visit: https://matplotlib.org/

This tutorial uses Python 3.8.3. To download the current version of Python, visit: https://www.python.org/. It also uses PyCharm (Community Edition). To download PyCharm, visit: https://www.jetbrains.com/pycharm/.