To display the numpy record array, use the numpy.core.records.array() method in Python Numpy. The 1st parameter is the obj i.e. the input. If obj is None, then call the recarray constructor. If obj is a string, then call the fromstring constructor. If obj is a list or a tuple, then if the first object is an ndarray, call fromarrays, otherwise call fromrecords. If obj is a recarray, then make a copy of the data in the recarray (if copy=True) and use the new formats, names, and titles. If obj is a file, then call fromfile. Finally, if obj is an ... Read More
To construct an array by executing a function over each coordinate, use the numpy.fromfunction() method in Python Numpy. The function is called with N parameters, where N is the rank of shape. Each parameter represents the coordinates of the array varying along a specific axis. For example, if shape were (2, 2), then the parameters would be array([[0, 0], [1, 1]]) and array([[0, 1], [0, 1]])The fromfunction() returns the result of the call to function is passed back directly. Therefore, the shape of fromfunction is completely determined by function. If function returns a scalar value, the shape of fromfunction would ... Read More
The useful output of a power generating station is the kW output which is delivered by the station to the electrical supply system. Sometimes, a power generating station needs to deliver more kW to meet the increased power demand. This can be achieved by any of the following two methods −By increasing kVA capacity – In this method, the kVA capacity of the power generating station is increased at the same power factor to meet the increased kW demand. Although, this causes extra cost to increase the kVA capacity of the power station.By improving power factor – In this method, ... Read More
Most Economical Power FactorThe value to which the power factor should be improved so as to have maximum net annual saving is called the most economical power factor.When a consumer improves the power factor, it results in reduction in his maximum kVA demand. Consequently, there will be an annual saving over the maximum demand charges. Although the power factor improvement involves the capital investment on the power factor correction equipment, the consumer will draw expenditure every year in the shape of annual interest and depreciation on the investment made over equipment used for power factor correction. Hence, the net annual ... Read More
Depreciation of Power Plant EquipmentThe reduction in the value of the equipment and other property of the power station every year is known as depreciation. Therefore, a suitable amount, called depreciation charge, must be set aside annually so that by the time the life span of the power plant is over, the collected amount equals to the cost of the replacement of the power plant.Straight Line Method of DepreciationIn the straight line method of calculating depreciation, a constant depreciation charge is made every year on the basis of total depreciation and the useful life of the equipment or other property. ... Read More
To return a full array with the same shape and type as a given array, use the numpy.full_like() method in Python Numpy. The 1st parameter here is the shape and data-type, define these same attributes of the returned array. The 2nd parameter is the fill value.The order overrides the memory layout of the result. ‘C’ means C-order, ‘F’ means F-order, ‘A’ means ‘F’ if a is Fortran contiguous, ‘C’ otherwise. ‘K’ means match the layout of a as closely as possible.The subok parameter, if True, then the newly created array will use the sub-class type of a, otherwise it will ... Read More
To return a new array of given shape and type, filled with a fill value, use the numpy.full() method in Python Numpy. The 1st parameter is the shape of the new array. The 2nd parameter sets the fill value. The 3rd parameter is used to set the desired data-type of the returned output array.The dtype is the desired data-type for the array. The order suggests whether to store multidimensional data in C- or Fortran-contiguous (row- or column-wise) order in memory.NumPy offers comprehensive mathematical functions, random number generators, linear algebra routines, Fourier transforms, and more. It supports a wide range of ... Read More
To return the lower triangle of an array, use the numpy.tril() method in Python Numpy. The 1st parameter is the input array. The function returns a copy of an array with elements above the k-th diagonal zeroed. For arrays with ndim exceeding 2, tril will apply to the final two axes.The k is the diagonal above which to zero elements. k = 0 (the default) is the main diagonal, k < 0 is below it and k > 0 is above.StepsAt first, import the required library −import numpy as npCreate a 2d array −arr = np.array([[36, 36, 78, 88], [92, ... Read More
To create an array with zero above the main diagonal forming a lower triangular matrix, use the numpy.tri() method in Python Numpy. The 1st parameter is the number of rows in the array. The 2nd parameter is the number of columns in the array.The tri() function returns an array with its lower triangle filled with ones and zero elsewhere; in other words T[i,j] == 1 for j
To create an array with ones below the main diagonal and zeros elsewhere, use the numpy.tri() method in Python NumpyThe 1st parameter is the number of rows in the arrayThe 2nd parameter is the number of columns in the arrayThe 3rd parameter 'k' is the sub-diagonal at and below which the array is filled.The k = 0 is the main diagonal, while k < 0 is below it, and k > 0 is above. The default is 0. The tri() function returns an array with its lower triangle filled with ones and zero elsewhere; in other words T[i, j] == ... Read More
Data Structure
Networking
RDBMS
Operating System
Java
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP