1
$\begingroup$

Considering a set of points:

enter image description here

Let Matrix A be:

enter image description here

And B:

enter image description here

Where $\bar{x}$ is given by:

enter image description here

And the same goes for $\bar{y}$ and $\bar{z}$. I want to solve this equation:

enter image description here

But without specifying any values. I can do it for some data and a given value of $n$. Can I find a symbolic solution?

$\endgroup$
3
  • 2
    $\begingroup$ Which variables do you want to solve the equation for? $\endgroup$
    – Lukas Lang
    Commented Oct 2, 2019 at 18:21
  • $\begingroup$ Related to this question-> mathematica.stackexchange.com/questions/206999/… $\endgroup$ Commented Oct 2, 2019 at 18:41
  • $\begingroup$ @LukasLang $\left(x_{c}, y_{c}, z_{c}\right)$, the three components of the final vector after you perform all the operations. $\endgroup$
    – Rodrigo
    Commented Oct 2, 2019 at 18:47

1 Answer 1

2
$\begingroup$

$A$ is symmetric so you don't have to take the transpose of $A$.

A = {{a11, a12, a13},
     {a12, a22, a23},
     {a13, a23, a33}} 2/n;
B = {b1, b2, b3}/n
FullSimplify[Inverse[A.A].A.B]

(* {(a23^2 b1 - a22 a33 b1 + a12 a33 b2 + a13 a22 b3 - a23 (a13 b2 + a12 b3))/
    (2 (a13^2 a22 - 2 a12 a13 a23 + a12^2 a33 + a11 (a23^2 - a22 a33))),

    (a12 a33 b1 + a13^2 b2 - a11 a33 b2 + a11 a23 b3 - a13 (a23 b1 + a12 b3))/
    (2 (a13^2 a22 - 2 a12 a13 a23 + a12^2 a33 + a11 (a23^2 - a22 a33))),

    (a13 a22 b1 - a12 a23 b1 - a12 a13 b2 + a11 a23 b2 + a12^2 b3 - a11 a22 b3)/
    (2 a13^2 a22 - 4 a12 a13 a23 + 2 a11 a23^2 + 2 a12^2 a33 - 2 a11 a22 a33)} *)

A more visually informative approach is the following:

A = 2 {{sxx, sxy, sxz},
       {sxy, syy, syz},
       {sxz, syz, szz}};
B = {bx, by, bz};
FullSimplify[Inverse[Transpose[A].A].Transpose[A].B]

(* {(bz sxz syy - bz sxy syz - by sxz syz + bx syz^2 + by sxy szz - bx syy szz)/
(2 sxz^2 syy - 4 sxy sxz syz + 2 sxx syz^2 + 2 sxy^2 szz - 2 sxx syy szz), 

(-bz sxy sxz + by sxz^2 + bz sxx syz - bx sxz syz - by sxx szz + bx sxy szz)/
(2 (sxz^2 syy - 2 sxy sxz syz + sxy^2 szz + sxx (syz^2 - syy szz))), 

(bz sxy^2 - by sxy sxz - bz sxx syy + bx sxz syy + by sxx syz - bx sxy syz)/
(2 sxz^2 syy - 4 sxy sxz syz + 2 sxx syz^2 + 2 sxy^2 szz - 2 sxx syy szz)} *)

Another approach is to keep the full sums. I don't recommend that as one can see from the output:

Code with full sums

Here's the output:

Output with full sums

$\endgroup$
3
  • $\begingroup$ Yes, but I want to preserve the summations. $\endgroup$
    – Rodrigo
    Commented Oct 3, 2019 at 12:18
  • $\begingroup$ I've edited the answer to include 2 additional approaches. $\endgroup$
    – JimB
    Commented Oct 3, 2019 at 16:26
  • $\begingroup$ Ok... I guess I'll stick to the numerical solution instead xD Thanks anyway. $\endgroup$
    – Rodrigo
    Commented Oct 4, 2019 at 2:28

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.