Found 33676 Articles for Programming

Generate a Laguerre series with given roots in Python

AmitDiwan
Updated on 04-Mar-2022 06:20:04

140 Views

To generate a Laguerre series with given roots, use the laguerre.lagfromroots() 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 laguerre as LTo generate a Laguerre series with given roots, use the laguerre.lagfromroots() method in Python Numpy −print("Result...", L.lagfromroots((-1, 0, 1)))Get the datatype −print("Type...", L.lagfromroots((-1, 0, 1)).dtype)Get the ... Read More

C++ program to find winner of ball removal game

Arnab Chakraborty
Updated on 04-Mar-2022 09:54:30

281 Views

Suppose we have four numbers n1, n2, k1 and k2. Consider there are 2 boxes, first one has n1 balls and second one has n2 balls. Amal and Bimal are playing the game. In one move they can take from 1 to k1 balls and throw them out, similarly second one will take 1 to k2 balls in his move. Amal starts the game and they plays alternatively. The one who cannot play his move will lose the game. We have to find who will be the winner.So, if the input is like n1 = 2; n2 = 2; k1 ... Read More

Integrate a Laguerre series over axis 0 in Python

AmitDiwan
Updated on 04-Mar-2022 06:18:27

142 Views

To integrate a Laguerre series, use the laguerre.lagint() method in Python. The method returns the Laguerre series coefficients c integrated m times from lbnd along axis. At each iteration the resulting series is multiplied by scl and an integration constant, k, is added. The scaling factor is for use in a linear change of variable.The 1st parameter, c is an array of Laguerre 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: ... Read More

Differentiate a Laguerre series with multidimensional coefficients over axis 1 in Python

AmitDiwan
Updated on 04-Mar-2022 06:16:45

111 Views

To differentiate a Laguerre series, use the laguerre.lagder() method in Python. The method returns the Laguerre series coefficients c differentiated m times along axis. At each iteration the result is multiplied by scl. The argument c is an array of coefficients from low to high degree along each axis, e.g., [1, 2, 3] represents the series 1*L_0 + 2*L_1 + 3*L_2 while [[1, 2], [1, 2]] represents 1*L_0(x)*L_0(y) + 1*L_1(x)*L_0(y) + 2*L_0(x)*L_1(y) + 2*L_1(x)*L_1(y) if axis=0 is x and axis=1 is y.The 1st parameter, c is an array of Laguerre series coefficients. If c is multidimensional the different axis correspond ... Read More

Differentiate a Laguerre series with multidimensional coefficients over specific axis in Python

AmitDiwan
Updated on 04-Mar-2022 06:15:04

145 Views

To differentiate a Laguerre series, use the laguerre.lagder() method in Python. The method returns the Laguerre series coefficients c differentiated m times along axis. At each iteration the result is multiplied by scl. The argument c is an array of coefficients from low to high degree along each axis, e.g., [1, 2, 3] represents the series 1*L_0 + 2*L_1 + 3*L_2 while [[1, 2], [1, 2]] represents 1*L_0(x)*L_0(y) + 1*L_1(x)*L_0(y) + 2*L_0(x)*L_1(y) + 2*L_1(x)*L_1(y) if axis=0 is x and axis=1 is y.The 1st parameter, c is an array of Laguerre series coefficients. If c is multidimensional the different axis correspond ... Read More

Differentiate a Laguerre series and multiply each differentiation by a scalar in Python

AmitDiwan
Updated on 04-Mar-2022 06:13:03

178 Views

To differentiate a Laguerre series, use the laguerre.lagder() method in Python. The method returns the Laguerre series coefficients c differentiated m times along axis. At each iteration the result is multiplied by scl. The argument c is an array of coefficients from low to high degree along each axis, e.g., [1, 2, 3] represents the series 1*L_0 + 2*L_1 + 3*L_2 while [[1, 2], [1, 2]] represents 1*L_0(x)*L_0(y) + 1*L_1(x)*L_0(y) + 2*L_0(x)*L_1(y) + 2*L_1(x)*L_1(y) if axis=0 is x and axis=1 is y.The 1st parameter, c is an array of Laguerre series coefficients. If c is multidimensional the different axis correspond ... Read More

Get the Least squares fit of Laguerre series to data in Python

AmitDiwan
Updated on 04-Mar-2022 06:09:59

288 Views

To get the Least squares fit of Laguerre series to data, use the laguerre.lagfit() method in Python numpy. The method returns the Laguerre coefficients ordered from low to high. If y was 2-D, the coefficients for the data in column k of y are in column k.The parameter, x are the x-coordinates of the M sample (data) points (x[i], y[i]). The parameter, y are the y-coordinates of the sample points. Several sets of sample points sharing the same xcoordinates can be (independently) fit with one call to polyfit by passing in for y a 2-D array that contains one data ... Read More

Return the scaled companion matrix of a 1-D array of Laguerre polynomial coefficients in Python

AmitDiwan
Updated on 04-Mar-2022 06:04:54

120 Views

To return the scaled companion matrix of a 1-D array of Laguerre polynomial coefficients, use the laguerre.lagvander3d() in Python Numpy. The usual companion matrix of the Laguerre polynomials is already symmetric when c is a basis Laguerre polynomial, so no scaling is applied.Returns the Companion matrix of dimensions (deg, deg). The parameter, c is a 1-D array of Laguerre series coefficients ordered from low to high degree.StepsAt first, import the required library −import numpy as np from numpy.polynomial import laguerre as LCreate a 1D array of coefficients −c = np.array([1, 2, 3])Display the array −print("Our Array...", c)Check the Dimensions −print("Dimensions ... Read More

Generate a Pseudo Vandermonde matrix of the Laguerre polynomial and x, y floating array of points in Python

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

134 Views

To generate a pseudo Vandermonde matrix of the Laguerre polynomial, use the laguerre.lagvander2d() 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, y 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 a list of ... Read More

Generate a Pseudo Vandermonde matrix of the Laguerre polynomial and x, y array of points in Python

AmitDiwan
Updated on 04-Mar-2022 05:26:37

120 Views

To generate a pseudo Vandermonde matrix of the Laguerre polynomial, use the laguerre.lagvander2d() 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, y 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 a list of ... Read More

Advertisements