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
Bill Gates’ Weird Reading Habits That Can Change the Way You Read Books
Consolidating Credit Card Debt Without Hurting Your Credit
Joliet Patch Arrests Today
Amc Near My Location
Robinhood Turbotax Discount 2023
What Happened To Father Anthony Mary Ewtn
Moe Gangat Age
Nichole Monskey
I Wanna Dance with Somebody : séances à Paris et en Île-de-France - L'Officiel des spectacles
Busted Barren County Ky
Grab this ice cream maker while it's discounted in Walmart's sale | Digital Trends
Aspen Mobile Login Help
White Pages Corpus Christi
Busted Campbell County
Gazette Obituary Colorado Springs
Directions To Nearest T Mobile Store
Used Patio Furniture - Craigslist
Smartfind Express Login Broward
CVS Health’s MinuteClinic Introduces New Virtual Care Offering
O'reilly's In Mathis Texas
Black Lion Backpack And Glider Voucher
John Philip Sousa Foundation
Vadoc Gtlvisitme App
Town South Swim Club
Funky Town Gore Cartel Video
Ff14 Sage Stat Priority
APUSH Unit 6 Practice DBQ Prompt Answers & Feedback | AP US History Class Notes | Fiveable
Rogold Extension
Red Sox Starting Pitcher Tonight
Publix Daily Soup Menu
Fridley Tsa Precheck
Memberweb Bw
Shaman's Path Puzzle
De beste uitvaartdiensten die goede rituele diensten aanbieden voor de laatste rituelen
Samsung 9C8
Bay Focus
Restored Republic December 9 2022
Los Garroberros Menu
Tirage Rapid Georgia
Main Street Station Coshocton Menu
Pp503063
B.C. lightkeepers' jobs in jeopardy as coast guard plans to automate 2 stations
Torrid Rn Number Lookup
COVID-19/Coronavirus Assistance Programs | FindHelp.org
814-747-6702
Sound Of Freedom Showtimes Near Amc Mountainside 10
Tropical Smoothie Address
10 Best Tips To Implement Successful App Store Optimization in 2024
Game Like Tales Of Androgyny
Congressional hopeful Aisha Mills sees district as an economical model
Subdomain Finer
login.microsoftonline.com Reviews | scam or legit check
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.