Questions tagged [polynomials]
In mathematics, a polynomial is an expression consisting of variables (or indeterminates) and coefficients, that involves only the operations of addition, subtraction, multiplication, and non-negative integer exponents.
876
questions
0
votes
2
answers
30
views
Python not able to calculate a seventh polynomial equation
I have to calculate an equation to translate coordinates in two different fields. With Geogebra I've come up whit this equations which I checked and is correct:
https://imgur.com/a/c8Iul8I <-- Link ...
0
votes
2
answers
66
views
Getting coefficients from a string
I have a project to write a program that receives a polynomial string from the user up to the 5th power (ex. x^3+6x^2+9x+24) and prints out all the real and imaginary roots. The coefficients should be ...
-7
votes
0
answers
45
views
How to solve a fifth degree equation using c ++ [closed]
I want the user to input 5 coefficients of x and a constant
then the program solves these as a fifth degree equation
then find the roots either real or complex .
0
votes
1
answer
21
views
I can not figure out why my for loop is not being taken in MATLAB
In MATLAB, I am trying to write a program that will take 3 coordinates on a graph, (x,y), use those values to solve a system of equations that will find the coefficients of a polynomial equation, y = ...
1
vote
0
answers
46
views
It does not appear to be a standard CRC. Can I know this formula in reverse? [migrated]
Interpreting binary protocols for older equipment. I interpreted most of the contents of the protocol, but the last error detection part seems to be in crc16 form, but it does not seem to be standard.
...
1
vote
1
answer
26
views
Scitkit PolynomialFeatures - struggling to understand higher degree results
I am able to grasp the PolyFeature concept for 2nd degree transformation, as cleared here: Cannot understand with sklearn's PolynomialFeatures
But what if my input vector is [a,b,c] and I need to ...
0
votes
1
answer
36
views
What is the number of degrees needed for polynomial curve fitting?
Assume we have m data points.
What is the number of degrees needed for polynomial curve fitting if we wish to make the adjusted R^2 value to be 1? (Theoretically, it will be 1, but realistically it's ...
0
votes
0
answers
30
views
How can I retrieve the polynomial equation after utilizing the sklearn.pipeline regression pipeline to fit the best curve in python?
I'm trying to put the approximated polynomial equations I've generated from two datasets into the legend and have them ready to use for some calculus in the future. I'm not sure how to call them after ...
0
votes
0
answers
55
views
How to find a polynomial that passes through a fixed number of points in non-monotonic order?
I have lists of X and Y coordinates of different objects (up to 5 objects maximum, 0 minimum). I want to plot a smooth polynomial connecting them in their correct order. All the examples I have seen ...
0
votes
2
answers
101
views
how to plot the decision boundary of a polynomial logistic regression in python?
I have looked into the example on this website: https://scipython.com/blog/plotting-the-decision-boundary-of-a-logistic-regression-model/
I understand how they plot the decision boundary for a linear ...
0
votes
1
answer
28
views
Replace np.nans in list with calculated values obtained from polynomial regression
I have two lists of y values:
y_list1 = [45,np.nan,np.nan,np.nan, 40,50,6,2,7,np.nan, np.nan,np.nan, np.nan, np.nan]
y_list2 = [4,23,np.nan, np.nan, np.nan, np.nan, np.nan,5, np.nan, np.nan, np.nan, ...
3
votes
0
answers
32
views
How to change The Ring of the polynomial in Julia
Main
using AbstractAlgebra
include("./lib.jl");
S, (a,b,c) = PolynomialRing(QQ,["a","b","c"])
RR = AbstractAlgebra.RealField
s1 = S(b^2*a + c*a - 1)
s2 = S(c*a^...
1
vote
0
answers
56
views
How to plot a best fit curve in Julia when the data is a time series?
I'm trying to plot some measurements over time with a best-fit curve, using Julia's plotting tools. There's already a fairly good answer how to do this with a simple numeric data series:
Julia: How to ...
0
votes
0
answers
35
views
Polynomial Regression - Unused Arguments
I have a dataset with 269 rows and only two variables (A: measurements, B: the time-point at which it was registered, goes from 1 to 280).
I already removed all NaN values after removing outliers with ...
1
vote
0
answers
28
views
R ggplot error bars for 4th degree polynomial
I'm trying to reproduce the right side of this graph from Introduction to Statistical Learning using R (Figure 7.1, p267):
Here is the code I'm using, and while the curve seems on point, the error ...
2
votes
1
answer
25
views
my location-scale estimator function not working with polynomial mean
I'm building my own maximum likelihood estimator that estimates the parameters associated with the mean and standard deviation. On simulated data my function works when the true mean is a linear ...
0
votes
1
answer
56
views
Predicting values using Polynomial/Least Squares Regression
I have a dataset of 2 variables (called x with shape n x 2 values of x1 and x2) and 1 output (called y). I am having trouble understanding how to calculate predicted output values from the polynomial ...
0
votes
1
answer
33
views
Error Simpson's rule for polynomial not equal to 0
I implemented Simpson's rule in Python and tested the error for a cubic polynomial. The error bound of Simpson's rule states that it should be equal to 0, but it is not. Does anybody know why?
def ...
1
vote
2
answers
51
views
Find all roots of a polynomial with sympy
As an example, I want to find all five roots of the polynomial x**3 * (x - 3)**2.
sympy's solve command finds a 0 and a 3:
from sympy import *
x = symbols ('x')
solve (x**3 * (x - 3)**2)
[0, 3]
...
0
votes
1
answer
94
views
Python code to calculate base Lagrange Polynomial is taking too long for large numbers of data
So, I need help minimizing the time it takes to run the code with large numbers of data only by using NumPy. I think the for loops made my code inefficient.. But I do not know how to make the for loop ...
0
votes
0
answers
24
views
Sympy maximum value of absolute complex polynomial coefficients
If I have a complex polynomial
A=['x','y1','x2','y2','x3','y3']
[x1,y1,x2,y2,x3,y3]=sympy.symbols(A)
Poly=(x1+3*y1)*(3*x2+4*y2)*((5+sympy.I)*y3)
sympy.Poly(Poly,x).coeffs()
Then
output:[3, 15 + 3*...
0
votes
1
answer
48
views
Polynomial Expansion without sklearn
I want to try and recreate this functions from scratch (without using sklearn):
# The matrix is M which is 1000x10 matrix.
from sklearn.preprocessing import PolynomialFeatures
poly = ...
0
votes
0
answers
45
views
ValueError: setting an array element with a sequence rectifying error
def nonuniform_poly_interpolation(a,b,p,n,x,f,produce_fig):
xhat = np.zeros(p+1)
for j in range(p+1):
xhat[j] = b - a + a * np.cos(np.pi * (((2*j)+1)/(2*(p+1))))
...
0
votes
0
answers
14
views
Find two polynomials that verify a relation between a couple of numbers (xi, yi)
I have the following math theorem :
Be k < m.
Assume we have m couples (xi, yi), and be l <= (m-k)/2
Then there is Q0, Q1 in K[X] (K is a field) with Q1 =/= 0, such that deg(Q0) <= m-1-l and ...
0
votes
0
answers
31
views
How can I solve symbolically a polynomial equation in Mathematica if the coefficient of the highest power might be zero?
Assume, I would like to solve the following equation:
ax^2+bx+c=0
with a, b and c being parameters later to be determined, a might be even 0.
My try was the following:
In[1]:= sol = Solve[a x^2 + b x ...
0
votes
0
answers
53
views
Use overload operators to calculate two class
Overload op +
Constructor
Supposed output:
b= + 8 * x^3 + 6 * x^2 + 4 * x + 2;
c= + 3 * x^2 + 1;
d= + 8 * x^3 + 9 * x^2 + 4 * x + 3
I try to use a for loop inside the overload function + ...
0
votes
1
answer
21
views
how to repeat a loop a certain number of times to get the Nth derivative?
I am trying to get the Nth derivative for coefficients and powers of a polynomial equation given in a dictionary. In the dictionary, the key is the power and the value is the coefficient of the given ...
0
votes
1
answer
75
views
How to create a third degree polynomial in x and y in matlab?
I was going through matlab docs and it's mentioned that a polynomial can be created and evaluated as mentioned in this doc
However, I would like to create a third degree polynomial in x and y. Example:...
0
votes
1
answer
76
views
Addressing polynomial multiplication and division "overflow" issue
I have a list of the coefficient to degree 1 polynomials, with a[i][0]*x^1 + a[i][1]
a = np.array([[ 1. , 77.48514702],
[ 1. , 0. ],
[ 1. , 2....
0
votes
0
answers
19
views
Reshaping data for sklearn's PolynomialFeatures completely scrambled up the original data
So I understand that in order to use PolynomialFeatures, the original x data needs to be reshaped to make it work. The below plot shows the original data's scatterplot with a simple linear regression ...
0
votes
0
answers
45
views
find a nth order Polynomial equation vs lookup table
I have a 2d table that is non-linear in nature. I would like to use date from one variable a and use its corresponding value of variable b. basically, I want to use the look-up table method but since ...
1
vote
0
answers
34
views
Order of input data effects result of 3d polynomial fit
I am working on a 3D polynomial fit. The data I have are the x and y coordinate of 5 stations, and the velocities at these 5 stations. What I want to do is fit a grid through these points. In turn I ...
1
vote
1
answer
215
views
Fit polynomial to point cloud in 3D using PolynomialFeatures
I have some points which represent movement of some particle in 3D. I am trying to fit polynomial to these points so that I can have one line representing the track the particle has taken. Moreover, ...
0
votes
2
answers
365
views
Polynomial Multiplication using divide and conquer
I'm trying to write code that performs polynomial multiplication using a divide and conquer method. It uses a trick to do only 3 multiplications instead of 4 multiplications, involving splitting each ...
2
votes
1
answer
64
views
How to convert a polynomial user input into python readable form
I have the following input:
and I want to convert it into python readable form like this 'x**2 + 2*x + 2' so that I can use it as an input to other functions. I have:
def func_parse(func):
return ...
0
votes
0
answers
10
views
How to do Regression Analysis for each group of column values differently in Python?
I have a dataset containing thousands of product order that's classified into more than a hundred product cluster. I'm sorry I can't share the data due to privacy reasons.
I need to do a regression ...
0
votes
0
answers
41
views
How do I turn a piecewise polynomial into a function in MATLAB?
I have been fitting some data generated in the lab. The best fit is by piecewise polynomial
I would now need to turn this into a function that I can then plug in a model (where I repeat this function ...
0
votes
1
answer
25
views
R polynomal regression or group values and test between groups + outcome interpreatation
I am trying to model the relation between a scar acquisition rate of a wild population of animals, and I have calculated yearly rates before.
If you see below the plot, it seems to me that rates rise ...
0
votes
1
answer
80
views
using numpy.polynomial.hermite.hermfit in python for curve fitting to data?
I need some help understanding this numpy function called "numpy.polynomial.hermite.hermfit(x, y, deg, rcond=None, full=False, w=None)":https://numpy.org/doc/stable/reference/generated/numpy....
1
vote
1
answer
57
views
How to plot a polynomials
I'm trying to plot these polynomials shown in the image, but I keep receiving errors, and I'm not if my code is correct or not.
Could you please help?
Regards
Polynomials:
CODE:
clear all
close all
...
0
votes
1
answer
45
views
How to plot a 3D surface out of columns data frames if I do not know the polynomial function
I have some data of longitudes and latitudes. My third variable is the penetration of the electric Vehicle in an municipality. Hence, I have sparse datas and I do not know the mapping from f(long,lat) ...
0
votes
0
answers
8
views
Search and prove if some polynomials belong to an ideal
I have the following pb :
Let consider ideal with the basis ${x, y, z}$. Check if next polynomials belong to it or not: $x^5yz^4 + y^3z^7 + z^9$ ;
$2x + 3y + z + 1$. Let consider ideal with the basis $...
5
votes
1
answer
56
views
How to create Polynomial Ring which has Float coefficients Julia
I want to create a polynomial ring which has float Coefficients like this. I can create with integers but, Floats does not work.
using Oscar
S, (a,b,c,d) = PolynomialRing(QQ,["a","b&...
0
votes
0
answers
31
views
Compute only most significant half of GF(2)[X] polynomial (or integer) product efficiently?
I know about Karatuba's algorithm and other even more efficient ways to multiply two large polynomials or integers.
I also know that there is a "middle product" version of Karatsuba which ...
0
votes
0
answers
24
views
Export fitted regression splines (constructed by 'bs' or 'ns') as piecewise polynomials -- including interaction terms
Following the very helpful discussion here:
Export fitted regression splines (constructed by 'bs' or 'ns') as piecewise polynomials
I would like to use the R package SplinesUtils to ...
0
votes
1
answer
88
views
Program to integrate a user-input polynomial in C
So, I have a program that allows the user to choose different methods of integration, and it integrates the function defined at the top of the program. (Please ignore the midpoint rule for mow)
#...
2
votes
2
answers
65
views
Plot of a function in ggplot incorrectly showing as a constant line
I want to plot polynomial functions of high degrees with given coefficients. I created the function f_erzeuger() in order to write a polynomial function f to be able to plot it with ggplot2 and ...
0
votes
1
answer
42
views
Determination of polynomials
I need help solving this task, if anyone had a similar problem it would help me a lot.
The task is:
Write a program that calculates the degree and polynomial p(x) for a given x.
For example:
Enter n:2 ...
0
votes
0
answers
54
views
Addition of polynomial functions
I need help solving this problem, if anyone had a similar problem it would help me a lot.
The task is:
Write a program that loads two polynomials and then calculates and prints their sum, with ...
0
votes
0
answers
83
views
SKlearn PolynomialFeatures R^2 score
I'm trying to create a linear regression model with use of PolynomialFeatures. But when I evaluate it, I get really strange scores. I know that R^2 can be applied to this model and I think I've trying ...