polynomial-math

How to perform a complicated change of variables for a polynomial (in Mathematica)

邮差的信 提交于 2019-11-30 08:40:36
I have an integer polynomial in four variables (w, x, y, and z) that I know can be written as an integer polynomial in these six variables: a = w z b = x y c = w^3 + z^3 d = x + y e = w^3 x + y z^3 f = w^3 y + x z^3 How can I use Mathematica (or maybe Java) to easily do this change of variables? Daniel Lichtblau Such rewriting can be done by forming a Groebner basis of the replacement polynomials, with respect to a variable order that favors using a-f over w-z. Then use PolynomialReduce with respect to the same order to rewrite your polynomial. Here is an example. I'll start with replacement

How to represent polynomials with numeric vectors in R

和自甴很熟 提交于 2019-11-30 07:54:22
问题 In R how would one represent polynomial expressions and do polynomial math with the numeric vector objects? For example: x1 <- c(2,1) # 2 + x x2 <- c(-1,3) # -1 + 3*x And want: x1 * x2 # to return -2 + 5*x + 3*x^2 Note: I answered a question this morning and then the poster apparently deleted it (making me wonder if it were homework.) So I am re-posting the question from memory. 回答1: One could multiply the coefficients directly using outer and then aggregate the results x1 <- c(2,1) # 2 + x

Cubic Regression (best fit line) in JavaScript

坚强是说给别人听的谎言 提交于 2019-11-29 12:48:40
I'm having the worst time trying to find a JavaScript code that could allow me to do cubic regressions. Would write it myself, but my understanding of polynomial math is, well, suboptimal. So, here's what I'm looking for. Given an input of an array of arrays, where the internal array would be [x,y], the function would give me an output in the form of an array with four parameters - [a,b,c,d], where a, b, c, and d are parameters of the equation y = ax^3 + bx^2 + cx + d. Example: Input is an array like this [[2,5],[5,10],[07,15],[12,20],[20,25],[32,30],[50,35]]. Which essentially is the

How to perform a complicated change of variables for a polynomial (in Mathematica)

亡梦爱人 提交于 2019-11-29 12:42:04
问题 I have an integer polynomial in four variables (w, x, y, and z) that I know can be written as an integer polynomial in these six variables: a = w z b = x y c = w^3 + z^3 d = x + y e = w^3 x + y z^3 f = w^3 y + x z^3 How can I use Mathematica (or maybe Java) to easily do this change of variables? 回答1: Such rewriting can be done by forming a Groebner basis of the replacement polynomials, with respect to a variable order that favors using a-f over w-z. Then use PolynomialReduce with respect to

Solving a Linear Diophantine Equation(see description for examples)

时光怂恿深爱的人放手 提交于 2019-11-29 04:04:39
Let me start off by clarifying that(before you guys dismiss me), this is not a homework problem and I'm not a university student. :) EDIT Thanks to @Klas and others, my question now boils down to a mathematical equation which needs to be solved programmatically. I'm looking for an algorithm/code which solves Linear Diophantine Equation . For lesser mortals like me, here's how such an equation looks like: Example 1: 3x + 4y + 5z = 25 (find all possible values of x,y,z) Example 2: 10p + 5q + 6r + 11s = 224 (find all possible values of p,q,r,s) Example 3: 8p + 9q + 10r + 11s + 12t = 1012 (find

Algorithm for computing the inverse of a polynomial

十年热恋 提交于 2019-11-28 20:55:06
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 ? I work for Security Innovation, which owns NTRU, so I'm glad to see this interest. The IEEE standard 1363.1-2008 specifies how to implement

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

不想你离开。 提交于 2019-11-28 12:16:53
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 =0.1, x =0.2, etc., or approached another way, effectively transform the f x,y ( t ) style function

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

你离开我真会死。 提交于 2019-11-28 08:12:34
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! c = Math.log(a)/Math.log(b) 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

Cubic Regression (best fit line) in JavaScript

岁酱吖の 提交于 2019-11-28 06:22:36
问题 I'm having the worst time trying to find a JavaScript code that could allow me to do cubic regressions. Would write it myself, but my understanding of polynomial math is, well, suboptimal. So, here's what I'm looking for. Given an input of an array of arrays, where the internal array would be [x,y], the function would give me an output in the form of an array with four parameters - [a,b,c,d], where a, b, c, and d are parameters of the equation y = ax^3 + bx^2 + cx + d. Example: Input is an

How to extract polynomial coefficients in Java?

南笙酒味 提交于 2019-11-28 01:38:49
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? 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 String polynomial= "-2x^2+3x^1+6"; String[] parts = polynomial.split("x\\^\\d+\\+?"); for (String part : parts) { System