polynomials

How to analyse a sparse adjacency matrix?

ⅰ亾dé卋堺 提交于 2019-12-09 18:16:41
问题 I am researching sparse adjacency matrices where most cells are zeros and some ones here-and-there, each relationship between two cells has a polynomial description that can be very long and their analysis manually time-consuming. My instructor is suggesting purely algebraic method in terms of Gröbner bases but before proceeding I would like to know from purely computer science and programming perspective about how to analyse sparse adjacency matrices? Does there exist some data mining tools

Log2 approximation in fixed-point

岁酱吖の 提交于 2019-12-08 07:51:05
问题 I'v already implemented fixed-point log2 function using lookup table and low-order polynomial approximation but not quite happy with accuracy across the entire 32-bit fixed-point range [-1,+1). The input format is s0.31 and the output format is s15.16. I'm posting this question here so that another user can post his answer (some comments were exchanged in another thread but they prefer to provide comprehensive answer in a separate thread). Any other answers are welcome, I would much

For a polynomial, get all its extrema and plot it by highlighting all monotonic pieces

ⅰ亾dé卋堺 提交于 2019-12-07 14:31:25
问题 Someone asked me this interesting question and I think it worthwhile posting it here, as there has not been any relevant thread on Stack Overflow. Suppose I have polynomial coefficients in a length- n vector pc , where a polynomial of degree n - 1 for variable x can be expressed in its raw form: pc[1] + pc[2] * x + pc[3] * x ^ 2 + ... + pc[n] * x ^ (n - 1) R core function polyroot can find all roots of this polynomial in complex domain. But often we are also interested in extrema, as for a

Checking the error detection capabilities of CRC polynomials

老子叫甜甜 提交于 2019-12-07 07:27:15
问题 I tried to find out how to calculate the error detection capabilities of arbitrary CRC polynomials. I know that there are various error detection capabilities that may (or may not) apply to an arbitrary polynomial: Detection of a single bit error: All CRCs can do this since this only requires a CRC width >= 1. Detection of burst errors: All CRCs can detect burst errors up to a size that equals their width. Detection of odd numbers of bit errors: CRC with polynomials with an even number of

Fitting a polynomial using np.polyfit in 3 dimensions

删除回忆录丶 提交于 2019-12-07 03:16:51
问题 I have an array of data, with dimensions (N,3) for some integer N , that specifies the trajectory of a particle in 3D space, i.e. each row entry is the (x,y,z) coordinates of the particle. This trajectory is smooth and uncomplicated and I want to be able to fit a polynomial to this data. I can do this with just the (x,y) coordinates using np.polyfit: import numpy as np #Load the data some_file = 'import_file.txt' data = np.loadtxt(some_file) x = data[:,0] y = data[:,1] #Fit a 4th order

Sympy: Drop higher order terms in polynomial

▼魔方 西西 提交于 2019-12-07 01:35:50
问题 Using Sympy, say we have an expression f, which is a polynomial of the Symbol "x" (and of potentially other symbols). I would like to know what if there is an efficient way to drop all terms in f of order greater than some integer n. As a special case I have a very complicated function but i want to only keep terms up to 2nd order in x. What's the efficient way to do this? The obvious, not-very-efficient way to do it would be for each m less than n, take m derivatives and set x to 0 to obtain

polynomial addition using linked list in java

纵然是瞬间 提交于 2019-12-06 08:49:13
Here's my implementation of a addition of two polynomials using a linked List. For example if I want to add 3x^2+5^x+3 and 4x^3+5x+2 first I check if there are similar exponents in the two polynomials and if so I add their coefficients and I append the exponents to a string. After adding similar exponents then using the string I add the remaining parts in both polynomials to the final result. public class Node2{ int coef; int exp; Node2 next; Node2(int c,int e,Node2 n){ coef=c; exp=e; next=n; } Node2(int c,int e){ coef=c; exp=e; } } public class LinkedPoly{ static String exponent=""; Node2

For a polynomial, get all its extrema and plot it by highlighting all monotonic pieces

浪子不回头ぞ 提交于 2019-12-06 03:21:46
Someone asked me this interesting question and I think it worthwhile posting it here, as there has not been any relevant thread on Stack Overflow. Suppose I have polynomial coefficients in a length- n vector pc , where a polynomial of degree n - 1 for variable x can be expressed in its raw form: pc[1] + pc[2] * x + pc[3] * x ^ 2 + ... + pc[n] * x ^ (n - 1) R core function polyroot can find all roots of this polynomial in complex domain. But often we are also interested in extrema, as for a univariate function, local minima and maxima turn up alternately, breaking the function into monotonic

Checking the error detection capabilities of CRC polynomials

孤者浪人 提交于 2019-12-05 14:32:46
I tried to find out how to calculate the error detection capabilities of arbitrary CRC polynomials. I know that there are various error detection capabilities that may (or may not) apply to an arbitrary polynomial: Detection of a single bit error: All CRCs can do this since this only requires a CRC width >= 1. Detection of burst errors: All CRCs can detect burst errors up to a size that equals their width. Detection of odd numbers of bit errors: CRC with polynomials with an even number of terms (which means an even number of 1-bits in the full binary polynomial) can do this. Detection of

How to fit a polynomial with some of the coefficients constrained?

会有一股神秘感。 提交于 2019-12-05 02:40:43
问题 Using NumPy's polyfit (or something similar) is there an easy way to get a solution where one or more of the coefficients are constrained to a specific value? For example, we could find the ordinary polynomial fitting using: x = np.array([0.0, 1.0, 2.0, 3.0, 4.0, 5.0]) y = np.array([0.0, 0.8, 0.9, 0.1, -0.8, -1.0]) z = np.polyfit(x, y, 3) yielding array([ 0.08703704, -0.81349206, 1.69312169, -0.03968254]) But what if I wanted the best fit polynomial where the third coefficient (in the above