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
  • 35.9k
27 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 ...
23 votes
Accepted

Finding the number of odd quintinomial coefficients

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

Get the coefficient matrix from a quadratic form

Here is a very short solution: qf = a x^2 + b y^2 + c z^2 + 2 d x y + 2 e x z + 2 f y z; 1/2 D[qf, {{x, y, z}, 2}] (* ==> {{a, d, e}, {d, b, f}, {e, f, c}} *) ...
Jens's user avatar
  • 97.3k
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.1k
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
  • 66.2k
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 can I get the solutions of $x^n-x-t=0$ in hypergeometric form?

It's been a while; I guess I can post my take on the question now. The following routine for solving the trinomial equation $x^n-x+t=0$ (where $t$ is complex) is of course based on the results of ...
J. M.'s missing motivation's user avatar
14 votes

Funny behaviour when plotting a polynomial of high degree and large coefficients

Surprisingly enough, converting the polynomial to the Bernstein basis yields a result that Plot[] can stably deal with: ...
J. M.'s missing motivation's user avatar
14 votes
Accepted

Get the coefficient matrix from a quadratic form

I think you need CoefficientArrays: ...
xzczd's user avatar
  • 66.2k
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
  • 23.5k
14 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
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

The exact real solutions of a cubic polynomial?

roots = Solve[x^3 - 5 x + 1 == 0, x, Reals] // ToRadicals // ComplexExpand // FullSimplify ...
Bob Hanlon's user avatar
  • 158k
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,674
12 votes

Why Mathematica can not factorize polynomials over algebraic fields?

...
chyanog's user avatar
  • 15.6k
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
Accepted

Create a list of all possible multivariate monomials of a certain order

FrobeniusSolve[] is a very convenient function for this task: ...
J. M.'s missing motivation's user avatar
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

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
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.3k
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
  • 158k
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
  • 236k
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
  • 395k

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