Followers

Saturday, October 3, 2020

Complex Numbers - Numbers(Data Types)

Hello Friends, Welcome to our Website Python11. Today we will talk about Complex Number which is a Subheading of Numbers. 

To understand this New topic you need to First read our last post which was on :


Complex Numbers

Python is a Versatile Language that offers you a numeric type to represent Complex Numbers also. Complex Number.....,,,,??? Hey you don't know about Complex Number........Its in your class XI Mathematics Book. 

Complex Number In Python

Python represents complex numbers in the form A + Bj. That is, to represent imaginary number, Python uses j (or J) in place of traditional i. So in Python j = √-1. Consider the following examples where a and b are storing two complex numbers in Python :
                    a = 0 + 3.1j
                    b = 1.5 + 2j
The above complex number a has real component as 0 and imaginary component as 3:1; in complex number b, the real part is 1.5 and imaginary part is 2. When you display complex numbers, Python displays complex numbers in parentheses when they have aa non zero real part as shown in following examples. 

        >>> c = 0 + 4.5j
        >>> d = 1.1 + 3.4j
        >>>c
        4.5J
        >>>d
        (1.1 + 3.4j)
        >>>print(c)
        4.5j
        >>>print(d)
        (1.1 + 3.4j)

Unlike Python's other numeric types, complex numbers are a composite quantity made of two parts : the real part and the imaginary part, both of which are represented internally a float values (floating point numbers). 
You can retrieve the two components using attribute references. For a complex number z :
  • z.real gives the real part .
  • z.imag gives the imaginary part as a float, not as a complex value. 
For example, 
        >>>z = (1 + 2.5j) + (-4 - 3.5j)
        >>>a
        (-3 -1j)
        >>>z.real
        - 3.0
        >>>z.imag 
        -1.0

The range of numbers represented through Python's numeric data types given below :-


So with this, we end with this Topic, don't forget to follow me so that you can get the latest updates of my new posts that I upload weekly, I will try my best to upload daily OR you can Sign up for Newsletters at the top of the Blog and that will give you E-mail updates of my New Post.
Jai Hind!!!!

Vande Mataram!!! 

No comments:

Post a Comment

If you have any doubts, please do let me Know.