Skip to main content
OverflowAI is here! AI power for your Stack Overflow for Teams knowledge community. Learn more
10 votes

Positive root of $x^q + bx - b$

According to Wolfram Alpha, $x^5+3(x-1)=0$ has no closed-form solution, so you can forget about a nice closed-form expression. :) I see nothing wrong with Newton's method; it should be quick and ...
Federico Poloni's user avatar
9 votes
Accepted

Interpolating a mathematical function using a Hermite Cubic Finite Element Space

Short answer You are missing the Jacobian of the transformation for the derivatives. Long answer The conditions that you propose for your interpolator translate into the following system of ...
nicoguaro's user avatar
  • 8,515
8 votes

Numerical stability of higher order Zernike polynomials

A possible solution (suggested by @gammatester) is to use Jacobi polynomials. This circumvents the problem of catastrophic cancellation in adding the large polynomial coefficients by 'naive' ...
Sanchises's user avatar
  • 273
8 votes
Accepted

Polynomial approximation for floating-point arithmetic

The sine is an odd function, so you want that also in an approximation. A polynomial with $p(0)=0$ can be factored as $p(x)=xq(x)$, so $q(x)\approx \frac{\sin(x)}{x}$. Each interval $[2^n,2^{n+1})$ ...
Lutz Lehmann's user avatar
  • 6,109
7 votes
Accepted

Numerical stability of higher order Zernike polynomials

In this paper, Honarvar and Paramesran derive an interesting method to compute the radial Zernike polynomials in a very nice recursive way. The recursion formula is surprisingly straightforward, ...
wim's user avatar
  • 571
6 votes
Accepted

Numerically stable computation of the Characteristic Polynomial of a matrix for Cayley-Hamilton Theorem

Generally speaking, $P(A)$ would not be close to the zero matrix: if you compute the polynomial $P$ to a relative accuracy of $\epsilon$ (which is $10^{-16}$ in double-precision), then $P(A)$ would be ...
Kirill's user avatar
  • 11.4k
6 votes

Is there any way/any python function to calculate the condition number of the roots of a polynomial directly?

The condition number of a root $r$ of a polynomial $p$ is $$ \kappa := \frac{\left\| p \right\|}{|rp'(r)|} $$ There is some arbitrariness in the choice of norm which affects the definition of the ...
user14717's user avatar
  • 2,155
5 votes

Building Gaussian-type quadrature schemes with Zernike polynomials

Yes, one can extend the Gaussian quadrature (in one dimension) to multiple dimensions. Often this is called cubature. Much work on this has been done by Ronald Cools and collaborators (see his ...
GertVdE's user avatar
  • 6,149
5 votes

Building Gaussian-type quadrature schemes with Zernike polynomials

Unfortunately the 1D reasoning will not directly carry into 2D and beyond. Depending on the domain for your integral, you will have considerable latitude in the node choice - but of course the ...
Reid.Atcheson's user avatar
5 votes

Fast evaluation functions given by straight-line programs

OK, you have a very nice problem, I tried to run some benchmarks. First, I don't have your parameters so I used your small example. Second, since you do not specify the language, I used C + GSL (...
Bracula's user avatar
  • 201
5 votes
Accepted

How to robustly and numerically expand a $k$-order polynomial in two variables defined on a polygon domain?

The problem that you are seeing is a well known problem of these basis functions: $$\phi_{m,n}(x,y) = x^{m}y^{n}$$ I quote from here: The reason why the coefficient matrix is nearly singular and ...
Mithridates the Great's user avatar
5 votes

Gauss Integration of $\sqrt(x)$

Quadrature points $x_1,x_2$ are also unknown. You need two more equations corresponding to $x^2$ and $x^3$. Then you solve for $a_1, a_2, x_1, x_2$.
cfdlab's user avatar
  • 3,028
5 votes
Accepted

Quadrature of rational functions

Choose four collocation points in the interval $[a,b]$, e.g., $ x_0=a\\ x_1=a + (1/3)(b-a)\\ x_2=a + (2/3)(b-a)\\ x_3=b $ and form a matrix $M$ \begin{bmatrix} 1 & x_0 & x_0^2 & x_0^3 \\ 1 ...
Maxim Umansky's user avatar
4 votes

Accurate Polynomial Evaluation in Floating Point

The stability of Horner can be improved by subtracting a constant from each $x$ in the Horner form. This is described in "Stable Evaluation of Polynomials" by C. Mesztenyi and C. Witzgall, ...
Algorithms's user avatar
4 votes

Intervals where the sign of a polynomial can be computed reliably

Yes. You can compute a running error bound, i.e, a number $\mu$ such that the difference between the exact value of $y = p(x)$ and the computed value satisfies $\hat{y}$ satisfies $$|y - \hat{y}| \leq ...
Carl Christian's user avatar
4 votes

Matlab symbolic differentiation of Legendre polynomials

Philips in 1988 proved the following relationship: If $f(x)$ is an infinitely differentiable function defined on the interval $[-1,+1]$ and its Legendre expansion is given by $f(x) = \sum_{n=0}^{\...
GertVdE's user avatar
  • 6,149
4 votes
Accepted

Differentiation Matrix In DG-FEM - Hesthaven/Warburton

Taking your questions in order, the definition of $D_r$ as the operator converting the nodal values of $u_h$ into derivatives follows immediately from the definition, although the notation is a little ...
origimbo's user avatar
  • 2,249
4 votes
Accepted

What does this function called LAGRANGE2 do?

From the name, the error message, and the code, it appears that this code is doing Lagrange polynomial interpolation for a function $f(x)$, given $x_{1} < x_{2} < \ldots < x_{n}$ and function ...
Brian Borchers's user avatar
3 votes

Fast evaluation functions given by straight-line programs

Once you're at the level of a long list of expressions, there is little you can still do other than hope that the compiler finds opportunities for optimization at the assembly level. This may bring ...
Wolfgang Bangerth's user avatar
3 votes

Find the roots of a complicated polynomial

One technique is to use a library with arbitrary large integers and use fixed point arithmetic. Just scale up x by some integer factor, then compute your polynomial in fixed-point, keeping only the ...
Jeffrey's user avatar
  • 131
3 votes

Accurate evaluation of the sign of a polynomial

Compensated Horner method (http://www-pequan.lip6.fr/~jmc/polycopies/Compensation-horner.pdf) has an error bound of the form $$ |\mathrm{comphorner}(p, x) - p(x)| \leq u|p(x)| + \gamma_{2n}^2\tilde p(...
Kirill's user avatar
  • 11.4k
3 votes
Accepted

Polynomial order of an approximation of a section of sine and numerical accuracy

By using orthonormal polynomial basis functions, then you do not need to solve a linear set of equations in order to get the polynomial coefficients, similar to the Fourier series coefficients. ...
fibonatic's user avatar
  • 450
3 votes

Positive root of $x^q + bx - b$

You have demonstrated that the polynomial has only a single positive root (I assume here that you are only interested in positive real roots). Using Cauchy's upper bound for polynomial roots $$1+ \max\...
GertVdE's user avatar
  • 6,149
3 votes
Accepted

Fitting a monotonically increasing spline function

A smoothing spline might be good enough in your case. For example, scipy.interpolate.UnivariateSpline implements this. You can use it in the following way: ...
Pepe's user avatar
  • 459
2 votes

Accurate Polynomial Evaluation in Floating Point

As an alternative you may use the barycentric Lagrange basis which has the same evaluation complexity as the Newton basis. The barycentric formulation is also used in the MATLAB Chebfun implementation....
ConvexHull's user avatar
  • 1,335
2 votes

Accurate evaluation of the sign of a polynomial

You could use interval arithmetic for this purpose.
Juan M. Bello-Rivas's user avatar
2 votes

Intervals where the sign of a polynomial can be computed reliably

I want to add that in addition to Carl Christian's suggestion of using a running error bound, you can also take the general relative error bound $$ \frac{|\hat p(x)-p(x)|}{|p(x)|} \leq \gamma_{2n}\,\...
Kirill's user avatar
  • 11.4k
2 votes
Accepted

Polynomial Interpolation with Matlab polyfit

According with the documentation polyfit is a function that it can make an approximation in the sense of least square. For this reason you can choose the last input parameter, i.e. the degree. ...
Mauro Vanzetto's user avatar
2 votes

Polynomial Interpolation with Matlab polyfit

In the end, this is a linear system. Its matrix is ill-conditioned: cond(vander(1:10)) returns 2.1063e+12. So if you change <...
Federico Poloni's user avatar
2 votes

Polynomial approximation spaces

Let me answer you using a more general concept. We seek a space of functions (not only polynomials) in which a function may be described. This space of functions $V$ is defined by a basis. The number ...
HBR's user avatar
  • 1,648

Only top scored, non community-wiki answers of a minimum length are eligible