Complex Data Type:

Vinay Rawal answered on April 1, 2023 Popularity 3/10 Helpfulness 1/10

Contents


More Related Answers

  • complex data type in python
  • int Data Type:
  • Can we use + for different Datatypes also?

  • Complex Data Type:

    0

    A complex number is of the form

     ‘a’ and ‘b’ contain Integers OR Floating-Point Values.

    Eg: 3 + 5j 10 + 5.5j 0.5 + 0.1j

     In the real part if we use an int value then we can specify that either by decimal, octal, binary, or hexadecimal form.  But the imaginary part should be specified only by using the decimal form. 1) >>> a=0B11+5j 2) >>> a 3) (3+5j) 4) >>> a=3+0B11j 5) SyntaxError: invalid syntax  Even we can perform operations on complex type values. 1) >>> a=10+1.5j 2) >>> b=20+2.5j 3) >>> c=a+b 4) >>> print(c) a + bj

    Real Part Imaginary Part j2 = -1 j =


    5) (30+4j) 6) >>> type(c) 7) Note: Complex data type has some inbuilt attributes to retrieve the real part and imaginary part

    c = 10.5+3.6j

    c.real  10.5 c.imag  3.6

    We can use complex types generally in scientific Applications and electrical engineering Applications. 

    Popularity 3/10 Helpfulness 1/10 Language whatever
    Source: Grepper
    Tags: whatever
    Link to this answer
    Share Copy Link
    Contributed on Apr 01 2023
    Vinay Rawal
    0 Answers  Avg Quality 2/10


    X

    Continue with Google

    By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
    X
    Grepper Account Login Required

    Oops, You will need to install Grepper and log-in to perform this action.