Questions tagged [algebraic-manipulation]

The art of manipulating an algebraic expression into the desired form.

Filter by
Sorted by
Tagged with
50
votes
6answers
11k views

Finding real roots of negative numbers (for example, $\sqrt[3]{-8}$)

Say I want to quickly calculate $\sqrt[3]{-8}$, to which the most obvious solution is $-2$. When I input $\sqrt[3]{-8}$ or Power[-8, 3^-1], Mathematica gives the ...
34
votes
8answers
2k views

How do I get my equation to have the form $(x-a)^2 + (y-b)^2 + (z-c)^2-d = 0$?

I want Mathematica to express the equation $$-11 - 2 x + x^2 - 4 y + y^2 - 6 z + z^2=0$$ in the form $$(x - 1)^2 + (y - 2)^2 + (z - 3)^2 - 25=0$$ How do I tell Mathematica to do that?
34
votes
2answers
14k views

What is the proper way to verify that two expressions are equal?

First of all, it appears to me that $$\left|\frac{1}{x} + x^2\right| = \frac{|1 + x^3|}{|x|}$$ is true. I don't know why, but my attempt to verify it in Mathematica failed. ...
32
votes
6answers
17k views

Replacing composite variables by a single variable

To replace a single variable by another variable, one can simply use the the replace all (/.) operator (e.g., ...
26
votes
1answer
905 views

Transform Root objects into Trigonometric expressions

Consider the Root objects roots = Table[Root[-1 + 27 #1^2 - 162 #1^4 + 243 #1^6 &, i],{i,1,6}] These can be expressed in terms trigonometric functions as ...
24
votes
11answers
7k views

Defining a function that completes the square given a quadratic polynomial expression

How can I write a function that would complete the square in a quadratic polynomial expression such that, for example, CompleteTheSquare[5 x^2 + 27 x - 5, x] ...
23
votes
5answers
2k views

How to implement dual numbers in Mathematica?

I wonder how can I implement dual numbers in Mathematica, so that all functions work well with them (as with complex numbers). Particularly, for each function $f$, $f(\varepsilon)=f^\prime(0)\...
21
votes
7answers
14k views

How do I replace a variable in a polynomial?

How do I substitue z^2->x in the following polynomial z^4+z^2+4? z^4+z^2+4 /. z^2->x ...
21
votes
2answers
2k views

Differentiating functions of vectors/matrices?

I'm dealing with derivatives of scalar functions of matrices and wondering if Mathematica can help me here. The standard approach of expanding it in terms of components is cumbersome. As an ...
19
votes
1answer
306 views

Undocumented fourth parameter of Collect; how long has it been there?

While tinkering with How to get a list of monomials of a polynomial without coefficients? on a whim I tried a fourth argument in Collect and found: ...
18
votes
5answers
5k views

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

I have an inequality expression that I would like to express in terms of the relation of the parameters to zero. More simply, I want to have mathematica move all the terms to one side of the ...
18
votes
4answers
742 views

How do I introduce a new variable in a trigonometric equation?

I have the trigonometric equation \begin{equation*} \sin^8 x + 2\cos^8 x -\dfrac{1}{2}\cos^2 2x + 4\sin^2 x= 0. \end{equation*} By putting $t = \cos 2x$, I have \begin{equation*} \dfrac{3}{16} t^4+ \...
18
votes
4answers
16k views

Factoring polynomials to factors involving complex coefficients

I've run into some problems using Factor on polynomials with complex coefficient factors. Reading the documentation it looks like it only factors over the ...
18
votes
1answer
521 views

Why is ReplaceAll behaving like this?

I'm learning to use the ReplaceAll function and I found the behavior of which is quite confusing. For Sqrt[f[x, y]] /. f[___] -> u Mathematica returns <...
18
votes
2answers
1k views

Expressing a polynomial as a sum of squares

I encountered a degree 4 polynomial in 8 variables f(a1,a2,a3,a4,b1,b2,b3,b4) that I suspect can be written as a sum of squares. While sostools in MATLAB would find ...
18
votes
1answer
2k views

Block Matrix Algebra with Mathematica

I have come up with some BlockMatrix Algebra for Mathematica to make notations easier. I have the following: ...
17
votes
2answers
2k views

How to define a non-standard algebra in Mathematica?

I want to define an algebra, where there are three elements: 0, 1 and $\infty$ and two operations, addition and multiplication defined, both commutative: $$\begin{align*} 0+0&=0\\ 0+1&=1\\ ...
17
votes
4answers
6k views

Is there a way to Collect[] for more than one symbol?

Oftentimes you find yourself looking for polynomials in multiple variables. Consider the following expression: a(x - y)^3 + b(x - y) + c(x - y) + d as you can ...
17
votes
1answer
1k views

Most efficient way to determine conclusively whether an algebraic number is zero

Let x be an algebraic number of unspecified degree, expressed using arithmetic, rational powers, and algebraic integers (edit: ...
16
votes
4answers
4k views

How to extract expression from ConditionalExpression

p1 := y /. {First[Solve[x^2 + y^2 + x == 1, y, Reals]]} ...
15
votes
3answers
9k views

How can I convert a complex number into an exponent form

When I have an expression such as (1/4 + I/4) ((1 - 2 I) x + Sqrt[3] y) it is hard to get an intuition of the number. So I want to convert it to the complex ...
15
votes
5answers
3k views

How to get exact roots of this polynomial?

The equation $$ 64x^7 -112x^5 -8x^4 +56x^3 +8x^2 -7x - 1 = 0 $$ has seven solutions $x = 1$, $x = -\dfrac{1}{2}$ and $x = \cos \dfrac{2n\pi}{11}$, where $n$ runs from $1$ to $5$. With ...
15
votes
3answers
7k views

How can I rationalize the denominator of an expression?

Mathematica doesn't rationalize the denominator automatically, and I haven't found anything in the documentation about it. But I found an old post on MathGroup, which proposes a solution using ...
15
votes
2answers
492 views

Factor a polynomial Root into Roots of smallest possible degree

Suppose I have a polynomial Root representing an algebraic number. I want to represent it as a product of several polynomial Root...
15
votes
2answers
2k views

Pull out scalars from NonCommutativeMultiply in commutator of SU2 spin algebra

I am trying to work on spin chains in Mathematica. That is, N spin-1/2 on a one-dimensional lattice with periodic boundary condition (N+1=1). I need therefore the SU2 spin algebra $S_z, S_+, S_-$ with ...
14
votes
2answers
433 views

Transform an expression to remove the singularity

I have the expression Sin[c x]/c. Clearly it is undefined at $c=0$, but that is merely a removable singularity, since $$\frac{\sin(cx)}c=x\frac{\sin(cx)}{cx}= x\...
13
votes
3answers
1k views

Factor a polynomial over the reals

I can't seem to find a function in Mathematica that factors a polynomial over the reals. Obviously, Factor doesn't work since it works over the integers, over $\mathbb{Z}_p$, or some algebraic fields ...
13
votes
1answer
420 views

ToNumberField won't recognize Root as an explicit algebraic number

Bug fixed in 10.0.0 In Mathematica 9.0.1, it appears that ToNumberField will not always recognize a Root object as an explicit ...
12
votes
4answers
918 views

How to replace every possible $A+B$ and $AB$ in expansion of $(A+B)^{10}-A^{10}-B^{10}$ with $x$ and $y$, respectively?

I would like to replace every possible $A+B$ and $AB$ in expansion of $(A+B)^{10}-A^{10}-B^{10}$ with $x$ and $y$, respectively. How to do it with the simplest code in Mathematica? For example, \...
12
votes
1answer
538 views

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

Consider: Sin[Pi/5] which returns: $$\sqrt{\frac58-\frac{\sqrt5}{8}}$$ Does anyone know how to figure out the trigonometric identities used by Mathematica to ...
12
votes
1answer
317 views

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

Consider the following: a = 1+(x+y+z+u)^10000 (* Out[57]= 1+(u+x+y+z)^10000 *) e = -a*z+a*z (* Out[59]= z (-1-(u+x+y+z)^10000)+z (1+(u+x+y+z)^10000) *) How can ...
12
votes
1answer
706 views

Rearrange an algebraic expression so that each variable appears only once

Mathematica gave me a solution to an equation in this form: ans1 = (b c)/(a - a c + b c) $\text{ans1} = \frac{b c}{a - a c + b c}$ From solving the same equation ...
11
votes
4answers
7k views

Checking if two trigonometric expressions are equal

Say I have two trigonometric expressions which are a bit complicated. Is there a quick way to check if they reduce to the same thing (that they are equal) using Mathematica? I was solving this: $y'' ...
11
votes
3answers
2k views

Square both sides of an equation?

Can I define an equation (for example, x+1 == y^2 + 2), and tell Mathematica to square both sides? If not, what is an equivalent way to achieve this?
11
votes
2answers
7k views

Why doesn't Mathematica expand Cos[x]^3 Sin[x]^2?

I found some examples of Mathematica's commands usage in an old manual but the program gives me different result than expected ...
11
votes
2answers
2k views

InverseSeries of multiple variables and multiple equations

CONTEXT Let us consider a bit of the Universe in which we draw spheres (see a high resolution image here). Astronomers have shown that the density within these spheres could be predicted quite ...
11
votes
2answers
495 views

Why is ToRadicals[] not able to handle all cases? Is there a workaround?

The documentation for the function ToRadicals says: ♦ There are some cases in which expressions involving radicals can in principle be given, but ...
10
votes
4answers
924 views

Distances between points in periodic cube

Question How can one implement more efficiently/elegantly/memory savvily the following function which returns a matrix of all Euclidian distances between points in 3D within a cube of width ...
10
votes
4answers
726 views

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

I am looking for a Mathematica function equivalent to MATLAB's residue function. If there is no Mathematica equivalent, I would like to write a function that given ...
10
votes
2answers
4k views

How do I expand a sum?

I have a problem with Mathematica's symbolic manipulations. As an example, consider the following expression: $$\sum _{i=1}^n -2 x_i \left(-a x_i-b+y_i\right)=0$$ How do I get Mathematica to expand ...
10
votes
2answers
1k views

Shaping/simplifying equations in a certain way

A problem I am occasionally facing is to simplify an equation not to it's shortest form but to a form that is simple by other means. Often, this is grouping the term according to certain functions, ...
10
votes
5answers
874 views

Simplify radical expression (a + b - Sqrt[a^2 - b^2])/Sqrt[a + b]

I have the following expansions: $\frac{a+b-\sqrt{a^2-b^2}}{\sqrt{a+b}}$ and $a>b>0$ Obviously we can simplify it further by hand $\sqrt{a+b}-\sqrt{a-b}$, but Mathematica doesn't know how to ...
10
votes
2answers
529 views

How to apply chain rule to a differential equation

There is a simple differential equation $ y''(x) + (\varepsilon - x^2) y(x) = 0 $. If one uses the new variable $ x^2 = s $, using the chain rule, this differential equation becomes $ 4 s y''(s) + 2 y'...
10
votes
2answers
2k views

Expand modulus squared

Is it possible to make a function in Mathematica that expands expressions of the form $$|z + w|^2 = |z|^2 + 2\text{Re} \overline{z}w + |w|^2?$$ Preferably it should also be able to handle things ...
10
votes
2answers
934 views

Mathematica can't simplify some logarithmic expressions

When I simplify some logarithmic expressions in Mathematica, it just returns the expression ...
10
votes
2answers
4k views

Noncommutative multiply- expand expression

I began to use Mathematica a few days ago. My problem is: how do I expand expressions like $(a+b)\ast(a+b)$, where the multiplication is noncommutative? Can Mathematica do this?
10
votes
2answers
869 views

Memory leak issues

I am working with noncommuting objects and basically I am using Mathematica to sort large expressions by normal ordering and simplifying them. To this end, I first create an object called ...
9
votes
6answers
3k views

How to simplify a complicated Sum in terms of power Sums?

For example, I have: $a=\sum _{r=1}^n x_r \left(\left(\sum _{i=1}^n x_i-x_r\right){}^2-\sum _{i=1}^n x_i^2\right)$ ...
9
votes
2answers
2k views

Lagrangian to Hamiltonian

I want to go from Lagrangian description to Hamiltonian one. Using the example given by Mathematica I do something like: ...
9
votes
2answers
177 views

Computing the seven roots of a polynomial

This question was originally asked by @fsrong70 six months ago. The OP deleted it shortly after posting and has not returned to this site since. I had just figured it out when it was deleted. I ...

1
2 3 4 5
12