Return the real part of the complex argument in Python (2024)

Table of Contents
Steps Example Output

To return the real part of the complex argument, use the numpy.real() method in Python. Themethod returns the real component of the complex argument. If val is real, the type of val is used forthe output. If val has complex elements, the returned type is float. The 1st parameter, val is theinput array

Steps

At first, import the required libraries −

import numpy as np

Create an array using the array() method −

arr = np.array([56.+0.j , 27.+0.j , 68.+0.j , 23.+0.j])

Display the array −

print("Our Array...\n",arr)

Check the Dimensions −

print("\nDimensions of our Array...\n",arr.ndim)

Get the Datatype −

print("\nDatatype of our Array object...\n",arr.dtype)

Get the Shape −

print("\nShape of our Array...\n",arr.shape)

To return the real part of the complex argument, use the numpy.real() method in Python. Themethod returns the real component of the complex argument. If val is real, the type of val is used forthe output. If val has complex elements, the returned type is float. The 1st parameter, val is theinput array −

print("\nResult (Real part)...\n",np.real(arr))

Example

import numpy as np# Create an array using the array() methodarr = np.array([56.+0.j , 27.+0.j , 68.+0.j , 23.+0.j])# Display the arrayprint("Our Array...\n",arr)# Check the Dimensionsprint("\nDimensions of our Array...\n",arr.ndim)# Get the Datatypeprint("\nDatatype of our Array object...\n",arr.dtype)# Get the Shapeprint("\nShape of our Array...\n",arr.shape)# To return the real part of the complex argument, use the numpy.real() method in Pythonprint("\nResult (Real part)...\n",np.real(arr))

Output

Our Array...[56.+0.j 27.+0.j 68.+0.j 23.+0.j]Dimensions of our Array...1Datatype of our Array object...complex128Shape of our Array...(4,)Result (Real part)...[56. 27. 68. 23.]
Kickstart Your Career

Get certified by completing the course

Get Started

Return the real part of the complex argument in Python (31)

Advertisem*nts

';

Return the real part of the complex argument in Python (2024)
Top Articles
Inspirational candidate interview feedback examples
OSPF vs RIP: Comparing Two of the Most Popular Routing Protocols
English Bulldog Puppies For Sale Under 1000 In Florida
Katie Pavlich Bikini Photos
Gamevault Agent
Pieology Nutrition Calculator Mobile
Hocus Pocus Showtimes Near Harkins Theatres Yuma Palms 14
Hendersonville (Tennessee) – Travel guide at Wikivoyage
Doby's Funeral Home Obituaries
Compare the Samsung Galaxy S24 - 256GB - Cobalt Violet vs Apple iPhone 16 Pro - 128GB - Desert Titanium | AT&T
Vardis Olive Garden (Georgioupolis, Kreta) ✈️ inkl. Flug buchen
Craigslist Dog Kennels For Sale
Things To Do In Atlanta Tomorrow Night
Non Sequitur
Crossword Nexus Solver
How To Cut Eelgrass Grounded
Pac Man Deviantart
Alexander Funeral Home Gallatin Obituaries
Shasta County Most Wanted 2022
Energy Healing Conference Utah
Aaa Saugus Ma Appointment
Geometry Review Quiz 5 Answer Key
Hobby Stores Near Me Now
Icivics The Electoral Process Answer Key
Allybearloves
Bible Gateway passage: Revelation 3 - New Living Translation
Yisd Home Access Center
Home
Shadbase Get Out Of Jail
Gina Wilson Angle Addition Postulate
Celina Powell Lil Meech Video: A Controversial Encounter Shakes Social Media - Video Reddit Trend
Walmart Pharmacy Near Me Open
Marquette Gas Prices
A Christmas Horse - Alison Senxation
Ou Football Brainiacs
Access a Shared Resource | Computing for Arts + Sciences
Vera Bradley Factory Outlet Sunbury Products
Pixel Combat Unblocked
Cvs Sport Physicals
Mercedes W204 Belt Diagram
'Conan Exiles' 3.0 Guide: How To Unlock Spells And Sorcery
Teenbeautyfitness
Where Can I Cash A Huntington National Bank Check
Topos De Bolos Engraçados
Sand Castle Parents Guide
Gregory (Five Nights at Freddy's)
Grand Valley State University Library Hours
Holzer Athena Portal
Hello – Cornerstone Chapel
Stoughton Commuter Rail Schedule
Selly Medaline
Latest Posts
Article information

Author: Maia Crooks Jr

Last Updated:

Views: 6109

Rating: 4.2 / 5 (43 voted)

Reviews: 90% of readers found this page helpful

Author information

Name: Maia Crooks Jr

Birthday: 1997-09-21

Address: 93119 Joseph Street, Peggyfurt, NC 11582

Phone: +2983088926881

Job: Principal Design Liaison

Hobby: Web surfing, Skiing, role-playing games, Sketching, Polo, Sewing, Genealogy

Introduction: My name is Maia Crooks Jr, I am a homely, joyous, shiny, successful, hilarious, thoughtful, joyous person who loves writing and wants to share my knowledge and understanding with you.