22 votes
Accepted

Transform Root objects into Trigonometric expressions

Disclaimer: This is not a full answer, but perhaps it's a start. From an algebraic stand point this seems like a very hard problem. I attacked it with a more brute force approach. I guess a basis and ...
user avatar
  • 32.7k
18 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 ...
user avatar
16 votes
Accepted

How to do algebra on unevaluated integrals?

Similar idea to belisarius, except in V10 we can inactivate Integrate to keep it from evaluating or even trying to evaluate: ...
user avatar
  • 213k
16 votes

How does Mathematica calculate $\sin(\pi/5)$?

In the course of answering this question, I ran into a little bit of weirdness that doesn't square with my experience with previous versions of Mathematica. I think writing this answer is as good a ...
user avatar
15 votes
Accepted

Lagrangian to Hamiltonian

Here is how you would do it using the standard add-on package VariationalMethods, which is meant for calculations like this: ...
user avatar
  • 95k
14 votes
Accepted

Pull out scalars from NonCommutativeMultiply in commutator of SU2 spin algebra

Edit: a sparse array version for larger chains is given at the end. Since you're specifically asking about $SU(2)$, we have a convenient representation in the form of the $2\times 2$ Pauli matrices. ...
user avatar
  • 95k
14 votes

How to simplify -a*z+a*z to 0 where "a" is an expression

Expand takes forever, because it is trying to expand (u + x + y + z)^10000. Tell it not to. ...
user avatar
  • 58.2k
14 votes
Accepted

Is Mathematica intended to be used to do lengthy algebraic calculations?

I do analytical calculations with Mma on the regular basis during already about 10 years in the area of theoretical solid state physics. Previously I did such analytical calculations by hand, now I do ...
user avatar
14 votes

How to extract all the coefficients of a homogeneous polynomial

Using an undocumented function: ...
14 votes

Differentiating functions of vectors/matrices?

In this post I discuss a function MatrixD which attempts to take a matrix derivative following the guidelines given in the The Matrix Cookbook. I still want to ...
user avatar
  • 123k
13 votes
Accepted

How can I make Mathematica do, ArcTanh[x] + ArcTanh[y] = ArcTanh[x+y/1+xy]?

A little bit of trickery: ArcTanh[x] + ArcTanh[y] // Tanh // TrigExpand // FullSimplify // ArcTanh (* ArcTanh[(x + y)/(1 + x y)] *) Note the parentheses.
12 votes

Is it possible to have Mathematica move all terms to one side of an inequality?

Since Mathematica 11.3 you can use SubtractSides, that works for equations and inequalities, for example ...
user avatar
  • 28.9k
12 votes

How to do algebra on unevaluated integrals?

...
user avatar
12 votes
Accepted

Rearrange an algebraic expression so that each variable appears only once

The following approach transforms ans1 to ans2 and points the way to more general approaches. As noted in the Question, ...
user avatar
  • 58.2k
12 votes
Accepted

Rewrite a real polynomial in real (but only linear and quadratic) factors

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 ...
user avatar
12 votes
Accepted

Factor a polynomial Root into Roots of smallest possible degree

A constructive approach The problem can be solved if the form of the solution is given. Define the two factors using a hint (that these should be cubic equations) in the original post ...
user avatar
  • 15.7k
11 votes

How do I use "Factor" to get this form

HornerForm[x1 x2 + x1 x3 x4 + x1 x3 x5] (* x1 (x2 + x3 (x4 + x5)) *)
user avatar
  • 13.4k
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: ...
user avatar
  • 123k
11 votes
Accepted

Computing the seven roots of a polynomial

poly = x^7 + x^6 - 18 x^5 - 35 x^4 + 38 x^3 + 104 x^2 + 7 x - 49; Find an extension in which the polynomial splits: ...
user avatar
  • 213k
10 votes

Distances between points in periodic cube

Very late to the party, but I'll show a method that's faster than anything posted so far and will be hard to beat. First let's define our PeriodicDistance: ...
user avatar
  • 32.5k
10 votes

What is the inside?

The precise details of the Mathematica engine are proprietary, therefore no one will be able to legally post a full answer to your question. The best information I am aware of comes from the Notes on ...
user avatar
  • 264k
10 votes
Accepted

Expanding out multiplied terms

This is a task for Inactivate/Inactive and HoldForm: ...
user avatar
  • 17.8k
10 votes

Lagrangian to Hamiltonian

genCoords = {x[t]}; ke = 1/2 m x'[t]^2; v = 1/2 k x[t]^2; q = -c x'[t]; l = ke - v; Solve for x'[t] in terms of ...
user avatar
  • 21.5k
9 votes
Accepted

How to sort arguments of Times in nonstandard order?

You can create your own ...Form wrapper that will format Times as you want it. Let's start with ordering function that can be ...
user avatar
  • 14.7k
9 votes
Accepted

How to write polynomial expression as commutator form?

Update, December 22 I've developed a version that is more robust. I believe it should work in general, but I'm sure there are some corner cases that won't work (and probably some-not-so-corner cases ...
user avatar
  • 21.5k
9 votes

Factor a polynomial Root into Roots of smallest possible degree

I'll show the resultant formulation for the degree 15 example. The polynomial in question: ...
user avatar
9 votes
Accepted

Finding an analytic solution of a cubic equation

It comes with which roots correspond to which branches of a cubic root in the exact expression. For instance, consider the simpler $$y^3 = z$$ Then my three solutions are $y=\sqrt[3]{z}$, $y=(-1)^{2/...
user avatar
9 votes
Accepted

Can't get Mathematica to simplify an expression

A few things of note: Like @m_goldberg suggested, it is wise to explicitly state d ∈ Reals, s ∈ Reals. Because you introduced .'...
user avatar
  • 8,487
9 votes
Accepted

Factor a polynomial over the reals

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 ...
user avatar

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