5
$\begingroup$

I want Mathematica to recognize that

A.(-B.C)+A.B.C = 0

Yet FullSimplify and the like leaves the expression as it is. How do I get around this?

$\endgroup$
2
  • 1
    $\begingroup$ C is not a good name for a variable. As you can see, C is in black, indicating that it means something specific to Mathematica. Look up C in the docs if you want. $\endgroup$ Commented May 15, 2013 at 21:34
  • 3
    $\begingroup$ you could argue that capital anything is not a good name for either variables or functions in Mathematica! $\endgroup$
    – SEngstrom
    Commented May 15, 2013 at 22:11

2 Answers 2

5
$\begingroup$

Check the tutorial here.

a.(-b.c) + a.b.c // TensorExpand

(* ==> 0 *)
$\endgroup$
1
$\begingroup$

You can teach Mathematica to factor out any number from inside a dot.

Unprotect[Dot];
x__.(c_?NumberQ y__) := c x.y
(c_?NumberQ x__).y__ := c x.y
Protect[Dot];
$\endgroup$
2
  • $\begingroup$ Keeping in mind that it's very easy to break things or introduce a significant performance penalty by modifying builtins ... $\endgroup$
    – Szabolcs
    Commented May 15, 2013 at 23:43
  • 1
    $\begingroup$ People often don't realize this until they get burnt. $\endgroup$
    – Szabolcs
    Commented May 15, 2013 at 23:44

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.