Skip to main content
replaced http://mathematica.stackexchange.com/ with https://mathematica.stackexchange.com/
Source Link

I am creating this question and posting an answer to it as a help for those who have problems with Mathematica simplification oddities that appear in other questions on the site.

First of all, there were simplification problems like this onethis one:

Simplify[x + y, x + y == a]
(* ==> x + y *)

Simplify[x + y, x + y == z]
(* ==> z *)

We can see that the culprit is the well known variables names problem in Mathematica simplification. One of the answers points out a simplification function developed by Adam Strzebonski that is based on a series of FullSimplify calls with permutations of the symbols names, in hope of achieving the desired result:

VOISimplify[vars_, expr_, assum_: True] := Module[{perm, ee, best},
    perm = Permutations[vars];
    ee = (FullSimplify @@ ({expr, assum} /. Thread[vars -> #])) & /@ perm;
    best = Sort[Transpose[{LeafCount /@ ee, ee, perm}]][[1]];
    best[[2]] /. Thread[best[[3]] -> vars]
]

It works:

VOISimplify[{a, x, y}, x + y, x + y == a]
(* ==> a *)

Now, testing FullSimplify and VOISimplify on another simplification problem in this questionthis question, we don't have success (the z variable is not canceled):

FullSimplify[(E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z, z != 0]
(* ==> (E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z *)

VOISimplify[{x, y, z}, (E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z, z != 0]
(* ==> (E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z *)

One of the answers to this question was to simply change the variable name from y to a:

FullSimplify[(E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z /. y -> a,  z != 0]
(* ==> a E^(-I x) + (1 + E^(I a)) (a + x) *)

We can see that even VOISimplify has a problem. How to deal with this case?

I am creating this question and posting an answer to it as a help for those who have problems with Mathematica simplification oddities that appear in other questions on the site.

First of all, there were simplification problems like this one:

Simplify[x + y, x + y == a]
(* ==> x + y *)

Simplify[x + y, x + y == z]
(* ==> z *)

We can see that the culprit is the well known variables names problem in Mathematica simplification. One of the answers points out a simplification function developed by Adam Strzebonski that is based on a series of FullSimplify calls with permutations of the symbols names, in hope of achieving the desired result:

VOISimplify[vars_, expr_, assum_: True] := Module[{perm, ee, best},
    perm = Permutations[vars];
    ee = (FullSimplify @@ ({expr, assum} /. Thread[vars -> #])) & /@ perm;
    best = Sort[Transpose[{LeafCount /@ ee, ee, perm}]][[1]];
    best[[2]] /. Thread[best[[3]] -> vars]
]

It works:

VOISimplify[{a, x, y}, x + y, x + y == a]
(* ==> a *)

Now, testing FullSimplify and VOISimplify on another simplification problem in this question, we don't have success (the z variable is not canceled):

FullSimplify[(E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z, z != 0]
(* ==> (E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z *)

VOISimplify[{x, y, z}, (E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z, z != 0]
(* ==> (E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z *)

One of the answers to this question was to simply change the variable name from y to a:

FullSimplify[(E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z /. y -> a,  z != 0]
(* ==> a E^(-I x) + (1 + E^(I a)) (a + x) *)

We can see that even VOISimplify has a problem. How to deal with this case?

I am creating this question and posting an answer to it as a help for those who have problems with Mathematica simplification oddities that appear in other questions on the site.

First of all, there were simplification problems like this one:

Simplify[x + y, x + y == a]
(* ==> x + y *)

Simplify[x + y, x + y == z]
(* ==> z *)

We can see that the culprit is the well known variables names problem in Mathematica simplification. One of the answers points out a simplification function developed by Adam Strzebonski that is based on a series of FullSimplify calls with permutations of the symbols names, in hope of achieving the desired result:

VOISimplify[vars_, expr_, assum_: True] := Module[{perm, ee, best},
    perm = Permutations[vars];
    ee = (FullSimplify @@ ({expr, assum} /. Thread[vars -> #])) & /@ perm;
    best = Sort[Transpose[{LeafCount /@ ee, ee, perm}]][[1]];
    best[[2]] /. Thread[best[[3]] -> vars]
]

It works:

VOISimplify[{a, x, y}, x + y, x + y == a]
(* ==> a *)

Now, testing FullSimplify and VOISimplify on another simplification problem in this question, we don't have success (the z variable is not canceled):

FullSimplify[(E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z, z != 0]
(* ==> (E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z *)

VOISimplify[{x, y, z}, (E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z, z != 0]
(* ==> (E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z *)

One of the answers to this question was to simply change the variable name from y to a:

FullSimplify[(E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z /. y -> a,  z != 0]
(* ==> a E^(-I x) + (1 + E^(I a)) (a + x) *)

We can see that even VOISimplify has a problem. How to deal with this case?

deleted 5 characters in body
Source Link
Giovanni F.
  • 2k
  • 13
  • 21

I am creating this question and posting an answer to it as a help for those who have problems with Mathematica simplification oddities that appear in many other questions on the site.

First of all, there were simplification problems like this one:

Simplify[x + y, x + y == a]
(* ==> x + y *)

Simplify[x + y, x + y == z]
(* ==> z *)

We can see that the culprit is the well known variables names problem in Mathematica simplification. One of the answers points out a simplification function developed by Adam Strzebonski that is based on a series of FullSimplify calls with permutations of the symbols names, in hope of achieving the desired result:

VOISimplify[vars_, expr_, assum_: True] := Module[{perm, ee, best},
    perm = Permutations[vars];
    ee = (FullSimplify @@ ({expr, assum} /. Thread[vars -> #])) & /@ perm;
    best = Sort[Transpose[{LeafCount /@ ee, ee, perm}]][[1]];
    best[[2]] /. Thread[best[[3]] -> vars]
]

It works:

VOISimplify[{a, x, y}, x + y, x + y == a]
(* ==> a *)

Now, testing FullSimplify and VOISimplify on another simplification problem in this question, we don't have success (the z variable is not canceled):

FullSimplify[(E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z, z != 0]
(* ==> (E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z *)

VOISimplify[{x, y, z}, (E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z, z != 0]
(* ==> (E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z *)

One of the answers to this question was to simply change the variable name from y to a:

FullSimplify[(E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z /. y -> a,  z != 0]
(* ==> a E^(-I x) + (1 + E^(I a)) (a + x) *)

We can see that even VOISimplify has a problem. How to deal with this case?

I am creating this question and posting an answer to it as a help for those who have problems with Mathematica simplification oddities that appear in many other questions on the site.

First of all, there were simplification problems like this one:

Simplify[x + y, x + y == a]
(* ==> x + y *)

Simplify[x + y, x + y == z]
(* ==> z *)

We can see that the culprit is the well known variables names problem in Mathematica simplification. One of the answers points out a simplification function developed by Adam Strzebonski that is based on a series of FullSimplify calls with permutations of the symbols names, in hope of achieving the desired result:

VOISimplify[vars_, expr_, assum_: True] := Module[{perm, ee, best},
    perm = Permutations[vars];
    ee = (FullSimplify @@ ({expr, assum} /. Thread[vars -> #])) & /@ perm;
    best = Sort[Transpose[{LeafCount /@ ee, ee, perm}]][[1]];
    best[[2]] /. Thread[best[[3]] -> vars]
]

It works:

VOISimplify[{a, x, y}, x + y, x + y == a]
(* ==> a *)

Now, testing FullSimplify and VOISimplify on another simplification problem in this question, we don't have success (the z variable is not canceled):

FullSimplify[(E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z, z != 0]
(* ==> (E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z *)

VOISimplify[{x, y, z}, (E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z, z != 0]
(* ==> (E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z *)

One of the answers to this question was to simply change the variable name from y to a:

FullSimplify[(E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z /. y -> a,  z != 0]
(* ==> a E^(-I x) + (1 + E^(I a)) (a + x) *)

We can see that even VOISimplify has a problem. How to deal with this case?

I am creating this question and posting an answer to it as a help for those who have problems with Mathematica simplification oddities that appear in other questions on the site.

First of all, there were simplification problems like this one:

Simplify[x + y, x + y == a]
(* ==> x + y *)

Simplify[x + y, x + y == z]
(* ==> z *)

We can see that the culprit is the well known variables names problem in Mathematica simplification. One of the answers points out a simplification function developed by Adam Strzebonski that is based on a series of FullSimplify calls with permutations of the symbols names, in hope of achieving the desired result:

VOISimplify[vars_, expr_, assum_: True] := Module[{perm, ee, best},
    perm = Permutations[vars];
    ee = (FullSimplify @@ ({expr, assum} /. Thread[vars -> #])) & /@ perm;
    best = Sort[Transpose[{LeafCount /@ ee, ee, perm}]][[1]];
    best[[2]] /. Thread[best[[3]] -> vars]
]

It works:

VOISimplify[{a, x, y}, x + y, x + y == a]
(* ==> a *)

Now, testing FullSimplify and VOISimplify on another simplification problem in this question, we don't have success (the z variable is not canceled):

FullSimplify[(E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z, z != 0]
(* ==> (E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z *)

VOISimplify[{x, y, z}, (E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z, z != 0]
(* ==> (E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z *)

One of the answers to this question was to simply change the variable name from y to a:

FullSimplify[(E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z /. y -> a,  z != 0]
(* ==> a E^(-I x) + (1 + E^(I a)) (a + x) *)

We can see that even VOISimplify has a problem. How to deal with this case?

added 16 characters in body
Source Link
Giovanni F.
  • 2k
  • 13
  • 21

I am creating this question and posting an answer to it as a help for those who have problems with MathematicaMathematica simplification oddities that appear in many other questions on the site.

First of all, there were simplification problems like this one:

Simplify[x + y, x + y == a]
(* ==> x + y *)

Simplify[x + y, x + y == z]
(* ==> z *)

We can see that the culprit is the well known variables names problem in MathematicaMathematica simplification. One of the answers points out a simplification function developed by Adam StrzebonskiAdam Strzebonski that is based on a series of FullSimplifyFullSimplify calls with permutations of the symbols names, in hope of achieving the desired result:

VOISimplify[vars_, expr_, assum_: True] := Module[{perm, ee, best},
    perm = Permutations[vars];
    ee = (FullSimplify @@ ({expr, assum} /. Thread[vars -> #])) & /@ perm;
    best = Sort[Transpose[{LeafCount /@ ee, ee, perm}]][[1]];
    best[[2]] /. Thread[best[[3]] -> vars]
]

It works:

VOISimplify[{a, x, y}, x + y, x + y == a]
(* ==> a *)

Now, testing FullSimplifyFullSimplify and VOISimplifyVOISimplify on another simplification problem in this question, we don't have success (the zz variable is not canceled):

FullSimplify[(E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z, z != 0]
(* ==> (E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z *)

VOISimplify[{x, y, z}, (E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z, z != 0]
(* ==> (E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z *)

One of the answers to this question was to simply change the variable name from y to a:

FullSimplify[(E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z /. y -> a,  z != 0]
(* ==> a E^(-I x) + (1 + E^(I a)) (a + x) *)

We can see that even VOISimplifyVOISimplify has a problem. How to deal with this case?

I am creating this question and posting an answer to it as a help for those who have problems with Mathematica simplification oddities that appear in many other questions on the site.

First of all, there were simplification problems like this one:

Simplify[x + y, x + y == a]
(* ==> x + y *)

Simplify[x + y, x + y == z]
(* ==> z *)

We can see that the culprit is the well known variables names problem in Mathematica simplification. One of the answers points out a simplification function developed by Adam Strzebonski that is based on a series of FullSimplify calls with permutations of the symbols names, in hope of achieving the desired result:

VOISimplify[vars_, expr_, assum_: True] := Module[{perm, ee, best},
    perm = Permutations[vars];
    ee = (FullSimplify @@ ({expr, assum} /. Thread[vars -> #])) & /@ perm;
    best = Sort[Transpose[{LeafCount /@ ee, ee, perm}]][[1]];
    best[[2]] /. Thread[best[[3]] -> vars]
]

It works:

VOISimplify[{a, x, y}, x + y, x + y == a]
(* ==> a *)

Now, testing FullSimplify and VOISimplify on another simplification problem in this question, we don't have success (the z variable is not canceled):

FullSimplify[(E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z, z != 0]
(* ==> (E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z *)

VOISimplify[{x, y, z}, (E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z, z != 0]
(* ==> (E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z *)

One of the answers to this question was to simply change the variable name from y to a:

FullSimplify[(E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z /. y -> a,  z != 0]
(* ==> a E^(-I x) + (1 + E^(I a)) (a + x) *)

We can see that even VOISimplify has a problem. How to deal with this case?

I am creating this question and posting an answer to it as a help for those who have problems with Mathematica simplification oddities that appear in many other questions on the site.

First of all, there were simplification problems like this one:

Simplify[x + y, x + y == a]
(* ==> x + y *)

Simplify[x + y, x + y == z]
(* ==> z *)

We can see that the culprit is the well known variables names problem in Mathematica simplification. One of the answers points out a simplification function developed by Adam Strzebonski that is based on a series of FullSimplify calls with permutations of the symbols names, in hope of achieving the desired result:

VOISimplify[vars_, expr_, assum_: True] := Module[{perm, ee, best},
    perm = Permutations[vars];
    ee = (FullSimplify @@ ({expr, assum} /. Thread[vars -> #])) & /@ perm;
    best = Sort[Transpose[{LeafCount /@ ee, ee, perm}]][[1]];
    best[[2]] /. Thread[best[[3]] -> vars]
]

It works:

VOISimplify[{a, x, y}, x + y, x + y == a]
(* ==> a *)

Now, testing FullSimplify and VOISimplify on another simplification problem in this question, we don't have success (the z variable is not canceled):

FullSimplify[(E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z, z != 0]
(* ==> (E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z *)

VOISimplify[{x, y, z}, (E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z, z != 0]
(* ==> (E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z *)

One of the answers to this question was to simply change the variable name from y to a:

FullSimplify[(E^(-I x) y z + (1 + E^(I y)) (x + y) z)/z /. y -> a,  z != 0]
(* ==> a E^(-I x) + (1 + E^(I a)) (a + x) *)

We can see that even VOISimplify has a problem. How to deal with this case?

edited body
Source Link
Giovanni F.
  • 2k
  • 13
  • 21
Loading
The last correction was right, but I intended the other situation, with a. Now corrected.
Source Link
Giovanni F.
  • 2k
  • 13
  • 21
Loading
it's z, not a, if the result has to be z
Source Link
Peltio
  • 5.6k
  • 3
  • 29
  • 27
Loading
edited title
Link
Giovanni F.
  • 2k
  • 13
  • 21
Loading
deleted 3 characters in body
Source Link
Giovanni F.
  • 2k
  • 13
  • 21
Loading
Tweeted twitter.com/#!/StackMma/status/600385035896750080
edited body
Source Link
Giovanni F.
  • 2k
  • 13
  • 21
Loading
added 2 characters in body
Source Link
Giovanni F.
  • 2k
  • 13
  • 21
Loading
Source Link
Giovanni F.
  • 2k
  • 13
  • 21
Loading