2

Is there a simple way to simplify an expression in terms of vector operations?

For example, when I evaluate this;

v1 = {x1, y1, z1};
v2 = {x2, y2, z2};
v3 = {x3, y3, z3};
v4 = {x4, y4, z4};
Integrate[1, {x, y, z} \[Element] Tetrahedron[{v1, v2, v3, v4}]]

I get this horrible abomination;

1/6 Abs[x3 y2 z1 - x4 y2 z1 - x2 y3 z1 + x4 y3 z1 + x2 y4 z1 - x3 y4 z1 - x3 y1 z2 + x4 y1 z2 + x1 y3 z2 - x4 y3 z2 - x1 y4 z2 + x3 y4 z2 + x2 y1 z3 - x4 y1 z3 - x1 y2 z3 + x4 y2 z3 + x1 y4 z3 - x2 y4 z3 - x2 y1 z4 + x3 y1 z4 + x1 y2 z4 - x3 y2 z4 - x1 y3 z4 + x2 y3 z4]

However, this is simply the formula for the tetrahedron volume;

$$\frac16 \left| ( \vec{v}_2 - \vec{v}_1 ) \cdot ( ( \vec{v}_3 - \vec{v}_1 ) \times ( \vec{v}_4 - \vec{v}_1 ) ) \right|$$

Can Mathematica show the result I get in terms of vectors and vector operations?

There are other questions similar to this, but answers are some hacky manipualtions and not quite what I'm looking for.

Isn't there a simple, non-hacky, built-in way? There must be! C'mon Mathematica...

  • You could define vectors $Assumptions = (v1 | v2 | v3 | v4) \[Element] Vectors[dim, Reals], but you need a "vectorformulated Tetrahedron"! – Ulrich Neumann Jul 01 '19 at 14:01
  • I tried that. $Assumptions = (v1 | v2 | v3 | v4) \[Element] Vectors[3, Reals]; Integrate[1, {x, y, z} \[Element] Tetrahedron[{v1, v2, v3, v4}]] However, I got this error: Integrate::ilim: Invalid integration variable or limit(s) in {x,y,z}\[Element]Tetrahedron[{v1,v2,v3,v4}]. – Mahmut Akkuş Jul 01 '19 at 14:09
  • Because "Tetrahedron" expects "euclidian coordinates" . You have to define your own "Tetrahedron" I think. – Ulrich Neumann Jul 01 '19 at 14:23
  • Welcome to Mathematica.SE! I suggest the following: 1) As you receive help, try to give it too, by answering questions in your area of expertise. 2) Take the tour! 3) When you see good questions and answers, vote them up by clicking the gray triangles, because the credibility of the system is based on the reputation gained by users sharing their knowledge. Also, please remember to accept the answer, if any, that solves your problem, by clicking the checkmark sign! – Michael E2 Jul 01 '19 at 15:34
  • Somewhat related: https://mathematica.stackexchange.com/questions/3242/can-mathematica-do-symbolic-linear-algebra, https://reference.wolfram.com/language/guide/SymbolicTensors.html. But you have to start with a vector/tensor formulation, perhaps. – Michael E2 Jul 01 '19 at 15:47
  • Execute Abs[(v2 - v1).((v3 - v1)\[Cross](v4 - v1))]/6, which is your desired answer, what do you get? When v1 etc. are evaluated, they are replaced by their coordinate versions. Similarly Dot[] and Cross[] will expand in terms of given coordinates when their arguments are defined in terms of coordinates. Your desired result is like wanting 2 * 3 to remain factored instead of evaluating to 6. -- BTW, Integrate is probably using the equivalent formula Abs[Det[{v2 - v1, v3 - v1, v4 - v1}]]/6, which of course evaluates to the coordinate form – Michael E2 Jul 01 '19 at 16:04
  • Interestingly, Simplify won't replace vectors, it seems: Simplify[{-x1 + x4, -y1 + y4, -z1 + z4}, v4v1 == {-x1 + x4, -y1 + y4, -z1 + z4}]. Looks more and more like swimming upstream. – Michael E2 Jul 01 '19 at 16:22
  • Also somewhat related: https://mathematica.stackexchange.com/a/74039/4999 – Michael E2 Jul 01 '19 at 16:41
  • @MichaelE2 Thanks. Sure, if I use Mathematica as a numerical calculation software, it is perfectly acceptable, as I'm only interested in resulting numbers. However, if I use it as a software that does symbolic mathematical analysis, it should be able give results in abstract mathematical notations. Nevertheless, lucky for me, for my particular problem (integrate some polynomials over a tetrahedron), I've been able recognize some common terms myself, and some conscious use Simplify[] also helped on the way, to get final results in vector form. – Mahmut Akkuş Jul 01 '19 at 17:07
  • @MichaelE2 I actually also found a paper for polynomial integration over a tetrahedron, however I don't have enough willpower and intelligence points to study it right now, nor to dive deep in the Mathematica :) I'm pretty sure some crazy use of Mathematica and some librarys of it would do it. As I said, luckily, Mathematica did the integraiton for me (which was the hardest part), and I have been able to convert the result into vector form manually by hand. – Mahmut Akkuş Jul 01 '19 at 17:17

0 Answers0