# FullSimplify fail with general assumption

Assume I want to simplify this:

-a^(-1) ** b^(-1) + (b ** a)^(-1)


given assumption:

$\frac{1}{b\_\text{**}a\_}=\frac{1}{a\_}\text{**}\frac{1}{b\_}$

Then it correctly evaluate to 0. But when I give this assumption:

$\frac{\text{n$\_$}}{\text{x$\_$}\text{**}\text{y$\_$}}=\frac{\text {n$\_$}}{\text{y$\_$}}\text{**}\frac{\text{n$\_$}}{\text{x$\_$} }$

it fail to calculate correctly.

When expand assumptions to InputForm, I see that

$\frac{1}{b\_\text{**}a\_}=\frac{1}{a\_}\text{**}\frac{1}{b\_}$ is ((b_)**(a_))^(-1) == (a_)^(-1)**(b_)^(-1), and

$\frac{\text{n$\_$}}{\text{x$\_$}\text{**}\text{y$\_$}}=\frac{\text {n$\_$}}{\text{y$\_$}}\text{**}\frac{\text{n$\_$}}{\text{x$\_$} }$ is (n_)/(x_)**(y_) == ((n_)/(y_))**((n_)/(x_)).

So, maybe the difference between ^(-1) and / make Simplify run wrong.

Question:

• Why don't Mathematica always use /?
• Why does Simplify think 1/a different from a^(-1)?
• Are you using NoncommutativeMultiply[] (**) on purpose? – J. M. is in limbo May 7 '16 at 7:23
• @J.M. I want to simplify over Quaternions. (If that set existed) – user202729 May 7 '16 at 7:25
• Please show the full Simplify expression you are using explicitly. also Don't use latex to format code. – MarcoB May 7 '16 at 14:45

I think the problem is because the pattern n_/x_ ** y_ doesn't match the expression 1/b ** a. You can see that in the full form:

FullForm[1/b ** a]
(*Power[NonCommutativeMultiply[b,a],-1]*)

FullForm[n/x ** y]
(*Times[n,Power[NonCommutativeMultiply[x,y],-1]]*)


So this deosn't work

Simplify[- (1/a) ** (1/b) + 1/b ** a,
Assumptions -> {n_/x_ ** y_ == (n_/y_) ** (n_/x_)}]
(* -(1/a) ** (1/b) + 1/b ** a *)


but this does

Simplify[- (c/a) ** (c/b) + c/b ** a,
Assumptions -> {n_/x_ ** y_ == (n_/y_) ** (n_/x_)}]
(* 0 *)


The simplest way to deal with problem is to treat it as a special case:

assums = {n_/x_ ** y_ == (n_/y_) ** (n_/x_), 1/x_ ** y_ == (1/y_) ** (1/x_)};

Simplify[- (1/a) ** (1/b) + 1/b ** a, Assumptions -> assums]
Simplify[- (2/a) ** (2/b) + 2/b ** a, Assumptions -> assums]
Simplify[- (c/a) ** (c/b) + c/b ** a, Assumptions -> assums]
(* 0 *)
(* 0 *)
(* 0 *)


Edit

A better way would be define a transformation function:

trans[exp_] := exp /. {(n_/y_) ** (n_/x_) -> n/x ** y, 1/x_ ** y_ -> (1/y) ** (1/x)}

Simplify[-(1/a) ** (1/b) + 1/b ** a, TransformationFunctions -> {Automatic, trans}]
Simplify[-(2/a) ** (2/b) + 2/b ** a, TransformationFunctions -> {Automatic, trans}]
Simplify[-(c/a) ** (c/b) + c/b ** a, TransformationFunctions -> {Automatic, trans}]
Simplify[(1/2) ** (1/3) - 1/3 ** 2, TransformationFunctions -> {Automatic, trans}]
(* 0 *)
(* 0 *)
(* 0 *)
(* 0 *)

• Can you explain why Simplify[(1/2) ** (1/3) - 1/3 ** 2, assums] do not work, while _ or Blank[] is a pattern object that can stand for any Wolfram Language expression.  (Mathematica 9) – user202729 May 9 '16 at 9:57
• Because the pattern will only match explicitly. A better way would be using transformation functions. See edit. – xslittlegrass May 9 '16 at 15:30