# Tag Info

29

Here is a recursive method using Outer: FactorPoints[{1}] := {{0, 0}} FactorPoints[{n_}] := 3/2 Csc[Pi/n] Through[{Cos, Sin}[# (2 Pi)/n]] & /@ Range[n] FactorPoints[{n_, rest__}] := Flatten[Outer[Plus, 9/4 Csc[Pi/n] FactorPoints[{rest}], FactorPoints[{n}], 1], 1] FactorPlot[n_] := Graphics[Disk /@ FactorPoints[Sort[Flatten[ConstantArray ...

29

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 approach used in the timeout case is essentially poly = s^5 + 32s^4 + 363s^3 + 2092s^2 + 5052s + 4320; sols = s /. Solve[poly == 0, s]; N[Times @@ (s - sols)]...

28

The engine behind this inside Compile is a well-hidden function called OptimizeExpression. it has two levels, 1 and 2. Setting to 2 makes it work harder to find CSEs. e1 = (G u^2 (6 p (2 h + p) - 8 (h + p) u + 3 u^2))/(12 h^2); e2 = (G (3 h + 3 p - 2 u) u^2)/(3 h^2); Experimental`OptimizeExpression[{e1, e2}, OptimizationLevel -> 2] (* Out= ...

24

Let me introduce the following animated approach: As you can see, I've slightly changed the way of diagram generation. The main differences are the following. 1. Now the diagrams are more symmetric. This is due to proper rotation after each sudivision. 2. As the main principle is to use factors in decreasing order, I consider 4 as a separate factor and ...

21

Here's my modest attempt: shiftMe[g_, 1] := g shiftMe[g_, {2, tag_Integer?Positive}] := If[OddQ[tag], Translate[Scale[g, 1/2], #] & /@ {{0, 1}, {0, -1}}, Translate[Scale[g, 1/2], #] & /@ {{1/2, 0}, {-1/2, 0}}] shiftMe[g_, k_?PrimeQ] := Translate[Scale[g, 1/k], Through[{Cos, Sin}[2 π #/k - π/(2 k)]]] & /@ Range[0, k - 1] /; k > 2 ...

17

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. I let it evaluate for several hours on the latest Mathematica version without success and my machine is pretty strong performance wise. I also tested older ...

13

Szabolcs found a page that does animated transitions between the diagrams in JavaScript here. Here's an iterative implementation of the diagrams and some basic animated transitions between them. DynamicModule[{shapes, t, n, next, keyframes}, shapes[i_] := Thread@{Table[ ColorData["BlueGreenYellow"]@Rescale[a, {1, i}], {a, i}], Disk /@ First@ ...

12

Since we can consider $f$ as a $4-$th order polynomial (with respect to $y$) we can always factorize it as you claim in terms of radicals, but for the sake of simplicity let's start writing it symbolically in terms of the Root objects defining $f$ to be p[x,y]: p[x_, y_] := x^9 - x^6 + 4 x^5 y + 2 x^3 y^2 - y^4 pf[x_, y_] = -Times @@ (y - (y /. {ToRules @ ...

12

As noted, one sticking point is that polynomial roots in general cannot be represented in Mathematica by anything other than Root[] objects. Nevertheless, it is possible to do a few manipulations to factorize a real polynomial into its linear and quadratic factors. decompose[poly_, x_] /; PolynomialQ[poly, x] := Module[{gr, rts}, rts = x /. Solve[...

11

More concise, but same idea as in Artes' approach (which I upvoted, but I'm adding this anyway because it won't squeeze into a comment). factorCompletely[poly_, x_] := Module[ {solns, lcoeff}, solns = Solve[poly == 0, x, Cubics -> False, Quartics -> False]; lcoeff = Coefficient[poly, x^Exponent[poly, x]]; lcoeff*(Times @@ (x - (x /. solns))) ...

11

By default Mathematica can factorize polynomials to lower order ones in terms of integers if it's possible. Extension serves factorization over the rationals extended by a finite set of algebraic numbers, i.e. any element of the extension is a finite combination of rationals and algebraics $(a_1, a_2,...,a_n)$. The fundamental theorem of algebra states that ...

11

Here is a very simple little function that takes two expressions k and p, and any function that accepts a single expression (like Expand, Together, Simplify,Apart,...). It then factors k from p and outputs a new expression $p=kq$. The parameter func_ operates on the form of $q$. Here is the function: sfactor[k_, p_, func_] := HoldForm[StandardForm[k]]*...

11

Pol2 = Resultant[Pol /. √3 -> a, a^2 - 3, a]; facs = Factor[Pol2, Extension -> √3 I]; // AbsoluteTiming fac = Select[Subsets[facs, {2}], Expand[# == Pol] &][] Pol == fac // Simplify {1.3518, Null} ((6 I-2 √3) y+(-3 I-√3) x y-12 √3 y^2 z+(-18 I+6 √3) x y^2 z+6 I x^2 y^2 z+(-4 I+4 √3) z^3+8 I x z^3+(-I-√3) x^2 z^3) ((6 I+2 √3) y+(-3 I+√...

10

Level may provide a means of getting started. Level breaks down your polynomials into their constituent parts, with various "levels" of complexity. As @Rex Kerr noted in a comment, Level 1 happens to be interesting in the present example. a=(G u^2 (6 p (2 h+p)-8 (h+p) u+3 u^2))/(12 h^2); b=(G (3 h+3 p-2 u) u^2)/(3 h^2); Intersection[Level[a,1],Level[b,1]...

10

Here's a way that seems to work: CenterDot @@ Flatten[ConstantArray @@@ FactorInteger[20!]] CenterDot @@ Flatten[ConstantArray @@@ FactorInteger] To get the number back, merely do Times @@ expr where expr is the name for the expression that results from the code above.

10

You can also make use of Inactive to allow you to calculate the value later. Starting with march's solution and altering the Apply. n = 20!; t = Inactive[Times] @@ Flatten[ConstantArray @@@ FactorInteger[n]] (* 2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*2*3*3*3*3*3*3*3*3*5*5*5*5*7*7*11*13*17*19 *) t can be Activated to calculate the value. Activate@t == n (* True ...

9

This is Andrew's method with a few tweaks of my own. The addition of the adjustment argument should make other customization a bit easier. f[{1}] = {{0, 0}}; f[{2}] = {{0, -9}, {0, 9}}/8; f[{2, 2, rest___}] := f[{4, rest}, RotationMatrix[π/4]] f[{n_}, adj___] := Array[3/2 Csc[π/n] {Cos@#, Sin@#} &[# 2 π/n + π/2] &, n].adj f[{n_, rest__}, ...

9

Consider your expression, expr = (a + m a + b + n b + c + k c + d + e)/(a b); This gets us almost where we want to go, Expand@expr (* 1/a + 1/b + c/(a b) + d/(a b) + e/(a b) + (c k)/( a b) + m/b + n/a *) But we have too many terms with the same denominator, so we can use GatherBy to group them, then simplify the sums of terms with the same denominator, ...

9

Although there might be various approaches, it seems that proceeding the most obvious one should be good enough We have Collect[(x^2 - f[k]) (x^2 - g[k]) // Expand, x] x^4 + x^2 (-f[k] - g[k]) + f[k] g[k] on the other hand it should be identically equal to Collect[4096 - 20480 k^2 + 16384 k^4 - 128 x^2 - 320 k^2 x^2 + x^4, x] 4096 - 20480 k^2 + 16384 k^...

8

My lucky day (night). I get to take my own answer which was of dubious value here and basically repurpose it to give a good response to this question. We set this up as a mixed linear program by trying to get sums of logs of factors as close to m as possible, subject to coefficients being nonnegative integers that do not exceed the powers of the ...

8

This is a variant on the suggestion by @Artes. We start by defining a set of substitutions, using some new variables. Create a Groebner basis. Not to worry if that's not a familiar concept, suffice it to say that we use it for purposes of algebraically rewriting polynomials. The thing to know is that the old variables are to be given greater priority than ...

8

Your direct method isn't working because neither Complex nor Collect works the way you are expecting. So depending on what you mean by "elegant", the answer to your question may be no. You can jury-rig Collect to work using expr = 2 u + I + 2 + I; Expand[expr/I] /. Complex[x_, y_] -> x + i y I Collect[%, i, Simplify] /. i -> I (* 2 - 2 i - 2 i u *) (...

8

You can find the roots using Solve: sol = Solve[x^5 - 3 x^4 + x^2 - 11 x + 6 == 0, x] // N {{x -> -1.53612}, {x -> 0.552473}, {x -> 3.1838}, {x -> 0.399923 - 1.4355 I}, {x -> 0.399923 + 1.4355 I}} The linear factors are those corresponding to the real roots and the quadratic factors correspond to the imaginary roots. You can get the ...

8

Mathematica uses FactorTerms to remove content from factors. Since Sqrt[-3] evaluates to I Sqrt, I gets factored out as "content". FactorTerms[1 + I Sqrt + 2 x] I (-I + Sqrt - (2 I) x) You can use AlgebraicNumber to make extension generators atomic. Factor[x^2 + x + 1, Extension -> AlgebraicNumber[I Sqrt, {0, 1}]] ((2 x + AlgebraicNumber[...

8

One way is to find the roots, separate into real and complex, further separate the complex ones into conjugate pairs, then reform as a factorization (taking into account the leading coefficient). I'll illustrate with the given example. poly = x^4 + 17 x^2 + 12; roots = x /. NSolve[poly]; rroots = Select[rts, FreeQ[#, Complex] &] croots = Complement[...

8

how do I check if one polynomial is a factor of another in Mathematica? One possibility might be to use PolynomialRemainder PolynomialRemainder[x^4-1,x^2-1,x]==0 (*True*) Based on using $\frac{p(x)}{d(x)} = Q(x) + \frac{R(x)}{d(x)}$. Where $R(x)$ is the Remainder and $Q(x)$ is the quotient. So if $d(x)$ is factor of $p(x)$ then the Remainder should be ...

7

Defining a function like Clear[FactorByVariable] FactorByVariable[p_,c_]:=c Expand[p/c] will be one of the simpler options. The argument p is the polynomial you wish to factor from and c is the variable you wish to factor out. I think the reason you can't get your desired result with something like FactorTerms[a x + b x^2 + c x^3,{a,c,x}] is because ...

7

Rewriting your definitions slightly poly = (2 x1 x2 x5 x6 y2 (x2 y1 + x3 (y1 + y2)) y3^2 y4 (x5 y5 + x4 (y4 + y5)))/((x2 y2 + x1 (y1 + y2)) (x3 y3 + x2 (y2 + y3))^2 (x4 y3 + x5 (y3 + y4))^2 (x5 y4 + x6 (y4 + y5))); eqns = { K1 == ((x2 y2 + x1 (y1 + y2)) (x3 y3 + x2 (y2 + y3)))/(x2 y2 (x3 y3 + x2 (y2 + y3) + x1 (y1 + y2 + y3))), K2 == (...

7

How about that -1 + x^(2/3) // ComplexExpand[#, TargetFunctions -> {Re, Im}] & // FullSimplify // Factor // PowerExpand (* (-1 + x^(1/3)) (1 + x^(1/3)) *)

7

Note that the divisor count function of a number with prime factorization $$n=p_1^{a_1} p_2^{a_2} \cdots p_i^{a_i}$$ satisfies: $$\tau (n)=\prod _k^i \left(a_k+1\right)$$ So, to find an inverse of the divisor count function, we need to find a number whose prime factorization is equal to the right hand side, from which we can determine what the values of \$...

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