Found 34494 Articles for Programming

FIFO Push Relabel Algorithm

Satvik Watts
Updated on 01-Nov-2023 12:15:11

156 Views

The FIFO Push Relabel algorithm is an algorithm that is used to solve the maximum flow problem. The maximum flow problem is a problem in graph theory in which we have to find the maximum amount of flow of resources or information that can be sent via an interconnected network of components, like pipes, wires, etc. With constraints on how much capacity a single component can handle. In other words, we have a directed graph on N nodes. We are given a source node and a sink node. We also have M edges in the graph, each edge has a ... Read More

Count of pair of nodes at even distance (Using BFS)

Satvik Watts
Updated on 01-Nov-2023 11:56:06

50 Views

In this article, we will find the number of the pair of nodes, which are at an even distance of each other in a graph. We will be using the breadth first search (BFS) approach to find the total count. In the approach discussed in this article, we will use a queue data structure which will contain pair of integers. The queue data structure will allow us to go through the graph using the breadth first search algorithm (BFS). We will pick a random node and apply the breadth first search from that node. We will use two variables to ... Read More

Divide one Hermite series by another in Python using NumPy

Niharika Aitam
Updated on 02-Nov-2023 12:33:03

46 Views

The Hermite series is one of the mathematical techniques, which is used to represent the infinite series of Hermite polynomials. The Hermite polynomials referred as the sequence of orthogonal polynomials which are the solutions of the Hermite differential equation. Dividing one hermite series by another The Hermite series is given by the following equation. f(x) = Σn=0^∞ cn Hn(x) Where Hn(x) is the nth Hermite polynomial cn is the nth coefficient in the expansion. The coefficient cn can be determined by using the below formula: cn = (1/$\mathrm{\surd}$(2^n n!))$\mathrm{\lmoustache}$ f(x) Hn(x) e^(−x^2/2) dx Example ... Read More

Divide each row by a vector element using NumPy

Niharika Aitam
Updated on 02-Nov-2023 11:51:34

238 Views

We can divide each row of the Numpy array by a vector element. The vector element can be a single element, multiple elements or an array. After dividing the row of an array by a vector to generate the required functionality, we use the divisor (/) operator. The division of the rows can be into 1−d or 2−d or multiple arrays. There are different ways to perform the division of each row by a vector element. Let’s see each way in detail. Using broadcasting using divide() function Using apply_along_axis() function Using broadcasting Broadcasting is the method available ... Read More

Divide a DataFrame in a ratio

Niharika Aitam
Updated on 02-Nov-2023 12:01:30

370 Views

Pandas library is used to manipulate the data and analyze the data. The data will be created using the pandas library in two ways Dataframe and Series. A DataFrame is the two dimensional data structure containing the rows and columns. There different ways to divide the DataFrame data based on the ratio. Let’s see them one by one. Using np.random.rand() Using pandas.DataFrame.sample() Using numpy.split() Using numpy.random.rand() In the following example, we will divide the dataframe data into parts by defining the ratio using the randm.rand() function. If we want to divide the data in the percentage of ... Read More

Digital Low Pass Butterworth Filter in Python

Niharika Aitam
Updated on 02-Nov-2023 12:04:35

689 Views

The low pass filter is the electronic filter which passes the frequency of signals lesser than the defined cutoff frequency and the frequency of the signals higher than the cutoff will be attenuated. The High pass Butterworth filter has some specialized features defined as follows. The sampling rate of the given input signal is given as 40 kHz The edge frequency of the pass band is 4 kHz The edge frequency of the stop band is 8 kHz The ripple of the pass band is 0.5 dB The minimum attenuation of the stop band is 40 dB and the ... Read More

Digital High Pass Butterworth Filter in Python

Niharika Aitam
Updated on 02-Nov-2023 12:06:28

517 Views

The high pass filter is the electronic filter which passes the frequency of signals greater than the defined cutoff frequency and the frequency of the signals lower than the cutoff will be attenuated. The attenuation of each frequency is based on the filter design. The High pass Butterworth filter has some specialized features defined as follows. The sampling rate of the given input signal is given as 3.5 kHz The edge frequency of the pass band is 1050 Hz The edge frequency of the stop band is 600 Hz The ripple of the pass band is 1 dB The ... Read More

Digital Band Reject Butterworth Filter in Python

Niharika Aitam
Updated on 02-Nov-2023 12:11:23

177 Views

A Band Reject filter is the filter which rejects or blocks all the frequencies within the range and passes the frequencies outside the range. The Butterworth is the type of a filter designed to filter the frequencies as flat as possible in the pass band. The following are the main features of the digital band reject butter worth filter. The sampling rate of the filter is about 12 kHz. The pass band edge frequencies are in the range of 2100 Hz to 4500 Hz. The stop band edge frequencies are within the range of 2700 Hz to 3900 ... Read More

Digital Band Pass Butterworth Filter in Python

Niharika Aitam
Updated on 31-Oct-2023 16:51:08

759 Views

A Band pass filter is the filter which passes the frequencies within the given range of frequencies and rejects the frequencies which are outside the defined range. The Butterworth band pass filter designed to have the frequency response flat as much as possible to be in the pass band. The following are the specifications of the digital band pass butter worth filter. The sampling rate of the filter is around 40 kHz. The pass band edge frequencies are in the range of 1400 Hz to 2100 Hz. The stop band edge frequencies are within the range of 1050 Hz ... Read More

Differentiate Hermite series and multiply each differentiation by scalar using NumPy in Python

Niharika Aitam
Updated on 31-Oct-2023 16:59:13

41 Views

Hermite_e series is also known as probabilist's Hermite polynomial or the physicist's Hermite polynomial. It is available in mathematics which is used to calculate the sum of weighted hermites polynomials. In some particular cases of the quantum mechanics, the Hermite_e series the weight function is given as e^(−x^2). Calculating Hermite_e series The following is the formula for Hermite_e series. H_n(x) = (−1)^n\:e^(x^2/2)\:d^n/dx^n(e^(−x^2/2)) Where, H_n(x) is the nth Hermite polynomial of degree n x is the independent variable d^n/dx^n denotes the nth derivative with respect to x. In Numpy library we have the function namely, polynomial.hermite.hermder() to ... Read More

Advertisements