AmitDiwan has Published 10744 Articles

Return the cumulative sum of array elements treating NaNs as zero in Python

AmitDiwan

AmitDiwan

Updated on 28-Feb-2022 06:00:39

279 Views

To return the cumulative sum of array elements over a given axis treating NaNs as zero, use the nancumprod() method. The cumulative sum does not change when NaNs are encountered and leading NaNs are replaced by zeros. Zeros are returned for slices that are all-NaN or empty.The method returns a ... Read More

Compute the Hyperbolic cosine of the array elements in Python

AmitDiwan

AmitDiwan

Updated on 28-Feb-2022 05:56:54

157 Views

To compute the Hyperbolic cosine of the array elements, use the numpy.cosine() method in Python Numpy. The method is equivalent to 1/2 * (np.exp(x) + np.exp(-x)) and np.cos(1j*x). Returns the corresponding hyperbolic cosine values. This is a scalar if x is a scalar. The 1st parameter, x is input array. ... Read More

Get the Machine limits information for float with instances in Python

AmitDiwan

AmitDiwan

Updated on 28-Feb-2022 05:39:40

146 Views

To get the machine limits information for float types, use 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 npThe min is the minimum value of given dtype ... Read More

Java Program to Print Half Diamond Star Pattern

AmitDiwan

AmitDiwan

Updated on 28-Feb-2022 05:38:26

1K+ Views

In this article, we will understand how to print half diamond star pattern. The pattern is formed by using multiple for-loops and print statements.Below is a demonstration of the same −InputSuppose our input is −Enter the number of rows : 8OutputThe desired output would be −The half diamond pattern : ... Read More

Return an array with the number of nonoverlapping occurrences of substring in Python

AmitDiwan

AmitDiwan

Updated on 28-Feb-2022 05:36:55

196 Views

To return an array with the number of non-overlapping occurrences of substring, use the numpy.char.count() method in Python Numpy. The first parameter is the sub i.e. the substring to search for. The numpy.char module provides a set of vectorized string operations for arrays of type numpy.str_StepsAt first, import the required ... Read More

Round to nearest integer towards zero in Python

AmitDiwan

AmitDiwan

Updated on 28-Feb-2022 05:33:38

2K+ Views

To round to nearest integer towards zero, use the numpy.fix() method in Python Numpy. It rounds an array of floats element-wise to nearest integer towards zero. The rounded values are returned as floats. The 1st parameter, x is an array of floats to be rounded. The 2nd parameter, out is ... Read More

Java Program to Print Hollow Right Triangle Star Pattern

AmitDiwan

AmitDiwan

Updated on 25-Feb-2022 13:33:52

5K+ Views

In this article, we will understand how to print hollow right triangle star pattern. The pattern is formed by using multiple for-loops and print statements. For the pyramid at the first line it will print one star, and at the last line it will print n number of stars. For ... Read More

Print Pyramid Star Pattern in Java Program

AmitDiwan

AmitDiwan

Updated on 25-Feb-2022 12:38:05

6K+ Views

In this article, we will understand how to print pyramid star pattern. The pattern is formed by using multiple for-loops and print statements.Below is a demonstration of the same −InputSuppose our input is −Enter the number of rows : 8OutputThe desired output would be −The pyramid star pattern : ... Read More

Java Program to Print Mirror Upper Star Triangle Pattern

AmitDiwan

AmitDiwan

Updated on 25-Feb-2022 11:10:15

492 Views

In this article, we will understand how to print mirror upper star triangle pattern. The pattern is formed by using multiple for-loops and print statements.Below is a demonstration of the same −InputSuppose our input is −Enter the number of rows : 8OutputThe desired output would be −The mirror upper star ... Read More

Multiply one polynomial to another in Python

AmitDiwan

AmitDiwan

Updated on 25-Feb-2022 08:25:14

2K+ Views

To multiply one polynomial to another, use the numpy.polynomial.polynomial.polymul() method in Python. Returns the multiplication of two polynomials c1 + c2. The arguments are sequences of coefficients from lowest order term to highest, i.e., [1, 2, 3] represents the polynomial 1 + 2*x + 3*x**2.The method returns the coefficient array ... Read More

Advertisements