Skip to main content
29 votes

How do I work with Root objects?

This answer is to summarize the most important points about working with Root objects. Essential reading: Algebraic Numbers in the documentation. What are ...
29 votes

Code I get from wolfram isn't working in mathematica

You can chalk this up as a W|A bug. We do indeed try to factor with the approach stated by OP. When that times out, we try a different approach, but fail to update the code provided to the user. The ...
Greg Hurst's user avatar
  • 36.4k
23 votes
Accepted

Finding the number of odd quintinomial coefficients

Use PolynomialMod: ...
Carl Woll's user avatar
  • 131k
20 votes

Expressing a polynomial as a sum of squares

Here is a somewhat heuristic approach, that relies in this case on the SOS having integer coefficients. I will indicate an alteration that gives a numerical approximation in the general case. Start ...
Daniel Lichtblau's user avatar
19 votes
Accepted

Out of memory when computing a coefficient of a large symmetric polynomial

Split it into 3 steps to get result immediately. ...
Akku14's user avatar
  • 17.3k
18 votes

Neural Network for polynomial fit

... however in Mathematica the net always performs a linear fit, no matter how many layers und neurons I use. I'm guessing you're using only DotPlusLayers. These ...
Niki Estner's user avatar
  • 36.2k
17 votes
Accepted

Code I get from wolfram isn't working in mathematica

I believe your question is completely valid and I gave it a big upvote. Assuming that WolframAlpha did indeed use this command to get the result, I'm not sure on what mystical machine they ran it on. ...
halirutan's user avatar
  • 113k
17 votes
Accepted

What is Mathematica's equivalent to Maple's collect with distributed option?

CoefficientRules[eq, {x, y}] /. ({a_, b_} -> c_) :> c x^a y^b // Total Generalize it to a function: ...
xzczd's user avatar
  • 67.6k
15 votes
Accepted

Solving quintic in radicals

I wrote this function based on Daniel Lazard's paper Solving Quintics by Radicals: ...
Vladimir Reshetnikov's user avatar
15 votes

Curve Fitting Data using Polynomial

EDIT: If you just want a cleaner function, then stick with the excellent answers from @AntonAntonov and @MichaelE2. As they have shown, curve fitting can be done quite easily for your data in ...
MassDefect's user avatar
  • 10.1k
14 votes

How to extract all the coefficients of a homogeneous polynomial

Using an undocumented function: ...
14 votes
Accepted

Create a polynomial of a given degree

...
march's user avatar
  • 24k
14 votes
Accepted

How can I find a parametric equation for an implicit surface?

Putting Michael E2's comment into an answer. ...
Henrik Schumacher's user avatar
13 votes
Accepted

How can I find the roots for $x^4-18x^2-8x+21$ in a nice form?

Your equation seems to be a casus irreducibilis; the solutions cannot be expressed using only real numbers. You can make them "nicer" by using Root objects (try <...
JungHwan Min's user avatar
  • 4,694
12 votes
Accepted

Build a Companion Matrix of a Polynomial?

Here is a slight variation of your method for generating a (Frobenius) companion matrix. This version also yields an upper Hessenberg matrix, but has the (monicized) coefficients appear at the top ...
J. M.'s missing motivation's user avatar
12 votes

Why Mathematica can not factorize polynomials over algebraic fields?

...
chyanog's user avatar
  • 15.7k
12 votes
Accepted

MMA has an error in calculating the minimum polynomial of a rational number

This is because MinimalPolynomial[s, x, Extension -> a] gives the characteristic polynomial of the algebraic number $s$ over the field $Q[a]$. https://...
Adam Strzebonski's user avatar
11 votes

Solving quintic in radicals

I reproduced the algorithm from this post and I tried to use it on your example: An Easy Way To Solve The Solvable Quintic Using Two Sextics. As mentioned in the article, for the quintic equation: $$a ...
Aster's user avatar
  • 3,856
11 votes

Finding coefficients in polynomial function

One liner: Solve[PolynomialRemainder[6 x^3 - 5 x^2 - 12 x + k, 3 x + 2, x] == 0, k]
11 votes
Accepted

Extract common factor

I think PolynomialGCD is the most direct tool: ...
Carl Woll's user avatar
  • 131k
11 votes
Accepted

Factor a bivariate polynomial treating one variable as constant

Although there might be various approaches, it seems that proceeding the most obvious one should be good enough We have ...
Artes's user avatar
  • 57.7k
11 votes
Accepted

Integrate Squared Legendre Polynomial

Generate a sequence using Table then use FindSequenceFunction to find the general form ...
Bob Hanlon's user avatar
  • 161k
11 votes
Accepted

Removing terms with odd degrees in polynomial

Approach #1 I think the following code does the trick: ...
Michael Seifert's user avatar
11 votes
Accepted

Finding astroids

An alternative method for visualization and faster than ContourPlot with PlotPoints -> 1000 for nearly the same high quality ...
Michael E2's user avatar
  • 241k
11 votes

What is Mathematica's equivalent to Maple's collect with distributed option?

Update 2: An alternative way to define a function that works like Maple's collect using CoefficientRules + FromCoefficientRules: ...
kglr's user avatar
  • 399k
11 votes
Accepted

PolynomialQ behaviour

We can use PolynomialExpressionQ, which has an optional 3rd argument that tests if all coefficients satisfy a constraint: ...
Greg Hurst's user avatar
  • 36.4k
10 votes
Accepted

Removing terms of certain degree in multivariable polynomial

poly = a x^2*y - b x*y - c x*y^2 + d x + e y; var = {x, y}; FromCoefficientRules[Select[CoefficientRules[poly, var], Total@#[[1]] == 3 &], var] a x^2 y - c ...
corey979's user avatar
  • 24.1k
10 votes

Finding the number of odd quintinomial coefficients

A slower but still useful approach employs ListCorrelate. ...
bbgodfrey's user avatar
  • 61.9k
10 votes

Mathematica function equivalent to MATLAB's residue function (partial fraction expansion)

This is cheating, but: ...
Daniel Lichtblau's user avatar
10 votes
Accepted

Is there a way to speed up Integrate when the integrand contains a product of polynomials each of which having a large degree?

Perhaps this?: Table[1/2 Gamma[(1 + n)/2], {n, 0, Length@# - 1}] . # &@ CoefficientList[poly1*poly2, x] Low-order check: ...
Michael E2's user avatar
  • 241k

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