Found 33676 Articles for Programming

Evaluate a 3-D Laguerre series on the Cartesian product of x, y and z in Python

AmitDiwan
Updated on 04-Mar-2022 07:18:30

158 Views

To evaluate a 3-D Laguerre series on the Cartesian product of x, y and z, use the polynomial.laguerre.laggrid3d() method in Python. The method returns the values of the three dimensional Laguerre series at points in the Cartesian product of x, y and z.If c has fewer than three dimensions, ones are implicitly appended to its shape to make it 3-D. The shape of the result will be c.shape[3:] + x.shape + y.shape + z.shape. The 1st parameter, x, y, z are the three dimensional series is evaluated at the points in the Cartesian product of x, y, and z. If ... Read More

Generate a Hermite series with given complex roots in Python

AmitDiwan
Updated on 04-Mar-2022 07:13:18

153 Views

To generate a Hermite series with given complex roots, use the hermite.hermfromroots() method in Python Numpy. The method returns a 1-D array of coefficients. If all roots are real then out is a real array, if some of the roots are complex, then out is complex even if all the coefficients in the result are real. The parameter roots are the sequence containing the roots.StepsAt first, import the required library −from numpy.polynomial import hermite as HTo generate a Hermite series with given complex roots, use the hermite.hermfromroots() method −j = complex(0, 1) print("Result...", H.hermfromroots((-j, j)))Get the datatype −print("Type...", H.hermfromroots((-j, j)).dtype)Get ... Read More

C++ program to find minimum how much rupees we have to pay to buy exactly n liters of water

Arnab Chakraborty
Updated on 04-Mar-2022 07:12:40

223 Views

Suppose we have three numbers n, a and b. We want to buy n liters of water. There are only two types of water bottles nearby, 1-liter bottles and 2-liter bottles. The bottle of the first type a rupees and the bottle of the second type costs b rupees. We want to spend as few money as possible. We have to find the minimum amount of money we need to buy exactly n liters of water.So, if the input is like n = 7; a = 3; b = 2, then the output will be 9, because with 3 2-liter ... Read More

Generate a Vandermonde matrix of the Laguerre polynomial with complex array of points in Python

AmitDiwan
Updated on 04-Mar-2022 07:11:21

105 Views

To generate a pseudo Vandermonde matrix of the Laguerre polynomial, use the laguerre.lagvander() in Python Numpy. The method returns the pseudo-Vandermonde matrix. The shape of the returned matrix is x.shape + (deg + 1, ), where The last index is the degree of the corresponding Laguerre polynomial. The dtype will be the same as the converted x.The parameter, x returns an Array of points. The dtype is converted to float64 or complex128 depending on whether any of the elements are complex. If x is scalar it is converted to a 1-D array. The parameter, deg is the degree of the ... Read More

Evaluate a 2-D Hermite series at points (x,y) with 3D array of coefficient in Python

AmitDiwan
Updated on 04-Mar-2022 07:09:10

154 Views

To evaluate a 2D Hermite series at points (x, y), use the hermite.hermval2d() method in Python Numpy. The method returns the values of the two dimensional polynomial at points formed with pairs of corresponding values from x and y.The 1st parameter is x, y. The two dimensional series is evaluated at the points (x, y), where x and y must have the same shape. If x or y is a list or tuple, it is first converted to an ndarray, otherwise it is left unchanged and if it isn’t an ndarray it is treated as a scalar.The 2nd parameter, C, ... Read More

Integrate a Hermite series and set the Integration constant in Python

AmitDiwan
Updated on 04-Mar-2022 07:07:19

134 Views

To integrate a Hermite series, use the hermite.hermint() method in Python. The 1st parameter, c is an array of Hermite series coefficients. If c is multidimensional the different axis correspond to different variables with the degree in each axis given by the corresponding index. The 2nd parameter, m is an order of integration, must be positive. (Default: 1)The 3rd parameter, k is an integration constant(s). The value of the first integral at lbnd is the first value in the list, the value of the second integral at lbnd is the second value, etc. If k == [] (the default), all ... Read More

Evaluate a 2-D Laguerre series on the Cartesian product of x and y in Python

AmitDiwan
Updated on 04-Mar-2022 07:05:19

121 Views

To evaluate a 2-D Laguerre series on the Cartesian product of x and y, use the polynomial.laguerre.laggrid2d() method in Python. The method returns the values of the two dimensional Laguerre series at points in the Cartesian product of x and y.If c has fewer than two dimensions, ones are implicitly appended to its shape to make it 2-D. The shape of the result will be c.shape[2:] + x.shape + y.shape.The 1st parameter, x, y is the two dimensional series is evaluated at the points in the Cartesian product of x and y. If x or y is a list or ... Read More

Evaluate a 3D Laguerre series at points (x,y,z) with 2D array of coefficient in Python

AmitDiwan
Updated on 04-Mar-2022 07:02:19

124 Views

To evaluate a 3D Laguerre series at points (x, y, z), use the polynomial.laguerre.lagval3d() method in Python Numpy. The method returns the values of the multidimensional polynomial on points formed with triples of corresponding values from x, y, and z..If c has fewer than 3 dimensions, ones are implicitly appended to its shape to make it 3-D. The shape of the result will be c.shape[3:] + x.shape. The 1st parameter is x, y, z. The three dimensional series is evaluated at the points (x, y, z), where x, y, and z must have the same shape. If any of x, ... Read More

Evaluate a 2D Laguerre series at points (x,y) with 3D array of coefficients in Python

AmitDiwan
Updated on 04-Mar-2022 07:00:42

128 Views

To evaluate a 2D Laguerre series at points x, use the polynomial.laguerre.lagval2d() method in Python Numpy. The method returns the values of the two dimensional polynomial at points formed with pairs of corresponding values from x and y.The 1st parameter is x, y. The two dimensional series is evaluated at the points (x, y), where x and y must have the same shape. If x or y is a list or tuple, it is first converted to an ndarray, otherwise it is left unchanged and if it isn’t an ndarray it is treated as a scalar.The 2nd parameter, C, is ... Read More

C++ Program to find minimum possible ugliness we can achieve of towers

Arnab Chakraborty
Updated on 04-Mar-2022 07:09:47

194 Views

Suppose we have an array A with n elements. Consider there are n block towers in a row. The ith tower has height A[i]. In a single day, we can perform the operation: Select two indices i and j (i != j) and move back from tower i to j. It will decrease A[i] by 1 and increase A[j] by 1. The ugliness of the buildings is max(A) − min(A). We have to find the minimum possible ugliness we can achieve.So, if the input is like A = [1, 2, 3, 1, 5], then the output will be 1, because ... Read More

Advertisements