Linked Questions

2
votes
1answer
460 views

How to transform an expression using algebraical instead of pattern rules [duplicate]

I would like to transform rules algebraically. A very simple example would be: - k^2 - 2 k x + x^2 /. {2*k -> 1} This transforms to: - $$k^2-2 k x+x^2$$ ...
0
votes
0answers
50 views

How do you make basic substitutions in Mathematica? [duplicate]

I have an equation: e == m*c^2 + (1/2)*c^2*m*v^2 $$e==m c^2 + \frac{1}{2}c^2\space m\space v^2$$ I need to remove the $v$ variable and replace it with $p$. I also ...
1
vote
0answers
36 views

replacement rules don't account for signs [duplicate]

I would like to make a single replacement rule that disregards the sign. I have the following expression: ...
58
votes
4answers
9k views

Can I simplify an expression into form which uses my own definitions?

This seems like a simple thing to do, but I couldn't find anything relevant from Mathematica documentation. So suppose I have an expression: a*b/(a + a*Cos[a/b]) ...
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 ...
9
votes
3answers
3k views

Replace expressions with symbols

First of all: I'm new to Mathematica, so I would appreciate it if the answers are quite complete. I have the result of calculation that is expressed in $\sin$ and $\cos$. Now, all of these can be ...
10
votes
3answers
468 views

Matching (y/x)^u terms wherever the appear in an expression

Mathematica keeps rewriting expressions, so it is hard to figure what pattern to use. I am trying to replace all occurrences of $\frac{y}{x}$ by $t$, but Mathematica re-writes $\frac{1}{\left(\frac{y}...
8
votes
2answers
251 views

Representing a value in an output as a self defined variable

I'm trying to find a way to have Mathematica always represent a numerical value as a self defined variable that I define using lhs=rhs. For example, if I execute <...
5
votes
2answers
558 views

Why is an integer not considered as a real?

Please consider the following: zeros={0.,0}; data={1, 0., 0}; DeleteCases[data, #]&/@zeros Head/@zeros (*{Real, Integer}*) (*{{1, 0}, {1, 0.}}*) For my ...
3
votes
3answers
415 views

Replacing a sum of expressions

I have an equation which Mathematica solves but gives a huge output. However I notice in this output that the same expression occurs many times. Namely: $E=864 a^6 - 432 a^4 b^2 + 54 a^2 b^4 - b^6 + ...
2
votes
1answer
161 views

Replace an expression with a slightly tricky LHS transformation

I would like to make the substitution x^(11*y) -> r in the following equation x^(11 *y^z) - 1 to end up with: ...
0
votes
1answer
250 views

simplification rule with symmetry

What rule can you think of to replace the first line by the second? I have a bunch of expression like these, which I would like to simplify. All dependent cross terms must be written in the same ...
1
vote
2answers
81 views

Applying a simple transformation rule when Plus automatically simplifies

I have the following simple rules: {x2-x1->s1, -(x2-x1)->-s1, x3-x2->s2, -(x3-x2)->-s2} I want to apply that rule to the following: ...