Questions tagged [polynomial-math]

Polynomial Math is a subset of mathematics dealing with mathematical expressions constructed from variables and constants using only the operations of addition, subtraction, multiplication, and non-negative integer exponents. Any polynomial math question should be programming related.

630 questions
0
votes
1 answer

Numpy.ma polyfit function for masked arrays crashes on integer input

The numpy polynomial fit function for masked arrays, ma.polyfit, crashes on integer iput: import numpy.ma as ma x = ma.arange(2) y = ma.arange(2) p1 = ma.polyfit(np.float32(x), y, deg=1) p2 = ma.polyfit( x , y, deg=1) The last line…
Rolf Bartstra
  • 1,643
  • 1
  • 16
  • 19
0
votes
2 answers

Finding integer coordinates between 2 points

I would like to find each integer coordinate point between 2 set of coordinate points. For example, I need the coordinates between (2,15) (6,15). It should give me (3,15) (4,15) (5,15) . I cannot find any math formula or c++ code that does this. I…
rasul1719435
  • 115
  • 4
  • 10
0
votes
1 answer

polyfit function conversion from matlab to r

So matlab help has the following description : [P, S, MU] = POLYFIT[X,Y,N] I know what the input variables mean, but i cant calculate the MU "manually". The MU i need for calculating the area of a peak. I need to convert source code from MATLAB to…
alap
  • 646
  • 1
  • 11
  • 24
0
votes
1 answer

How to construct a polynomial from a string representation such as "x 3x^2 5x^3".. using arrayList

How to construct a polynomial from a string representation such as "x + 3x^2 + 5x^3".. using an arrayList
0
votes
4 answers

polynomial multiplication using fastfourier transform

I am going through the above topic from CLRS(CORMEN) (page 834) and I got stuck at this point. Can anybody please explain how the following expression, A(x)=A^{[0]}(x^2) +xA^{[1]}(x^2) follows from, n-1 ` Σ a_j…
mawia
  • 9,169
  • 14
  • 48
  • 57
0
votes
1 answer

How to solve a polynomial equation with genetic algorithms in java?

For my first class project I need to understand the basics of how genetic algorithms work (no big deal), I also need to find an example of a number optimization problem which is solved by using genetic algorithms in Java, and be able to explain how…
Ramrod
  • 378
  • 7
  • 18
0
votes
1 answer

2d polynomial fitting to table data MATLAB

I am trying to use 2D polynomial fitting for my table data, my data format is exactly like the link below: http://www.mathworks.de/help/toolbox/curvefit/brx2ldg-1.html#bso46rp-1 I mean I have vector X with length n, Y with length m and m*n Matrix Z,…
user1331843
  • 123
  • 1
  • 6
  • 15
0
votes
0 answers

Roots of rational equation with multiple variables?

Let's say we have a rational polynomial in k variables. We are only interested in rational solutions. If k = 1, name the variables {x}, if k = 2, name them {x,y}. For k = 1, it can be done very fast. The Rational Root Theorem gives a set of…
Johannes
  • 2,901
  • 5
  • 30
  • 50
0
votes
1 answer

How to return the real/imaginary part of a symbolic polynomial in MATLAB?

Given a polynomial such as (a+b*i)*c+i, where a, b, c are defined as symbolic elements to represent three real values and i is the imaginary unit, how to return the real part and imaginary part of this polynomial?
datcn
  • 751
  • 5
  • 13
  • 20
0
votes
1 answer

Problems with Polynomial.java zeros method

Here is the location of the source code (using Dropbox). The problem is in the fact that it doesn't evaluate zeros properly. For example: x^2-2x-8 should equal the zeros of {-4, 2}, but instead I get a long exponential value like…
Mohit Deshpande
  • 53,877
  • 76
  • 193
  • 251
0
votes
1 answer

Compilation Error for an array of rational polynomials

I am coding a matrix, whose entries are polynomials with rational coefficients. Any help would be greatly appreciated. I have rational number and rational polynomial declared: rational_number.h struct long_rational{ long p; long q; …
user103500
  • 77
  • 1
  • 8
-1
votes
2 answers

Template Error in c++

#include using namespace std; template struct term { T coef; int exp; }; template class Polynomial { public: class term *termarray; int capacity; int terms; Polynomial(int size); …
-1
votes
1 answer

Build polynomial function from a set of intervals denoting y >= 0

I have a set of ordered, non-overlapping intervals that do not share boundaries, e.g.: long[][] intervals = new long[][]{ new long[]{ 2, 3 }, new long[]{ 5, 10 }, new long[]{ 25, 1200 }, ... } Currently I use a binary search…
Sebastian Barth
  • 4,079
  • 7
  • 40
  • 59
-1
votes
2 answers

Evaluate the Binomial polynomial expression in R

I need to calculate the binomial polynomial expression in r. I can calculate the polynomial expression using polynomial() function in r. But on top of evaluating the expression in polynomial, I want the expression must hold the binomial expression…
Neha
  • 91
  • 1
  • 2
  • 12
-1
votes
1 answer

splitting terms in a polynomial expression without external libraries like sympy

Say i inputted "1+2x+3x^2" or "1-2x+3x^2" How do i make a function that splits and makes a list of each term like [1, 2x, 3x^2] or [1, -2x, 3x^2]. I have been stumped at this for a while, for now the function im using currently, seperates only at…
user13392187