To get the number of bits in the exponent portion of the floating point representation, use the iexp attribute of the numpy.finfo() method in Python Numpy. The first parameter is the float i.e. the kind of float data type to get information about.StepsAt first, import the required library −import numpy as npChecking for float16 type. The iexp is to get the number of bits in the exponent portion. The min is the minimum value of given dtype. The max is the minimum value of given dtype. −a = np.finfo(np.float16(45.9)) print("Number of bits in the exponent portion float16 type...", a.iexp) print("Minimum ... Read More
Single-Phase AC Transmission SystemThe electric power transmission system in which two conductors viz. phase conductor and neutral wire are used to transmit the electric power is known as single phase AC transmission system.The single phase AC transmission system can be classified into following three types viz. −Single-phase two-wire system with one conductor earthedSingle-phase two-wire system with mid-point earthedSingle-phase three-wire systemConductor Material Required in 1-Phase 2-Wire System with One Conductor EarthedThe single phase two wire AC system with one conductor earthed is shown in Figure-1.Let, $\mathrm{Power\: transmitted\mathrm{\, =\, }\mathit{P}}$$\mathrm{Maximum \: voltage \: between\: conductors\mathrm{\, =\, }\mathit{V_{m}}}$$\mathrm{RMS\: value\: of \: voltage\mathrm{\, =\, ... Read More
To compute the Hyperbolic tangent of the array elements, use the numpy.tanh() method in Python Numpy. The method is equivalent to np.sinh(x)/np.cosh(x) or -1j * np.tan(1j*x). Returns the corresponding hyperbolic tangent values. This is a scalar if x is a scalar. The 1st parameter, x is input array. The 2nd and 3rd parameters are optional.The 2nd parameter is an ndarray, A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned.The 3rd parameter is the condition is broadcast over the input. ... Read More
To compute the Hyperbolic tangent, use the numpy.tanh() method in Python Numpy. Equivalent to np.sinh(x)/np.cosh(x) or -1j * np.tan(1j*x). Returns the corresponding hyperbolic tangent values. This is a scalar if x is a scalar. The 1st parameter, x is input array. The 2nd and 3rd parameters are optional.The 2nd parameter is an ndarray, A location into which the result is stored. If provided, it must have a shape that the inputs broadcast to. If not provided or None, a freshly-allocated array is returned.The 3rd parameter is the condition is broadcast over the input. At locations where the condition is True, ... Read More
To get the machine limits information for float types, use the numpy.finfo() method in Python Numpy. The first parameter is the floating type i.e. the kind of float data type to get information about.StepsAt first, import the required library −import numpy as npThe min is the minimum value of given dtype and max is the minimum value of given dtype.Checking for float16 type −a = np.finfo(np.float16) print("Minimum of float16 type...", a.min) print("Maximum of float16 type...", a.max)Checking for float32 type −b = np.finfo(np.float32) print("Minimum of float32 type...", b.min) print("Maximum of float32 type...", b.max)Checking for float64 type −c = np.finfo(np.float64) print("Minimum of ... Read More
To get the machine limits information for integer types, use the numpy.iinfo() method in Python Numpy. The first parameter is the int_type i.e. the kind of integer data type to get information about.StepsAt first, import the required library −import numpy as npThe min is the minimum value of given dtype and max is the minimum value of given dtype.Checking for int16 type with instances −a = np.iinfo(np.int16(20)) print("Minimum of int16 type...", a.min) print("Maximum of int16 type...", a.max)Checking for int32 type with instances −b = np.iinfo(np.int32(30)) print("Minimum of int32 type...", b.min) print("Maximum of int32 type...", b.max)Checking for int64 type with instances ... Read More
To get the machine limits information for integer types, use the numpy.iinfo() method in Python Numpy. The first parameter is the int_type i.e. the kind of integer data type to get information about.StepsAt first, import the required library −import numpy as npThe min is the minimum value of given dtype and max is the minimum value of given dtype.Checking for int16 type −a = np.iinfo(np.int16) print("Minimum of int16 type...", a.min) print("Maximum of int16 type...", a.max)Checking for int32 type −b = np.iinfo(np.int32) print("Minimum of int32 type...", b.min) print("Maximum of int32 type...", b.max)Checking for int64 type −c = np.iinfo(np.int64) print("Minimum of int64 ... Read More
To return the scalar dtype or NumPy equivalent of Python type of an object, use the numpy.obj2sctype() method. The 1st parameter is the object of which the type is returned The default parameter, if given, is returned for objects whose types cannot be determined. If not given, None is returned for those objects.StepsAt first, import the required library −import numpy as npTo return the scalar dtype or NumPy equivalent of Python type of an object, use the numpy.obj2sctype() method −print("Using the obj2sctype() method in Numpy")Checking for int −print("Result...", np.obj2sctype(np.array([45, 89]))) print("Result...", np.obj2sctype(np.array([389, 7985])))Checking for float −print("Result...", np.obj2sctype(np.float32)) print("Result...", np.obj2sctype(np.float64)) print("Result...", ... Read More
To return a scalar type which is common to the input arrays, use the numpy.common_type() method in Python Numpy. The 1st parameter is the input array(s). The return type will always be an inexact (i.e. floating point) scalar type, even if all the arrays are integer arrays. If one of the inputs is an integer array, the minimum precision type that is returned is a 64-bit floating point dtype.All input arrays except int64 and uint64 can be safely cast to the returned dtype without loss of information.StepsAt first, import the required library −import numpy as npTo return a scalar type ... Read More
The numpy.can_cast() method returns True if array scalar and data type can occur according to the casting rule. The 1st parameter is the scalar or data type or array to cast from. The 2nd parameter is the data type to cast to.StepsAt first, import the required library −import numpy as npChecking if array scalar and data type can occur according to the casting rule −print("Checking with can_cast() method in Numpy") print("Result...", np.can_cast(np.array(20), 'i1')) print("Result...", np.can_cast(np.array(280), 'i1')) print("Result...", np.can_cast(np.array(80), 'u1')) print("Result...", np.can_cast(np.array(300.7), np.float32)) print("Result...", np.can_cast(np.array(120.6), np.float64)) print("Result...", np.can_cast(np.array(7.2e100), np.float32)) print("Result...", np.can_cast(np.array(6.5e100), np.float64))Exampleimport numpy as np # The numpy.can_cast() method returns ... Read More