polynomial-math

Algorithm for computing the inverse of a polynomial

女生的网名这么多〃 提交于 2019-11-27 13:32:13
问题 I'm looking for an algorithm (or code) to help me compute the inverse a polynomial, I need it for implementing NTRUEncrypt. An algorithm that is easily understandable is what I prefer, there are pseudo-codes for doing this, but they are confusing and difficult to implement, furthermore I can not really understand the procedure from pseudo-code alone. Any algorithms for computing the inverse of a polynomial with respect to a ring of truncated polynomials? 回答1: I work for Security Innovation,

Transform 2d spline function f(t) into f(x)

人盡茶涼 提交于 2019-11-27 06:51:48
问题 So I've got a special case set of cubic splines, whose 2d control points will always result in a curve that will never cross itself in the x axis. That is, the curves look like they could be a simple polynomial function such that y = f ( x ). I want to efficiently create an array of y coordinates along the spline that correspond to evenly-spaced x coordinates running the length of the spline segment. I want to efficiently find the y coordinates along the spline where, for instance, x =0.0, x

What's the opposite of JavaScript's Math.pow?

南楼画角 提交于 2019-11-27 02:11:32
问题 I'm having a mental block here, and algebra not really being my thing, can you tell me how to re-write the JavaScript code below to derive the variable, c , in terms of a and b ?: a = Math.pow(b, c); c = ? Thanks! 回答1: c = Math.log(a)/Math.log(b) 回答2: Logarithms. You want the logarithm of a. B is the base, c is the exponent, so log b a = c 来源: https://stackoverflow.com/questions/4016213/whats-the-opposite-of-javascripts-math-pow

How to extract polynomial coefficients in Java?

妖精的绣舞 提交于 2019-11-26 21:57:05
问题 Taking the string -2x^2+3x^1+6 as an example, how how to extract -2 , 3 and 6 from this equation stored in the string? 回答1: Not giving the exact answer but some hints: Use replace meyhod: replace all - with +- . Use split method: // after replace effect String str = "+-2x^2+3x^1+6" String[] arr = str.split("+"); // arr will contain: {-2x^2, 3x^1, 6} Now, each index value can be splitted individually: String str2 = arr[0]; // str2 = -2x^2; // split with x and get vale at index 0 回答2: String

Fitting polynomial model to data in R

江枫思渺然 提交于 2019-11-26 19:19:48
I've read the answers to this question and they are quite helpful, but I need help particularly in R. I have an example data set in R as follows: x <- c(32,64,96,118,126,144,152.5,158) y <- c(99.5,104.8,108.5,100,86,64,35.3,15) I want to fit a model to these data so that y = f(x) . I want it to be a 3rd order polynomial model. How can I do that in R? Additionally, can R help me to find the best fitting model? To get a third order polynomial in x (x^3), you can do lm(y ~ x + I(x^2) + I(x^3)) or lm(y ~ poly(x, 3, raw=TRUE)) You could fit a 10th order polynomial and get a near-perfect fit, but

Implementing SSE 4.2's CRC32C in software

你。 提交于 2019-11-26 18:42:16
So I have a design which incorporates CRC32C checksums to ensure data hasn't been damaged. I decided to use CRC32C because I can have both a software version and a hardware-accelerated version if the computer the software runs on supports SSE 4.2 I'm going by Intel's developer manual (vol 2A), which seems to provide the algorithm behind the crc32 instruction. However, I'm having little luck. Intel's developer guide says the following: BIT_REFLECT32: DEST[31-0] = SRC[0-31] MOD2: Remainder from Polynomial division modulus 2 TEMP1[31-0] <- BIT_REFLECT(SRC[31-0]) TEMP2[31-0] <- BIT_REFLECT(DEST[31

Implementing SSE 4.2&#39;s CRC32C in software

╄→尐↘猪︶ㄣ 提交于 2019-11-26 06:31:14
问题 So I have a design which incorporates CRC32C checksums to ensure data hasn\'t been damaged. I decided to use CRC32C because I can have both a software version and a hardware-accelerated version if the computer the software runs on supports SSE 4.2 I\'m going by Intel\'s developer manual (vol 2A), which seems to provide the algorithm behind the crc32 instruction. However, I\'m having little luck. Intel\'s developer guide says the following: BIT_REFLECT32: DEST[31-0] = SRC[0-31] MOD2: Remainder