Pyhthon cmath.asin() Function



The Python cmath.asin() function is used to complete the arc sine of an angle in radians.

The arc sine function is defined as the inverse of a sine function. The domain of the arc sine function is in the range [-1, 1]; every range in this function is obtained in the form of radians.

Syntax

Following is the syntax for the Python cmath.asin() function −

cmath.asin(x)

Parameters

This function contains a numeric value in the range of -1 to 1. If x is greater than 1 or less than -1, then it will generate an error.

Return Value

This function returns the arc sine of x in radians.

Example 1

In the following example, we are finding the arc sine function for the standard values like '0','-1' and '1'cmath.asin().

import cmath
zero = cmath.asin(0)
neg_one = cmath.asin(-1)
pos_one = cmath.asin(1)
print("Arc Sine value of 0:", zero)
print("Arc Sine value of -1:", neg_one)
print("Arc Sine value of 1:", pos_one)

Output

When we run the above code, it produces the following result −

Arc Sine value of 0: 0j
Arc Sine value of -1: (-1.5707963267948966+0j)
Arc Sine value of 1: (1.5707963267948966+0j)

Example 2

Here, we are passing non-standard cosine ratios as arguments, and then arc sine values for these objects are calculated cmath.asin().

import cmath
x = cmath.asin(0.75)
y = cmath.asin(-0.44)
print(x,y)

Output

The result is displayed as follows −

(0.848062078981481+0j) (-0.45559867339582333+0j)

Example 3

In this example, the input is not a complex number. So, we will get a TypeError.

import cmath
cmath.asin("Welcome to TutorialsPoint")

Output

The output is produced is as follows −

Traceback (most recent call last):
  File "/home/cg/root/30462/main.py", line 2, in 
    cmath.asin("Welcome to TutorialsPoint")
TypeError: must be real number, not str
python_modules.htm
Advertisements
pFad - Phonifier reborn

Pfad - The Proxy pFad of © 2024 Garber Painting. All rights reserved.

Note: This service is not intended for secure transactions such as banking, social media, email, or purchasing. Use at your own risk. We assume no liability whatsoever for broken pages.


Alternative Proxies:

Alternative Proxy

pFad Proxy

pFad v3 Proxy

pFad v4 Proxy