Giới thiệu về các số phức tạp Python: Số phức trong Python | Đặt 1 [Giới thiệu] Một số hàm và hằng số quan trọng hơn được thảo luận trong bài viết này. Các hoạt động trên các số phức tạp:
Some more important functions and constants are discussed in this article.
Operations on complex numbers :
1. exp []:- Hàm này trả về số mũ của số phức được đề cập trong đối số của nó. :- This function returns the exponent of the complex number mentioned in its argument.
2. Log [x, b]:- Hàm này trả về giá trị logarit của x với cơ sở B, cả hai đều được đề cập trong các đối số của nó. Nếu cơ sở không được chỉ định, nhật ký tự nhiên của X được trả về. :- This function returns the logarithmic value of x with the base b, both mentioned in its arguments. If base is not specified, natural log of x is returned.
import
cmath
import
math
x
=
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]0
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]1
=
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]0
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]4
=
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]6
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]7
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]8
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]9
Complex number is finite Complex number is infinite Complex number is NaN0
Complex number is finite Complex number is infinite Complex number is NaN1
=
Complex number is finite Complex number is infinite Complex number is NaN3
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]8
Complex number is finite Complex number is infinite Complex number is NaN5
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]8
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]9
Complex number is finite Complex number is infinite Complex number is NaN8
Complex number is finite Complex number is infinite Complex number is NaN1
=
Complex number is finite Complex number is infinite Complex number is NaN3
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]8
The value of pi is : 3.141592653589793 The value of exponent is : 2.7182818284590453
The value of pi is : 3.141592653589793 The value of exponent is : 2.7182818284590454
The value of pi is : 3.141592653589793 The value of exponent is : 2.7182818284590455
Output:
The exponent of complex number is : [1.4686939399158851+2.2873552871788423j] The log[base 10] of complex number is : [0.15051499783199057+0.3410940884604603j]
3. log10 []:- Hàm này trả về cơ sở nhật ký 10 của một số phức. :- This function returns the log base 10 of a complex number.
4. Sqrt []:- Điều này tính toán căn bậc hai của một số phức.:- This computes the square root of a complex number.
import
cmath
import
math
x
=
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]0
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]1
=
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]0
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]4
=
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]6
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]7
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]8
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]9
Complex number is finite Complex number is infinite Complex number is NaN0
Complex number is finite Complex number is infinite Complex number is NaN1
=
Complex number is finite Complex number is infinite Complex number is NaN3
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]8
Complex number is finite Complex number is infinite Complex number is NaN5
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]8
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]9
Complex number is finite Complex number is infinite Complex number is NaN8
Complex number is finite Complex number is infinite Complex number is NaN1
=
Complex number is finite Complex number is infinite Complex number is NaN3
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]8
The value of pi is : 3.141592653589793 The value of exponent is : 2.7182818284590453
The value of pi is : 3.141592653589793 The value of exponent is : 2.7182818284590454
The value of pi is : 3.141592653589793 The value of exponent is : 2.7182818284590455
Output:
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]
3. log10 []:- Hàm này trả về cơ sở nhật ký 10 của một số phức. :- Returns true if both real and imaginary part of complex number are finite, else returns false.
4. Sqrt []:- Điều này tính toán căn bậc hai của một số phức. :- Returns true if either real or imaginary part of complex number is/are infinite, else returns false.
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j]
The square root of complex number is : [1.09868411346781+0.45508986056222733j]
8 The log10 of complex number is : [0.15051499783199057+0.3410940884604603j]
The square root of complex number is : [1.09868411346781+0.45508986056222733j]
9cmath
2221=
Complex number is finite
Complex number is infinite
Complex number is NaN
3 :- Returns true if either real or imaginary part of complex number is NaN , else returns false.
import
cmath
import
math
x
=
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]0
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]1
=
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]0
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]4
=
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]6
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]7
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]8
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]9
Complex number is finite Complex number is infinite Complex number is NaN0
Complex number is finite Complex number is infinite Complex number is NaN1
=
Complex number is finite Complex number is infinite Complex number is NaN3
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]8
Complex number is finite Complex number is infinite Complex number is NaN5
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]8
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]9
Complex number is finite Complex number is infinite Complex number is NaN8
Complex number is finite Complex number is infinite Complex number is NaN1
=
Complex number is finite Complex number is infinite Complex number is NaN3
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]8
The value of pi is : 3.141592653589793 The value of exponent is : 2.7182818284590453
The value of pi is : 3.141592653589793 The value of exponent is : 2.7182818284590454
The value of pi is : 3.141592653589793 The value of exponent is : 2.7182818284590455
3. log10 []:- Hàm này trả về cơ sở nhật ký 10 của một số phức.
4. Sqrt []:- Điều này tính toán căn bậc hai của một số phức.
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]8
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]9
cmath
2221=
Complex number is finite Complex number is infinite Complex number is NaN3
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]8
cmath
7The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]8
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]9
import
0Complex number is finite Complex number is infinite Complex number is NaN1
=
Complex number is finite Complex number is infinite Complex number is NaN3
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]8
import
55. isfinite []:- Trả về đúng nếu cả phần thực và phần tưởng tượng của số phức là hữu hạn, nếu không trả về sai.
6. ISINF []:- Trả về đúng nếu phần thực hoặc phần tưởng tượng của số phức là/là vô hạn, nếu không trả về sai.
7. isnan []:- Trả về đúng nếu phần thực hoặc phần tưởng tượng của số phức là nan, nếu không trả về sai.
Output:
Complex number is finite Complex number is infinite Complex number is NaN
math
6=
math
8
math
9=
x
1“pi”, which returns the numerical value of pi. The second one is “e” which returns the numerical value of exponent.
import
cmath
import
math
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]4
=
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]6
x
5x
6=
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]6
x
9
=
0____9
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]6
=
3=
4 =
5
Output:
The value of pi is : 3.141592653589793 The value of exponent is : 2.718281828459045
=
6
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]8
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]9
=
9The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]00
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]01
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]02
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]8
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]9
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]05
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]06
This article is contributed by Manjeet Singh. If you like GeeksforGeeks and would like to contribute, you can also write an article using write.geeksforgeeks.org or mail your article to . See your article appearing on the GeeksforGeeks main page and help other Geeks.
=
4
The log10 of complex number is : [0.15051499783199057+0.3410940884604603j] The square root of complex number is : [1.09868411346781+0.45508986056222733j]08