+ 2

Print(abs(3+4j))

What does it mean? And how it gives as output 5.0

22nd Mar 2020, 4:50 PM
Programmer
Programmer - avatar
6 odpowiedzi
+ 8
3+4j is a complex number: real part = 3 imaginary part = 4 absolute value of complex number (modulus) = sqrt(Re**2 + Im **2): sqrt(3**2 + 4**2) = sqrt(25) = 5
22nd Mar 2020, 5:08 PM
andriy kan
andriy kan - avatar
+ 3
You can use the Pythagoras theorem to determine the modulus/size/absolute value of a complex number.
24th Mar 2020, 11:11 AM
Sonic
Sonic - avatar
+ 2
it depends on argument: for int argument abs() returns int for float and complex argument it returns float
22nd Mar 2020, 5:15 PM
andriy kan
andriy kan - avatar
0
It's a modulus of complex number.
22nd Mar 2020, 4:59 PM
Aleksandra Krawiec
Aleksandra Krawiec - avatar
0
Then, what's the function of abs
22nd Mar 2020, 5:04 PM
Programmer
Programmer - avatar
0
Does abs function return float value
22nd Mar 2020, 5:11 PM
Programmer
Programmer - avatar