Questions tagged [algebraic-manipulation]

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

It is often difficult in Mathematica to convert an algebraic expression into a specific form. Algebraic manipulation involves structural and algebraic operations of polynomials, rationals, complex numbers, trigonometric, logical or any other mathematical expression, according to the rules of algebra. There are a number of high-level functions that can perform complex structural changes like Simplify, FullSimplify and Reduce. Additionally, there are many others that can perform more controlled structural changes such as Collect, Together, Cancel, Expand, etc.

Related tags

For (non-algebraic) structural manipulation, use , for controlled evaluation use , for algebraic simplification, use .

Useful links

Example questions

747 questions
18
votes
1 answer

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: Root[...] constructs). I would like to test conclusively whether it is zero. I don't know whether any of the following are…
Tobias Hagge
  • 1,382
  • 9
  • 17
16
votes
3 answers

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 ComplexityFunction. In very simple cases, it works…
bandaoti
  • 193
  • 1
  • 7
11
votes
3 answers

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?
Fawkes5
  • 367
  • 1
  • 11
10
votes
2 answers

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 like $$\left |\sum_{i = 1}^n z_i \right |^2.$$ The…
JT_NL
  • 983
  • 1
  • 6
  • 16
9
votes
1 answer

Extract common subexpressions from expressions

I am trying to evaluate multiple independent expressions with common parts. I would like Mathematica to somehow give me this common parts. It's probably not so clear, so let me give you an example. Let's say I want to compute both of those…
Romain
  • 91
  • 2
8
votes
2 answers

Manipulating an equation into standard quadratic form?

Say I have an equation of the form $$u s + \frac{1}{v} + \frac{1}{p s + q} = 0$$ (or any form that can be written as a standard quadratic, really, the above form is just an example; they'll all be equal to 0 from the start, however) and I want it…
exscape
  • 183
  • 4
7
votes
2 answers

Telling Mathematica to treat square roots as real valued

I often deal with problems which I know are real-valued, but Mathematica skips some simplifications because it doesn't know which branch of Sqrt to take. Is there some generic way to tell it to treat all Sqrt (and perhaps other multibranch…
Yaroslav Bulatov
  • 7,793
  • 1
  • 19
  • 44
7
votes
3 answers

Is there any way to collect only variables with a specific power?

Suppose I've got this: In[13]:= Expand[(a + b) (b + c) (c + a)] Out[13]= a^2 b + a b^2 + a^2 c + 2 a b c + b^2 c + a c^2 + b c^2 And I want to collect only terms involving a^2. In other words, I want the following output: a^2(b + c) + a b^2 + 2 a…
Zachary Turner
  • 213
  • 3
  • 6
7
votes
5 answers

How can I group constants/parameters using Mathematica?

I am trying to solve a problem which may seem quite simple, although I have been unable to find any solution in the documentation or discussion forums. I am not a mathematician, so please bare with me. Can Mathematica group together constant…
Konrad
  • 71
  • 2
6
votes
3 answers

Expanding out multiplied terms

Is there any command in Mathematica to expand terms like $x^2\, y^3$ to $x\,x\,y\,y\,y$? I tried PowerExpansion, but it works for expressions like $(x\,y)^2$ which gives $x^2\,y^2$.
MEDVIS
  • 173
  • 4
6
votes
5 answers

How to group certain symbolic expressions?

For example, I have the following expression : A( 2 x1 + B(y1 + y2) + 2 x2 ) How do I make the output look like this (grouping (x1 + x2) and (y1 + y2) terms together) ? 2A (x1 + x2) + A B (y1 + y2) I don't know why Simplify doesn't group (x1 + x2)…
Fred G
  • 63
  • 1
  • 5
6
votes
4 answers

Expressing $x_{1} ^ n + x_{2}^ n$, where $x_{1}$ and $x_{2}$ are the roots of $ax^2 +bx+c=0$

The roots $x_{1}$ and $x_{2}$ of $$ax^{2}+bx+c=0 $$ satisfy $$ x_{1}+x_{2}=\frac{-b}{a} $$ and $$x_{1}x_{2}=\frac{c}{a}$$ I need Mathematica to give me $x_{1} ^ n + x_{2}^ n$ for any $n$; that is: $${x_{1}}^{2}+{x_{2}}^{2}=(x_{1}+x_{2})^{2}…
zeros
  • 2,263
  • 1
  • 14
  • 18
6
votes
1 answer

How do I use "Factor" to get this form

Here is the default answer. However, I want to get the result which looks like this Here is the Mathematica code: Factor[Subscript[x, 1] Subscript[x, 2] + Subscript[x, 1] Subscript[x, 3] Subscript[x, 4] + Subscript[x, 1] Subscript[x, 3]…
bios
  • 401
  • 2
  • 9
6
votes
4 answers

Forcing Mathematica to Output $1/\sqrt2$ as $\sqrt2/2$

I am trying to force Mathematica to output $\frac{1}{\sqrt2}$ as $\frac{\sqrt2}{2}$. I tried: {1, Sqrt[2]}*Sqrt[2] Which outputs: (* {Sqrt[2], 2} *) Now, Divide @@ {Sqrt[2], 2} returns: (* 1/Sqrt[2] *) So I tried: HoldForm[Divide @@ {Sqrt[2],…
David
  • 14,883
  • 4
  • 44
  • 117
5
votes
1 answer

Working with quantum mechanics spins

I've written the following code for simple quantum mechanics operators on spin states: It seems to work, but the output could be better - how do I let Mathematics know that $0**\ 0==0$, and can I let it compress the up/down ket to have only the 2…
Frank
  • 387
  • 1
  • 7
1
2 3 4 5 6 7 8