polynomial-math

Javascript - Parse Polynomials From String [closed]

£可爱£侵袭症+ 提交于 2019-12-25 02:26:40
问题 Closed. This question is off-topic. It is not currently accepting answers. Want to improve this question? Update the question so it's on-topic for Stack Overflow. Closed 6 years ago . I Just Asked this question for objective-c here, but need the answer quick and am able to do the parsing in either objective-c or javascript, so I will ask for js here. In my app the user will be inputting a mathematical expression as a string, such as n*3/7+9-5 , and I need to be able to get the polynomials

Multiplying two polynomials mod n,x^r-1 using long integers: what is the correct window size?

谁说胖子不能爱 提交于 2019-12-24 17:43:13
问题 Using a window multiplication algorithm to multiply two polynomials[coefficients in Z/nZ and the whole polynomial mod x^r-1 for some r] using long-integer multiplications, what size should I give to the window? Where by "window" I mean the bit-length that the coefficients should use in the initial long-integers such that the result of the long-integer multiplication contains the correct coefficients of the result[the sums of the coefficients "don't overlap"]. At the beginning I thought that

How to generate a symbolic multivariate polynomial of a given dimension in SymPy?

时光怂恿深爱的人放手 提交于 2019-12-24 06:44:19
问题 I want to use power series to approximate some PDEs. The first step I need to generate symbolic multivariate polynomials, given a numpy ndarray. Consider the polynomial below: I want to take a m dimensional ndarray of D=[d1,...,dm] where dj s are non-negative integers, and generate a symbolic multivariate polynomial in the form of symbolic expression. The symbolic expression consists of monomials of the form: Fo example if D=[2,3] the output should be For this specific case I could nest two

How to generate a symbolic multivariate polynomial of a given dimension in SymPy?

独自空忆成欢 提交于 2019-12-24 06:44:06
问题 I want to use power series to approximate some PDEs. The first step I need to generate symbolic multivariate polynomials, given a numpy ndarray. Consider the polynomial below: I want to take a m dimensional ndarray of D=[d1,...,dm] where dj s are non-negative integers, and generate a symbolic multivariate polynomial in the form of symbolic expression. The symbolic expression consists of monomials of the form: Fo example if D=[2,3] the output should be For this specific case I could nest two

Matlab cftool producing wrong coefficients

泄露秘密 提交于 2019-12-24 06:40:50
问题 So i have this data x 1.0423 2.8249 3.2016 2.0851 1.0299 4.7397 0.4104 0.5285 0.7102 0.8323 3.1048 2.8685 0.2604 4.6560 3.6433 3.6892 0.3170 4.3022 4.6720 4.9220 y 2.0529 -3.0669 -2.3631 -0.7300 1.4354 2.0260 0.5980 0.5296 1.3405 1.7361 -1.5876 -2.7872 1.0788 1.3677 -0.1355 -1.5755 0.7811 -0.8328 -0.0592 2.0927 And I tried to fit an 8th order polynomial to the data using cftool. These are the results I get which are wrong Linear model Poly8: f(x) = p1*x^8 + p2*x^7 + p3*x^6 + p4*x^5 + p5*x^4 +

Evaluating a polynomial with Horner's Algorithm and calculating steps (Java)

三世轮回 提交于 2019-12-24 05:52:09
问题 I need help on my java code. What I'm trying to accomplish is to calculate the size of each step on a polynomial: double s = (b-a)/nsteps; The inputs for the polynomial to be created is degree, coefficient, start value of x , stopping value of x , and the number of steps. Whenever I try to run a test, my output is 0 for x and y and I'm not sure what I am missing on my code. Here is my run test on how its supposed to work, but my result for x and y is 0 : Enter degree:2 Enter coefficient 2:1

Evaluating a polynomial with Horner's Algorithm and calculating steps (Java)

不打扰是莪最后的温柔 提交于 2019-12-24 05:52:07
问题 I need help on my java code. What I'm trying to accomplish is to calculate the size of each step on a polynomial: double s = (b-a)/nsteps; The inputs for the polynomial to be created is degree, coefficient, start value of x , stopping value of x , and the number of steps. Whenever I try to run a test, my output is 0 for x and y and I'm not sure what I am missing on my code. Here is my run test on how its supposed to work, but my result for x and y is 0 : Enter degree:2 Enter coefficient 2:1

NTRU Pseudo-code for computing Polynomial Inverses

狂风中的少年 提交于 2019-12-24 01:05:39
问题 I was wondering if anyone could tell me how to implement line 45 of the following pseudo-code. Require: the polynomial to invert a(x), N, and q. 1: k = 0 2: b = 1 3: c = 0 4: f = a 5: g = 0 {Steps 5-7 set g(x) = x^N - 1.} 6: g[0] = -1 7: g[N] = 1 8: loop 9: while f[0] = 0 do 10: for i = 1 to N do 11: f[i - 1] = f[i] {f(x) = f(x)/x} 12: c[N + 1 - i] = c[N - i] {c(x) = c(x) * x} 13: end for 14: f[N] = 0 15: c[0] = 0 16: k = k + 1 17: end while 18: if deg(f) = 0 then 19: goto Step 32 20: end if

Java / JUnit - comparing two polynomial objects

六月ゝ 毕业季﹏ 提交于 2019-12-23 19:21:03
问题 I have a Java class called Term holding polynomials like below public Term(int c, int e) throws NegativeExponent { if (e < 0) throw new NegativeExponent(); coef = c; expo = (coef == 0) ? 1 : e; } I also have an equals method in the same class like below @Override public boolean equals(Object obj) { } I am stuck with how to code how to compare these 2 Term objects Within my JUnit test file I am using the test below to try and test the equals method import static org.junit.Assert.*; import org

Degree of polynomial smaller than a number

喜夏-厌秋 提交于 2019-12-23 05:24:05
问题 I am working on a lemma that shows that the degree of a sum of monomials is always less or equal to n if the exponent of each monomial is less or equal to n . lemma degree_poly_smaller: fixes a :: "('a::comm_ring_1 poly)" and n::nat shows "degree (∑x∷nat | x ≤ n . monom (coeff a x) x) ≤ n" sorry What I have to so far is the following (please mind that I am a beginner in Isabelle): lemma degree_smaller: fixes a :: "('a::comm_ring_1 poly)" and n::nat shows "degree (∑x∷nat | x ≤ n . monom (coeff