Derivative of quaternions












2












$begingroup$


I am trying to calculate the Jacobian of a function that has quaternions and 3D points in it. I refer to quaternions as $q$ and 3D points as $p$
$$h_1(q)=A C(q)p $$
$$h_2(q)=q_1otimes q otimes q_2 $$



where $Ain R^{3x3}$ and $C(q)$ is Direction cosine matrix.



I am using the Hamilton form for the quaternions.



I would like to calculate the following Jacobians:
$$H_1 = frac{partial h_1(q)}{partial q} $$
$$H_2 = frac{partial h_2(q)}{partial q} $$



Following Juao Sola's reference eq. 18 what I have is



$$H_1 = A^TC(q)^T[p]_x $$
$$H_2 = [q_1]_L[q_2]_R $$



Where $[q]_R$ and $[q]_L$ are the right and left handed conversion of quaternion to matrix form as defined in Juao Sola's reference eq. 18.



All rotations are body centric.



Is this correct?
Is there a better way to do this?
Can the expression be easily simplified?










share|cite|improve this question











$endgroup$












  • $begingroup$
    I apologize for being so blunt, but your post is a major catastrophy because of your mistyping of the indices. In the first set of formulae, the second line should have $h_2$, not $h_1$. In the third set, in $H_1$ there should be $q$ instead of $q_1$, simply because there is no $q_1$ in $h_1$. Finally, in the same set, here should be a $q_2$ in $H_2$.
    $endgroup$
    – Alex M.
    Jul 27 '16 at 12:56










  • $begingroup$
    I edited my question and corrected the mistakes. Thanks for pointing out the errors
    $endgroup$
    – Yonatan Simson
    Jul 27 '16 at 16:18
















2












$begingroup$


I am trying to calculate the Jacobian of a function that has quaternions and 3D points in it. I refer to quaternions as $q$ and 3D points as $p$
$$h_1(q)=A C(q)p $$
$$h_2(q)=q_1otimes q otimes q_2 $$



where $Ain R^{3x3}$ and $C(q)$ is Direction cosine matrix.



I am using the Hamilton form for the quaternions.



I would like to calculate the following Jacobians:
$$H_1 = frac{partial h_1(q)}{partial q} $$
$$H_2 = frac{partial h_2(q)}{partial q} $$



Following Juao Sola's reference eq. 18 what I have is



$$H_1 = A^TC(q)^T[p]_x $$
$$H_2 = [q_1]_L[q_2]_R $$



Where $[q]_R$ and $[q]_L$ are the right and left handed conversion of quaternion to matrix form as defined in Juao Sola's reference eq. 18.



All rotations are body centric.



Is this correct?
Is there a better way to do this?
Can the expression be easily simplified?










share|cite|improve this question











$endgroup$












  • $begingroup$
    I apologize for being so blunt, but your post is a major catastrophy because of your mistyping of the indices. In the first set of formulae, the second line should have $h_2$, not $h_1$. In the third set, in $H_1$ there should be $q$ instead of $q_1$, simply because there is no $q_1$ in $h_1$. Finally, in the same set, here should be a $q_2$ in $H_2$.
    $endgroup$
    – Alex M.
    Jul 27 '16 at 12:56










  • $begingroup$
    I edited my question and corrected the mistakes. Thanks for pointing out the errors
    $endgroup$
    – Yonatan Simson
    Jul 27 '16 at 16:18














2












2








2


3



$begingroup$


I am trying to calculate the Jacobian of a function that has quaternions and 3D points in it. I refer to quaternions as $q$ and 3D points as $p$
$$h_1(q)=A C(q)p $$
$$h_2(q)=q_1otimes q otimes q_2 $$



where $Ain R^{3x3}$ and $C(q)$ is Direction cosine matrix.



I am using the Hamilton form for the quaternions.



I would like to calculate the following Jacobians:
$$H_1 = frac{partial h_1(q)}{partial q} $$
$$H_2 = frac{partial h_2(q)}{partial q} $$



Following Juao Sola's reference eq. 18 what I have is



$$H_1 = A^TC(q)^T[p]_x $$
$$H_2 = [q_1]_L[q_2]_R $$



Where $[q]_R$ and $[q]_L$ are the right and left handed conversion of quaternion to matrix form as defined in Juao Sola's reference eq. 18.



All rotations are body centric.



Is this correct?
Is there a better way to do this?
Can the expression be easily simplified?










share|cite|improve this question











$endgroup$




I am trying to calculate the Jacobian of a function that has quaternions and 3D points in it. I refer to quaternions as $q$ and 3D points as $p$
$$h_1(q)=A C(q)p $$
$$h_2(q)=q_1otimes q otimes q_2 $$



where $Ain R^{3x3}$ and $C(q)$ is Direction cosine matrix.



I am using the Hamilton form for the quaternions.



I would like to calculate the following Jacobians:
$$H_1 = frac{partial h_1(q)}{partial q} $$
$$H_2 = frac{partial h_2(q)}{partial q} $$



Following Juao Sola's reference eq. 18 what I have is



$$H_1 = A^TC(q)^T[p]_x $$
$$H_2 = [q_1]_L[q_2]_R $$



Where $[q]_R$ and $[q]_L$ are the right and left handed conversion of quaternion to matrix form as defined in Juao Sola's reference eq. 18.



All rotations are body centric.



Is this correct?
Is there a better way to do this?
Can the expression be easily simplified?







derivatives quaternions






share|cite|improve this question















share|cite|improve this question













share|cite|improve this question




share|cite|improve this question








edited Aug 1 '16 at 14:11







Yonatan Simson

















asked Jul 25 '16 at 7:42









Yonatan SimsonYonatan Simson

168




168












  • $begingroup$
    I apologize for being so blunt, but your post is a major catastrophy because of your mistyping of the indices. In the first set of formulae, the second line should have $h_2$, not $h_1$. In the third set, in $H_1$ there should be $q$ instead of $q_1$, simply because there is no $q_1$ in $h_1$. Finally, in the same set, here should be a $q_2$ in $H_2$.
    $endgroup$
    – Alex M.
    Jul 27 '16 at 12:56










  • $begingroup$
    I edited my question and corrected the mistakes. Thanks for pointing out the errors
    $endgroup$
    – Yonatan Simson
    Jul 27 '16 at 16:18


















  • $begingroup$
    I apologize for being so blunt, but your post is a major catastrophy because of your mistyping of the indices. In the first set of formulae, the second line should have $h_2$, not $h_1$. In the third set, in $H_1$ there should be $q$ instead of $q_1$, simply because there is no $q_1$ in $h_1$. Finally, in the same set, here should be a $q_2$ in $H_2$.
    $endgroup$
    – Alex M.
    Jul 27 '16 at 12:56










  • $begingroup$
    I edited my question and corrected the mistakes. Thanks for pointing out the errors
    $endgroup$
    – Yonatan Simson
    Jul 27 '16 at 16:18
















$begingroup$
I apologize for being so blunt, but your post is a major catastrophy because of your mistyping of the indices. In the first set of formulae, the second line should have $h_2$, not $h_1$. In the third set, in $H_1$ there should be $q$ instead of $q_1$, simply because there is no $q_1$ in $h_1$. Finally, in the same set, here should be a $q_2$ in $H_2$.
$endgroup$
– Alex M.
Jul 27 '16 at 12:56




$begingroup$
I apologize for being so blunt, but your post is a major catastrophy because of your mistyping of the indices. In the first set of formulae, the second line should have $h_2$, not $h_1$. In the third set, in $H_1$ there should be $q$ instead of $q_1$, simply because there is no $q_1$ in $h_1$. Finally, in the same set, here should be a $q_2$ in $H_2$.
$endgroup$
– Alex M.
Jul 27 '16 at 12:56












$begingroup$
I edited my question and corrected the mistakes. Thanks for pointing out the errors
$endgroup$
– Yonatan Simson
Jul 27 '16 at 16:18




$begingroup$
I edited my question and corrected the mistakes. Thanks for pointing out the errors
$endgroup$
– Yonatan Simson
Jul 27 '16 at 16:18










4 Answers
4






active

oldest

votes


















2












$begingroup$

There are different ways to answer your question, but you probably want one of these two:





  1. You want the derivative with respect to the 4 components of the quaternion q=w+ix+iy+iz, that is, with respect to a 4 vector $v_q=(w,x,y,z)^topin R^4$.
    We have the derivative of the rotation wrt this vector q as:
    $$
    frac{partial qotimes p otimes q^*}{partial v_q} = 2[wp+v×p , v^top p I + vp^top−pv^top−w[p]_times] in R^{3times4}
    $$

    where:





    • $I$ is the 3x3 identity matrix.


    • $[p]_times$ is the skew symmetric matrix fromed from $p$.


    • $times$ is the cross product


    • $otimes$ is the quaternion product. This sign can be omitted since it's a product and write simply $qpq^*$.


    So assuming A is a constant matrix, and knowing that $C(q)p = qpq^*$, your derivative is
    $$
    frac{partial (AC(q)p)}{partial v_q} = 2A[wp+v×p , v^top p I + vp^top−pv^top−w[p]_times] in R^{3times4}
    $$

    This is the derivative that e.g. Ceres is going to compute should you use automatic differentiation of your function using #include Jet.h.




  2. You want the derivative with respect to the rotation itself seen as a 3-vector of the Lie algebra of the rotation group. The Lie-theory defines two Jacobians, left and right, for this, depending on whether you perturb the rotation on the right, $tilde R=Rexp([theta]_times)$, or on the left, $tilde R=exp([theta]_times)R$.



    The right Jacobian of the rotation is:
    $$
    frac{partial C(q)p}{partial C} = -C(q)[p]_times in R^{3times 3}
    $$

    and so your full Jacobian is
    $$
    frac{partial (AC(q)p)}{partial C} = -AC(q)[p]_times in R^{3times 3}
    $$



  3. The left Jacobian of the rotation is
    $$
    frac{partial C(q)p}{partial C} = -[C(q)p]_times in R^{3times 3}
    $$

    and so your full Jacobian is
    $$
    frac{partial (AC(q)p)}{partial C} = -A[C(q)p]_times in R^{3times 3}
    $$







share|cite|improve this answer











$endgroup$





















    5





    +100







    $begingroup$

    Quaternion derivatives are not that straight forward. Usually a direction is required (see here).



    I'm assuming your thought process behind $H_2$ was something like



    $$ h_2 = q_1 otimes q otimes q_2 = q_1 otimes (q otimes q_2) = [q_1]_L (q otimes q_2) = [q_1]_L [q_2]_R q$$
    $$ H_2 = frac{partial h_2}{partial q} = [q_1]_L [q_2]_R $$



    where I assigned L,R indices as in your reference. But that is the opposite indices of what you wrote. This also has other issues which I will get to in a bit.



    For $H_1$, you have the direction cosine matrix as a function of $q$ but you don't appear to have taken the derivative of $C(q)$ at all. So I'm not following the logic there.



    Looking at the definition of the direction cosine matrix in terms of the components of $q$, I feel this is venturing into the territory of abusing quaternions as a container of 4 variables.



    There are a lot of things going on here, so let me try to untangle them a bit and note on them separately.



    Representation of quaternions



    If you wish to use linear algebra, there is already a real valued matrix representation of quaternions. I would suggest just using that representation if you want to clarify the content of some equations.



    Instead, here quaternion are treated as a column vector (eq 7 of your reference), which leads to you then using two additional representations of quaternions to fit them into a linear algebra setting to represent multiplication. This confuses the mathematical content.



    Using the definitions in your reference:



    $$ [a + x i + y j + z k]_L =
    begin{bmatrix}
    a & -x & -y & -z \
    x & a & -z & y \
    y & z & a & -x \
    z & -y & x & a \
    end{bmatrix}$$



    $$ [a + x i + y j + z k]_R =
    begin{bmatrix}
    a & -x & -y & -z \
    x & a & z & -y \
    y & -z & a & x \
    z & y & -x & a \
    end{bmatrix}$$



    That then means:



    $$[zk]_L [yj]_R =
    begin{bmatrix}
    0 & 0 & 0 & -z \
    0 & 0 & -z & 0 \
    0 & z & 0 & 0 \
    z & 0 & 0 & 0
    end{bmatrix}
    begin{bmatrix}
    0 & 0 & -y & 0 \
    0 & 0 & 0 & -y \
    y & 0 & 0 & 0 \
    0 & y & 0 & 0
    end{bmatrix}
    =
    begin{bmatrix}
    0 & -yz & 0 & 0 \
    -yz & 0 & 0 & 0 \
    0 & 0 & 0 & -yz \
    0 & 0 & -yz & 0
    end{bmatrix}
    $$



    Which doesn't fit the form for any of the previous representations of a quaternion.



    Therefore saying $H_2 = [q_1]_R [q_2]_L$, is stating the concept which is used here for a derivative of a quaternion function, can result in something outside of the set of functions of quaternions. Is this what you intended? How do you intend to interpret this object?



    Representing multiple things with the same object



    We can use a real value to represent temperature or distance, but these are distinct things so somehow these 'type labels' ('units') must be carried around to remind us of this.



    Similarly, trying to represent both rotations and positions with quaternions can confuse things if one isn't careful to carry around these 'type labels'. For while it may make some notation closer to how you'd write the calculation in code, these objects (positions and rotations) are not on the same footing and their components transform differently if we change basis.



    Even the underlying choice to represent a rotation with a quaternion (so that one can write $x'=q otimes x otimes q^*$ as done on pg 3 of your reference), doesn't actually relate to the underlying mathematical structures as cleanly as one might imagine. (For example, why do we need to use quaternion multiplication twice? Why is the angle off by a factor of 2? See this classic paper on
    rotations and quaternions)



    functions of quaternions



    Not every "left linear" equation in quaterions
    $$f(q) = a q + b$$
    can be rewritten as a "right linear" equation
    $$f(q) = q c + d$$



    If we consider a linear equation of all combinations of multiplication from each side:
    $$g(q) = a q b + c q + q d + e$$



    Then how should one interpret the derivative of this function? Even for linear equations we are forced to be careful with our expectations.



    Potential "abuse" of quaternions



    Now, it is possible that what you are trying to do has little to do with these complications. Somewhere along the way, ideas from quaternions get used for writing code in engineering, physics, graphics applications, but the equations eventually carry around so much specialized 'type information' that it really begins to feel more like linear algebra notation used merely to succinctly represent what the code is doing. In such cases quaternions eventually become abused as more of a way to carry around 4 parameters than anything else (which is how I'd describe many of the things at quaternions.com). In which case these linear algebra short hands can just be viewed as defining a calculation for a real valued function in four real variables. In which case you can discuss the partial derivatives of this with respect to any of the variables without the issues above.



    So at the end of the day, if you are just using quaternions to calculate some transformation (likely including rotations without being forced to choose a basis for Euler angles), and you'd like to know the partial derivative of some transformation with respect to some parameter, you can always just expand out the transformation. It may not have some nice "quaternion" looking form, but that is just because you were actually just manipulating linear equations and nothing fundamentally "quaternion" in the first place.






    share|cite|improve this answer











    $endgroup$













    • $begingroup$
      You are right about the error in [q_1]_L[q_2]_R.
      $endgroup$
      – Yonatan Simson
      Aug 1 '16 at 14:18



















    0












    $begingroup$

    Eq (163) in your notes has the really amazing equation:



    $$ frac{partial(mathbf{q} otimes mathbf{a} otimes mathbf{qast})}{partial mathbf{q}} =
    frac{partial(mathbf{R} mathbf{a})}{partial mathbf{q}} =
    2 big[
    w mathbf{a} +
    mathbf{v} times mathbf{a} +
    mathbf{v}^top mathbf{a} mathbf{I} +
    mathbf{v}mathbf{a}^top - mathbf{a}mathbf{v}^top - w[mathbf{a}]_times big] $$



    These engineering symbols for quaternions are quite fascinating. I have not digested all the symbols. In math we simply note that $x mapsto q x q^{-1}$ (which might be called $qast$) is a Rotation.






    share|cite|improve this answer









    $endgroup$













    • $begingroup$
      It's worse than that. The reference is stating it equals $$2 big[ w mathbf{a} + mathbf{v} times mathbf{a} big| mathbf{v}^top mathbf{a} mathbf{I} + mathbf{v}mathbf{a}^top - mathbf{a}mathbf{v}^top - w[mathbf{a}]_times big]$$, which in their notation is indicating a quaternion with the "real part" three vector valued, and the "imaginary part" 3x3 matrix valued. This really is just abusing "quaternions" as an object that carries four components. It doesn't actually have anything to do with derivatives of quaterionic functions or quaternion analysis.
      $endgroup$
      – JustThinking
      Aug 3 '16 at 6:19





















    0












    $begingroup$

    I needed to solve an easier problem then what I posted.



    If $mathbf{a}=(0,a_x,a_y,a_z)^T$ and the differential is by
    $bar{mathbf{a}}=(a_x,a_y,a_z)^T$ the answer simply becomes:



    $$ frac{partial(mathbf{q} otimes mathbf{a} otimes mathbf{qast})}{partial bar{mathbf{a}}} =
    frac{partial(mathbf{R} bar{mathbf{a}})}{partial bar{mathbf{a}}} = mathbf{R}$$



    Where $mathbf{R}$ is the rotation matrix derived from $mathbf{q}$






    share|cite|improve this answer









    $endgroup$













      Your Answer





      StackExchange.ifUsing("editor", function () {
      return StackExchange.using("mathjaxEditing", function () {
      StackExchange.MarkdownEditor.creationCallbacks.add(function (editor, postfix) {
      StackExchange.mathjaxEditing.prepareWmdForMathJax(editor, postfix, [["$", "$"], ["\\(","\\)"]]);
      });
      });
      }, "mathjax-editing");

      StackExchange.ready(function() {
      var channelOptions = {
      tags: "".split(" "),
      id: "69"
      };
      initTagRenderer("".split(" "), "".split(" "), channelOptions);

      StackExchange.using("externalEditor", function() {
      // Have to fire editor after snippets, if snippets enabled
      if (StackExchange.settings.snippets.snippetsEnabled) {
      StackExchange.using("snippets", function() {
      createEditor();
      });
      }
      else {
      createEditor();
      }
      });

      function createEditor() {
      StackExchange.prepareEditor({
      heartbeatType: 'answer',
      autoActivateHeartbeat: false,
      convertImagesToLinks: true,
      noModals: true,
      showLowRepImageUploadWarning: true,
      reputationToPostImages: 10,
      bindNavPrevention: true,
      postfix: "",
      imageUploader: {
      brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
      contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
      allowUrls: true
      },
      noCode: true, onDemand: true,
      discardSelector: ".discard-answer"
      ,immediatelyShowMarkdownHelp:true
      });


      }
      });














      draft saved

      draft discarded


















      StackExchange.ready(
      function () {
      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f1870305%2fderivative-of-quaternions%23new-answer', 'question_page');
      }
      );

      Post as a guest















      Required, but never shown

























      4 Answers
      4






      active

      oldest

      votes








      4 Answers
      4






      active

      oldest

      votes









      active

      oldest

      votes






      active

      oldest

      votes









      2












      $begingroup$

      There are different ways to answer your question, but you probably want one of these two:





      1. You want the derivative with respect to the 4 components of the quaternion q=w+ix+iy+iz, that is, with respect to a 4 vector $v_q=(w,x,y,z)^topin R^4$.
        We have the derivative of the rotation wrt this vector q as:
        $$
        frac{partial qotimes p otimes q^*}{partial v_q} = 2[wp+v×p , v^top p I + vp^top−pv^top−w[p]_times] in R^{3times4}
        $$

        where:





        • $I$ is the 3x3 identity matrix.


        • $[p]_times$ is the skew symmetric matrix fromed from $p$.


        • $times$ is the cross product


        • $otimes$ is the quaternion product. This sign can be omitted since it's a product and write simply $qpq^*$.


        So assuming A is a constant matrix, and knowing that $C(q)p = qpq^*$, your derivative is
        $$
        frac{partial (AC(q)p)}{partial v_q} = 2A[wp+v×p , v^top p I + vp^top−pv^top−w[p]_times] in R^{3times4}
        $$

        This is the derivative that e.g. Ceres is going to compute should you use automatic differentiation of your function using #include Jet.h.




      2. You want the derivative with respect to the rotation itself seen as a 3-vector of the Lie algebra of the rotation group. The Lie-theory defines two Jacobians, left and right, for this, depending on whether you perturb the rotation on the right, $tilde R=Rexp([theta]_times)$, or on the left, $tilde R=exp([theta]_times)R$.



        The right Jacobian of the rotation is:
        $$
        frac{partial C(q)p}{partial C} = -C(q)[p]_times in R^{3times 3}
        $$

        and so your full Jacobian is
        $$
        frac{partial (AC(q)p)}{partial C} = -AC(q)[p]_times in R^{3times 3}
        $$



      3. The left Jacobian of the rotation is
        $$
        frac{partial C(q)p}{partial C} = -[C(q)p]_times in R^{3times 3}
        $$

        and so your full Jacobian is
        $$
        frac{partial (AC(q)p)}{partial C} = -A[C(q)p]_times in R^{3times 3}
        $$







      share|cite|improve this answer











      $endgroup$


















        2












        $begingroup$

        There are different ways to answer your question, but you probably want one of these two:





        1. You want the derivative with respect to the 4 components of the quaternion q=w+ix+iy+iz, that is, with respect to a 4 vector $v_q=(w,x,y,z)^topin R^4$.
          We have the derivative of the rotation wrt this vector q as:
          $$
          frac{partial qotimes p otimes q^*}{partial v_q} = 2[wp+v×p , v^top p I + vp^top−pv^top−w[p]_times] in R^{3times4}
          $$

          where:





          • $I$ is the 3x3 identity matrix.


          • $[p]_times$ is the skew symmetric matrix fromed from $p$.


          • $times$ is the cross product


          • $otimes$ is the quaternion product. This sign can be omitted since it's a product and write simply $qpq^*$.


          So assuming A is a constant matrix, and knowing that $C(q)p = qpq^*$, your derivative is
          $$
          frac{partial (AC(q)p)}{partial v_q} = 2A[wp+v×p , v^top p I + vp^top−pv^top−w[p]_times] in R^{3times4}
          $$

          This is the derivative that e.g. Ceres is going to compute should you use automatic differentiation of your function using #include Jet.h.




        2. You want the derivative with respect to the rotation itself seen as a 3-vector of the Lie algebra of the rotation group. The Lie-theory defines two Jacobians, left and right, for this, depending on whether you perturb the rotation on the right, $tilde R=Rexp([theta]_times)$, or on the left, $tilde R=exp([theta]_times)R$.



          The right Jacobian of the rotation is:
          $$
          frac{partial C(q)p}{partial C} = -C(q)[p]_times in R^{3times 3}
          $$

          and so your full Jacobian is
          $$
          frac{partial (AC(q)p)}{partial C} = -AC(q)[p]_times in R^{3times 3}
          $$



        3. The left Jacobian of the rotation is
          $$
          frac{partial C(q)p}{partial C} = -[C(q)p]_times in R^{3times 3}
          $$

          and so your full Jacobian is
          $$
          frac{partial (AC(q)p)}{partial C} = -A[C(q)p]_times in R^{3times 3}
          $$







        share|cite|improve this answer











        $endgroup$
















          2












          2








          2





          $begingroup$

          There are different ways to answer your question, but you probably want one of these two:





          1. You want the derivative with respect to the 4 components of the quaternion q=w+ix+iy+iz, that is, with respect to a 4 vector $v_q=(w,x,y,z)^topin R^4$.
            We have the derivative of the rotation wrt this vector q as:
            $$
            frac{partial qotimes p otimes q^*}{partial v_q} = 2[wp+v×p , v^top p I + vp^top−pv^top−w[p]_times] in R^{3times4}
            $$

            where:





            • $I$ is the 3x3 identity matrix.


            • $[p]_times$ is the skew symmetric matrix fromed from $p$.


            • $times$ is the cross product


            • $otimes$ is the quaternion product. This sign can be omitted since it's a product and write simply $qpq^*$.


            So assuming A is a constant matrix, and knowing that $C(q)p = qpq^*$, your derivative is
            $$
            frac{partial (AC(q)p)}{partial v_q} = 2A[wp+v×p , v^top p I + vp^top−pv^top−w[p]_times] in R^{3times4}
            $$

            This is the derivative that e.g. Ceres is going to compute should you use automatic differentiation of your function using #include Jet.h.




          2. You want the derivative with respect to the rotation itself seen as a 3-vector of the Lie algebra of the rotation group. The Lie-theory defines two Jacobians, left and right, for this, depending on whether you perturb the rotation on the right, $tilde R=Rexp([theta]_times)$, or on the left, $tilde R=exp([theta]_times)R$.



            The right Jacobian of the rotation is:
            $$
            frac{partial C(q)p}{partial C} = -C(q)[p]_times in R^{3times 3}
            $$

            and so your full Jacobian is
            $$
            frac{partial (AC(q)p)}{partial C} = -AC(q)[p]_times in R^{3times 3}
            $$



          3. The left Jacobian of the rotation is
            $$
            frac{partial C(q)p}{partial C} = -[C(q)p]_times in R^{3times 3}
            $$

            and so your full Jacobian is
            $$
            frac{partial (AC(q)p)}{partial C} = -A[C(q)p]_times in R^{3times 3}
            $$







          share|cite|improve this answer











          $endgroup$



          There are different ways to answer your question, but you probably want one of these two:





          1. You want the derivative with respect to the 4 components of the quaternion q=w+ix+iy+iz, that is, with respect to a 4 vector $v_q=(w,x,y,z)^topin R^4$.
            We have the derivative of the rotation wrt this vector q as:
            $$
            frac{partial qotimes p otimes q^*}{partial v_q} = 2[wp+v×p , v^top p I + vp^top−pv^top−w[p]_times] in R^{3times4}
            $$

            where:





            • $I$ is the 3x3 identity matrix.


            • $[p]_times$ is the skew symmetric matrix fromed from $p$.


            • $times$ is the cross product


            • $otimes$ is the quaternion product. This sign can be omitted since it's a product and write simply $qpq^*$.


            So assuming A is a constant matrix, and knowing that $C(q)p = qpq^*$, your derivative is
            $$
            frac{partial (AC(q)p)}{partial v_q} = 2A[wp+v×p , v^top p I + vp^top−pv^top−w[p]_times] in R^{3times4}
            $$

            This is the derivative that e.g. Ceres is going to compute should you use automatic differentiation of your function using #include Jet.h.




          2. You want the derivative with respect to the rotation itself seen as a 3-vector of the Lie algebra of the rotation group. The Lie-theory defines two Jacobians, left and right, for this, depending on whether you perturb the rotation on the right, $tilde R=Rexp([theta]_times)$, or on the left, $tilde R=exp([theta]_times)R$.



            The right Jacobian of the rotation is:
            $$
            frac{partial C(q)p}{partial C} = -C(q)[p]_times in R^{3times 3}
            $$

            and so your full Jacobian is
            $$
            frac{partial (AC(q)p)}{partial C} = -AC(q)[p]_times in R^{3times 3}
            $$



          3. The left Jacobian of the rotation is
            $$
            frac{partial C(q)p}{partial C} = -[C(q)p]_times in R^{3times 3}
            $$

            and so your full Jacobian is
            $$
            frac{partial (AC(q)p)}{partial C} = -A[C(q)p]_times in R^{3times 3}
            $$








          share|cite|improve this answer














          share|cite|improve this answer



          share|cite|improve this answer








          edited Jan 9 at 22:54

























          answered Dec 28 '18 at 23:09









          Joan SolàJoan Solà

          1215




          1215























              5





              +100







              $begingroup$

              Quaternion derivatives are not that straight forward. Usually a direction is required (see here).



              I'm assuming your thought process behind $H_2$ was something like



              $$ h_2 = q_1 otimes q otimes q_2 = q_1 otimes (q otimes q_2) = [q_1]_L (q otimes q_2) = [q_1]_L [q_2]_R q$$
              $$ H_2 = frac{partial h_2}{partial q} = [q_1]_L [q_2]_R $$



              where I assigned L,R indices as in your reference. But that is the opposite indices of what you wrote. This also has other issues which I will get to in a bit.



              For $H_1$, you have the direction cosine matrix as a function of $q$ but you don't appear to have taken the derivative of $C(q)$ at all. So I'm not following the logic there.



              Looking at the definition of the direction cosine matrix in terms of the components of $q$, I feel this is venturing into the territory of abusing quaternions as a container of 4 variables.



              There are a lot of things going on here, so let me try to untangle them a bit and note on them separately.



              Representation of quaternions



              If you wish to use linear algebra, there is already a real valued matrix representation of quaternions. I would suggest just using that representation if you want to clarify the content of some equations.



              Instead, here quaternion are treated as a column vector (eq 7 of your reference), which leads to you then using two additional representations of quaternions to fit them into a linear algebra setting to represent multiplication. This confuses the mathematical content.



              Using the definitions in your reference:



              $$ [a + x i + y j + z k]_L =
              begin{bmatrix}
              a & -x & -y & -z \
              x & a & -z & y \
              y & z & a & -x \
              z & -y & x & a \
              end{bmatrix}$$



              $$ [a + x i + y j + z k]_R =
              begin{bmatrix}
              a & -x & -y & -z \
              x & a & z & -y \
              y & -z & a & x \
              z & y & -x & a \
              end{bmatrix}$$



              That then means:



              $$[zk]_L [yj]_R =
              begin{bmatrix}
              0 & 0 & 0 & -z \
              0 & 0 & -z & 0 \
              0 & z & 0 & 0 \
              z & 0 & 0 & 0
              end{bmatrix}
              begin{bmatrix}
              0 & 0 & -y & 0 \
              0 & 0 & 0 & -y \
              y & 0 & 0 & 0 \
              0 & y & 0 & 0
              end{bmatrix}
              =
              begin{bmatrix}
              0 & -yz & 0 & 0 \
              -yz & 0 & 0 & 0 \
              0 & 0 & 0 & -yz \
              0 & 0 & -yz & 0
              end{bmatrix}
              $$



              Which doesn't fit the form for any of the previous representations of a quaternion.



              Therefore saying $H_2 = [q_1]_R [q_2]_L$, is stating the concept which is used here for a derivative of a quaternion function, can result in something outside of the set of functions of quaternions. Is this what you intended? How do you intend to interpret this object?



              Representing multiple things with the same object



              We can use a real value to represent temperature or distance, but these are distinct things so somehow these 'type labels' ('units') must be carried around to remind us of this.



              Similarly, trying to represent both rotations and positions with quaternions can confuse things if one isn't careful to carry around these 'type labels'. For while it may make some notation closer to how you'd write the calculation in code, these objects (positions and rotations) are not on the same footing and their components transform differently if we change basis.



              Even the underlying choice to represent a rotation with a quaternion (so that one can write $x'=q otimes x otimes q^*$ as done on pg 3 of your reference), doesn't actually relate to the underlying mathematical structures as cleanly as one might imagine. (For example, why do we need to use quaternion multiplication twice? Why is the angle off by a factor of 2? See this classic paper on
              rotations and quaternions)



              functions of quaternions



              Not every "left linear" equation in quaterions
              $$f(q) = a q + b$$
              can be rewritten as a "right linear" equation
              $$f(q) = q c + d$$



              If we consider a linear equation of all combinations of multiplication from each side:
              $$g(q) = a q b + c q + q d + e$$



              Then how should one interpret the derivative of this function? Even for linear equations we are forced to be careful with our expectations.



              Potential "abuse" of quaternions



              Now, it is possible that what you are trying to do has little to do with these complications. Somewhere along the way, ideas from quaternions get used for writing code in engineering, physics, graphics applications, but the equations eventually carry around so much specialized 'type information' that it really begins to feel more like linear algebra notation used merely to succinctly represent what the code is doing. In such cases quaternions eventually become abused as more of a way to carry around 4 parameters than anything else (which is how I'd describe many of the things at quaternions.com). In which case these linear algebra short hands can just be viewed as defining a calculation for a real valued function in four real variables. In which case you can discuss the partial derivatives of this with respect to any of the variables without the issues above.



              So at the end of the day, if you are just using quaternions to calculate some transformation (likely including rotations without being forced to choose a basis for Euler angles), and you'd like to know the partial derivative of some transformation with respect to some parameter, you can always just expand out the transformation. It may not have some nice "quaternion" looking form, but that is just because you were actually just manipulating linear equations and nothing fundamentally "quaternion" in the first place.






              share|cite|improve this answer











              $endgroup$













              • $begingroup$
                You are right about the error in [q_1]_L[q_2]_R.
                $endgroup$
                – Yonatan Simson
                Aug 1 '16 at 14:18
















              5





              +100







              $begingroup$

              Quaternion derivatives are not that straight forward. Usually a direction is required (see here).



              I'm assuming your thought process behind $H_2$ was something like



              $$ h_2 = q_1 otimes q otimes q_2 = q_1 otimes (q otimes q_2) = [q_1]_L (q otimes q_2) = [q_1]_L [q_2]_R q$$
              $$ H_2 = frac{partial h_2}{partial q} = [q_1]_L [q_2]_R $$



              where I assigned L,R indices as in your reference. But that is the opposite indices of what you wrote. This also has other issues which I will get to in a bit.



              For $H_1$, you have the direction cosine matrix as a function of $q$ but you don't appear to have taken the derivative of $C(q)$ at all. So I'm not following the logic there.



              Looking at the definition of the direction cosine matrix in terms of the components of $q$, I feel this is venturing into the territory of abusing quaternions as a container of 4 variables.



              There are a lot of things going on here, so let me try to untangle them a bit and note on them separately.



              Representation of quaternions



              If you wish to use linear algebra, there is already a real valued matrix representation of quaternions. I would suggest just using that representation if you want to clarify the content of some equations.



              Instead, here quaternion are treated as a column vector (eq 7 of your reference), which leads to you then using two additional representations of quaternions to fit them into a linear algebra setting to represent multiplication. This confuses the mathematical content.



              Using the definitions in your reference:



              $$ [a + x i + y j + z k]_L =
              begin{bmatrix}
              a & -x & -y & -z \
              x & a & -z & y \
              y & z & a & -x \
              z & -y & x & a \
              end{bmatrix}$$



              $$ [a + x i + y j + z k]_R =
              begin{bmatrix}
              a & -x & -y & -z \
              x & a & z & -y \
              y & -z & a & x \
              z & y & -x & a \
              end{bmatrix}$$



              That then means:



              $$[zk]_L [yj]_R =
              begin{bmatrix}
              0 & 0 & 0 & -z \
              0 & 0 & -z & 0 \
              0 & z & 0 & 0 \
              z & 0 & 0 & 0
              end{bmatrix}
              begin{bmatrix}
              0 & 0 & -y & 0 \
              0 & 0 & 0 & -y \
              y & 0 & 0 & 0 \
              0 & y & 0 & 0
              end{bmatrix}
              =
              begin{bmatrix}
              0 & -yz & 0 & 0 \
              -yz & 0 & 0 & 0 \
              0 & 0 & 0 & -yz \
              0 & 0 & -yz & 0
              end{bmatrix}
              $$



              Which doesn't fit the form for any of the previous representations of a quaternion.



              Therefore saying $H_2 = [q_1]_R [q_2]_L$, is stating the concept which is used here for a derivative of a quaternion function, can result in something outside of the set of functions of quaternions. Is this what you intended? How do you intend to interpret this object?



              Representing multiple things with the same object



              We can use a real value to represent temperature or distance, but these are distinct things so somehow these 'type labels' ('units') must be carried around to remind us of this.



              Similarly, trying to represent both rotations and positions with quaternions can confuse things if one isn't careful to carry around these 'type labels'. For while it may make some notation closer to how you'd write the calculation in code, these objects (positions and rotations) are not on the same footing and their components transform differently if we change basis.



              Even the underlying choice to represent a rotation with a quaternion (so that one can write $x'=q otimes x otimes q^*$ as done on pg 3 of your reference), doesn't actually relate to the underlying mathematical structures as cleanly as one might imagine. (For example, why do we need to use quaternion multiplication twice? Why is the angle off by a factor of 2? See this classic paper on
              rotations and quaternions)



              functions of quaternions



              Not every "left linear" equation in quaterions
              $$f(q) = a q + b$$
              can be rewritten as a "right linear" equation
              $$f(q) = q c + d$$



              If we consider a linear equation of all combinations of multiplication from each side:
              $$g(q) = a q b + c q + q d + e$$



              Then how should one interpret the derivative of this function? Even for linear equations we are forced to be careful with our expectations.



              Potential "abuse" of quaternions



              Now, it is possible that what you are trying to do has little to do with these complications. Somewhere along the way, ideas from quaternions get used for writing code in engineering, physics, graphics applications, but the equations eventually carry around so much specialized 'type information' that it really begins to feel more like linear algebra notation used merely to succinctly represent what the code is doing. In such cases quaternions eventually become abused as more of a way to carry around 4 parameters than anything else (which is how I'd describe many of the things at quaternions.com). In which case these linear algebra short hands can just be viewed as defining a calculation for a real valued function in four real variables. In which case you can discuss the partial derivatives of this with respect to any of the variables without the issues above.



              So at the end of the day, if you are just using quaternions to calculate some transformation (likely including rotations without being forced to choose a basis for Euler angles), and you'd like to know the partial derivative of some transformation with respect to some parameter, you can always just expand out the transformation. It may not have some nice "quaternion" looking form, but that is just because you were actually just manipulating linear equations and nothing fundamentally "quaternion" in the first place.






              share|cite|improve this answer











              $endgroup$













              • $begingroup$
                You are right about the error in [q_1]_L[q_2]_R.
                $endgroup$
                – Yonatan Simson
                Aug 1 '16 at 14:18














              5





              +100







              5





              +100



              5




              +100



              $begingroup$

              Quaternion derivatives are not that straight forward. Usually a direction is required (see here).



              I'm assuming your thought process behind $H_2$ was something like



              $$ h_2 = q_1 otimes q otimes q_2 = q_1 otimes (q otimes q_2) = [q_1]_L (q otimes q_2) = [q_1]_L [q_2]_R q$$
              $$ H_2 = frac{partial h_2}{partial q} = [q_1]_L [q_2]_R $$



              where I assigned L,R indices as in your reference. But that is the opposite indices of what you wrote. This also has other issues which I will get to in a bit.



              For $H_1$, you have the direction cosine matrix as a function of $q$ but you don't appear to have taken the derivative of $C(q)$ at all. So I'm not following the logic there.



              Looking at the definition of the direction cosine matrix in terms of the components of $q$, I feel this is venturing into the territory of abusing quaternions as a container of 4 variables.



              There are a lot of things going on here, so let me try to untangle them a bit and note on them separately.



              Representation of quaternions



              If you wish to use linear algebra, there is already a real valued matrix representation of quaternions. I would suggest just using that representation if you want to clarify the content of some equations.



              Instead, here quaternion are treated as a column vector (eq 7 of your reference), which leads to you then using two additional representations of quaternions to fit them into a linear algebra setting to represent multiplication. This confuses the mathematical content.



              Using the definitions in your reference:



              $$ [a + x i + y j + z k]_L =
              begin{bmatrix}
              a & -x & -y & -z \
              x & a & -z & y \
              y & z & a & -x \
              z & -y & x & a \
              end{bmatrix}$$



              $$ [a + x i + y j + z k]_R =
              begin{bmatrix}
              a & -x & -y & -z \
              x & a & z & -y \
              y & -z & a & x \
              z & y & -x & a \
              end{bmatrix}$$



              That then means:



              $$[zk]_L [yj]_R =
              begin{bmatrix}
              0 & 0 & 0 & -z \
              0 & 0 & -z & 0 \
              0 & z & 0 & 0 \
              z & 0 & 0 & 0
              end{bmatrix}
              begin{bmatrix}
              0 & 0 & -y & 0 \
              0 & 0 & 0 & -y \
              y & 0 & 0 & 0 \
              0 & y & 0 & 0
              end{bmatrix}
              =
              begin{bmatrix}
              0 & -yz & 0 & 0 \
              -yz & 0 & 0 & 0 \
              0 & 0 & 0 & -yz \
              0 & 0 & -yz & 0
              end{bmatrix}
              $$



              Which doesn't fit the form for any of the previous representations of a quaternion.



              Therefore saying $H_2 = [q_1]_R [q_2]_L$, is stating the concept which is used here for a derivative of a quaternion function, can result in something outside of the set of functions of quaternions. Is this what you intended? How do you intend to interpret this object?



              Representing multiple things with the same object



              We can use a real value to represent temperature or distance, but these are distinct things so somehow these 'type labels' ('units') must be carried around to remind us of this.



              Similarly, trying to represent both rotations and positions with quaternions can confuse things if one isn't careful to carry around these 'type labels'. For while it may make some notation closer to how you'd write the calculation in code, these objects (positions and rotations) are not on the same footing and their components transform differently if we change basis.



              Even the underlying choice to represent a rotation with a quaternion (so that one can write $x'=q otimes x otimes q^*$ as done on pg 3 of your reference), doesn't actually relate to the underlying mathematical structures as cleanly as one might imagine. (For example, why do we need to use quaternion multiplication twice? Why is the angle off by a factor of 2? See this classic paper on
              rotations and quaternions)



              functions of quaternions



              Not every "left linear" equation in quaterions
              $$f(q) = a q + b$$
              can be rewritten as a "right linear" equation
              $$f(q) = q c + d$$



              If we consider a linear equation of all combinations of multiplication from each side:
              $$g(q) = a q b + c q + q d + e$$



              Then how should one interpret the derivative of this function? Even for linear equations we are forced to be careful with our expectations.



              Potential "abuse" of quaternions



              Now, it is possible that what you are trying to do has little to do with these complications. Somewhere along the way, ideas from quaternions get used for writing code in engineering, physics, graphics applications, but the equations eventually carry around so much specialized 'type information' that it really begins to feel more like linear algebra notation used merely to succinctly represent what the code is doing. In such cases quaternions eventually become abused as more of a way to carry around 4 parameters than anything else (which is how I'd describe many of the things at quaternions.com). In which case these linear algebra short hands can just be viewed as defining a calculation for a real valued function in four real variables. In which case you can discuss the partial derivatives of this with respect to any of the variables without the issues above.



              So at the end of the day, if you are just using quaternions to calculate some transformation (likely including rotations without being forced to choose a basis for Euler angles), and you'd like to know the partial derivative of some transformation with respect to some parameter, you can always just expand out the transformation. It may not have some nice "quaternion" looking form, but that is just because you were actually just manipulating linear equations and nothing fundamentally "quaternion" in the first place.






              share|cite|improve this answer











              $endgroup$



              Quaternion derivatives are not that straight forward. Usually a direction is required (see here).



              I'm assuming your thought process behind $H_2$ was something like



              $$ h_2 = q_1 otimes q otimes q_2 = q_1 otimes (q otimes q_2) = [q_1]_L (q otimes q_2) = [q_1]_L [q_2]_R q$$
              $$ H_2 = frac{partial h_2}{partial q} = [q_1]_L [q_2]_R $$



              where I assigned L,R indices as in your reference. But that is the opposite indices of what you wrote. This also has other issues which I will get to in a bit.



              For $H_1$, you have the direction cosine matrix as a function of $q$ but you don't appear to have taken the derivative of $C(q)$ at all. So I'm not following the logic there.



              Looking at the definition of the direction cosine matrix in terms of the components of $q$, I feel this is venturing into the territory of abusing quaternions as a container of 4 variables.



              There are a lot of things going on here, so let me try to untangle them a bit and note on them separately.



              Representation of quaternions



              If you wish to use linear algebra, there is already a real valued matrix representation of quaternions. I would suggest just using that representation if you want to clarify the content of some equations.



              Instead, here quaternion are treated as a column vector (eq 7 of your reference), which leads to you then using two additional representations of quaternions to fit them into a linear algebra setting to represent multiplication. This confuses the mathematical content.



              Using the definitions in your reference:



              $$ [a + x i + y j + z k]_L =
              begin{bmatrix}
              a & -x & -y & -z \
              x & a & -z & y \
              y & z & a & -x \
              z & -y & x & a \
              end{bmatrix}$$



              $$ [a + x i + y j + z k]_R =
              begin{bmatrix}
              a & -x & -y & -z \
              x & a & z & -y \
              y & -z & a & x \
              z & y & -x & a \
              end{bmatrix}$$



              That then means:



              $$[zk]_L [yj]_R =
              begin{bmatrix}
              0 & 0 & 0 & -z \
              0 & 0 & -z & 0 \
              0 & z & 0 & 0 \
              z & 0 & 0 & 0
              end{bmatrix}
              begin{bmatrix}
              0 & 0 & -y & 0 \
              0 & 0 & 0 & -y \
              y & 0 & 0 & 0 \
              0 & y & 0 & 0
              end{bmatrix}
              =
              begin{bmatrix}
              0 & -yz & 0 & 0 \
              -yz & 0 & 0 & 0 \
              0 & 0 & 0 & -yz \
              0 & 0 & -yz & 0
              end{bmatrix}
              $$



              Which doesn't fit the form for any of the previous representations of a quaternion.



              Therefore saying $H_2 = [q_1]_R [q_2]_L$, is stating the concept which is used here for a derivative of a quaternion function, can result in something outside of the set of functions of quaternions. Is this what you intended? How do you intend to interpret this object?



              Representing multiple things with the same object



              We can use a real value to represent temperature or distance, but these are distinct things so somehow these 'type labels' ('units') must be carried around to remind us of this.



              Similarly, trying to represent both rotations and positions with quaternions can confuse things if one isn't careful to carry around these 'type labels'. For while it may make some notation closer to how you'd write the calculation in code, these objects (positions and rotations) are not on the same footing and their components transform differently if we change basis.



              Even the underlying choice to represent a rotation with a quaternion (so that one can write $x'=q otimes x otimes q^*$ as done on pg 3 of your reference), doesn't actually relate to the underlying mathematical structures as cleanly as one might imagine. (For example, why do we need to use quaternion multiplication twice? Why is the angle off by a factor of 2? See this classic paper on
              rotations and quaternions)



              functions of quaternions



              Not every "left linear" equation in quaterions
              $$f(q) = a q + b$$
              can be rewritten as a "right linear" equation
              $$f(q) = q c + d$$



              If we consider a linear equation of all combinations of multiplication from each side:
              $$g(q) = a q b + c q + q d + e$$



              Then how should one interpret the derivative of this function? Even for linear equations we are forced to be careful with our expectations.



              Potential "abuse" of quaternions



              Now, it is possible that what you are trying to do has little to do with these complications. Somewhere along the way, ideas from quaternions get used for writing code in engineering, physics, graphics applications, but the equations eventually carry around so much specialized 'type information' that it really begins to feel more like linear algebra notation used merely to succinctly represent what the code is doing. In such cases quaternions eventually become abused as more of a way to carry around 4 parameters than anything else (which is how I'd describe many of the things at quaternions.com). In which case these linear algebra short hands can just be viewed as defining a calculation for a real valued function in four real variables. In which case you can discuss the partial derivatives of this with respect to any of the variables without the issues above.



              So at the end of the day, if you are just using quaternions to calculate some transformation (likely including rotations without being forced to choose a basis for Euler angles), and you'd like to know the partial derivative of some transformation with respect to some parameter, you can always just expand out the transformation. It may not have some nice "quaternion" looking form, but that is just because you were actually just manipulating linear equations and nothing fundamentally "quaternion" in the first place.







              share|cite|improve this answer














              share|cite|improve this answer



              share|cite|improve this answer








              edited Jul 31 '16 at 21:48

























              answered Jul 31 '16 at 21:36









              JustThinkingJustThinking

              1708




              1708












              • $begingroup$
                You are right about the error in [q_1]_L[q_2]_R.
                $endgroup$
                – Yonatan Simson
                Aug 1 '16 at 14:18


















              • $begingroup$
                You are right about the error in [q_1]_L[q_2]_R.
                $endgroup$
                – Yonatan Simson
                Aug 1 '16 at 14:18
















              $begingroup$
              You are right about the error in [q_1]_L[q_2]_R.
              $endgroup$
              – Yonatan Simson
              Aug 1 '16 at 14:18




              $begingroup$
              You are right about the error in [q_1]_L[q_2]_R.
              $endgroup$
              – Yonatan Simson
              Aug 1 '16 at 14:18











              0












              $begingroup$

              Eq (163) in your notes has the really amazing equation:



              $$ frac{partial(mathbf{q} otimes mathbf{a} otimes mathbf{qast})}{partial mathbf{q}} =
              frac{partial(mathbf{R} mathbf{a})}{partial mathbf{q}} =
              2 big[
              w mathbf{a} +
              mathbf{v} times mathbf{a} +
              mathbf{v}^top mathbf{a} mathbf{I} +
              mathbf{v}mathbf{a}^top - mathbf{a}mathbf{v}^top - w[mathbf{a}]_times big] $$



              These engineering symbols for quaternions are quite fascinating. I have not digested all the symbols. In math we simply note that $x mapsto q x q^{-1}$ (which might be called $qast$) is a Rotation.






              share|cite|improve this answer









              $endgroup$













              • $begingroup$
                It's worse than that. The reference is stating it equals $$2 big[ w mathbf{a} + mathbf{v} times mathbf{a} big| mathbf{v}^top mathbf{a} mathbf{I} + mathbf{v}mathbf{a}^top - mathbf{a}mathbf{v}^top - w[mathbf{a}]_times big]$$, which in their notation is indicating a quaternion with the "real part" three vector valued, and the "imaginary part" 3x3 matrix valued. This really is just abusing "quaternions" as an object that carries four components. It doesn't actually have anything to do with derivatives of quaterionic functions or quaternion analysis.
                $endgroup$
                – JustThinking
                Aug 3 '16 at 6:19


















              0












              $begingroup$

              Eq (163) in your notes has the really amazing equation:



              $$ frac{partial(mathbf{q} otimes mathbf{a} otimes mathbf{qast})}{partial mathbf{q}} =
              frac{partial(mathbf{R} mathbf{a})}{partial mathbf{q}} =
              2 big[
              w mathbf{a} +
              mathbf{v} times mathbf{a} +
              mathbf{v}^top mathbf{a} mathbf{I} +
              mathbf{v}mathbf{a}^top - mathbf{a}mathbf{v}^top - w[mathbf{a}]_times big] $$



              These engineering symbols for quaternions are quite fascinating. I have not digested all the symbols. In math we simply note that $x mapsto q x q^{-1}$ (which might be called $qast$) is a Rotation.






              share|cite|improve this answer









              $endgroup$













              • $begingroup$
                It's worse than that. The reference is stating it equals $$2 big[ w mathbf{a} + mathbf{v} times mathbf{a} big| mathbf{v}^top mathbf{a} mathbf{I} + mathbf{v}mathbf{a}^top - mathbf{a}mathbf{v}^top - w[mathbf{a}]_times big]$$, which in their notation is indicating a quaternion with the "real part" three vector valued, and the "imaginary part" 3x3 matrix valued. This really is just abusing "quaternions" as an object that carries four components. It doesn't actually have anything to do with derivatives of quaterionic functions or quaternion analysis.
                $endgroup$
                – JustThinking
                Aug 3 '16 at 6:19
















              0












              0








              0





              $begingroup$

              Eq (163) in your notes has the really amazing equation:



              $$ frac{partial(mathbf{q} otimes mathbf{a} otimes mathbf{qast})}{partial mathbf{q}} =
              frac{partial(mathbf{R} mathbf{a})}{partial mathbf{q}} =
              2 big[
              w mathbf{a} +
              mathbf{v} times mathbf{a} +
              mathbf{v}^top mathbf{a} mathbf{I} +
              mathbf{v}mathbf{a}^top - mathbf{a}mathbf{v}^top - w[mathbf{a}]_times big] $$



              These engineering symbols for quaternions are quite fascinating. I have not digested all the symbols. In math we simply note that $x mapsto q x q^{-1}$ (which might be called $qast$) is a Rotation.






              share|cite|improve this answer









              $endgroup$



              Eq (163) in your notes has the really amazing equation:



              $$ frac{partial(mathbf{q} otimes mathbf{a} otimes mathbf{qast})}{partial mathbf{q}} =
              frac{partial(mathbf{R} mathbf{a})}{partial mathbf{q}} =
              2 big[
              w mathbf{a} +
              mathbf{v} times mathbf{a} +
              mathbf{v}^top mathbf{a} mathbf{I} +
              mathbf{v}mathbf{a}^top - mathbf{a}mathbf{v}^top - w[mathbf{a}]_times big] $$



              These engineering symbols for quaternions are quite fascinating. I have not digested all the symbols. In math we simply note that $x mapsto q x q^{-1}$ (which might be called $qast$) is a Rotation.







              share|cite|improve this answer












              share|cite|improve this answer



              share|cite|improve this answer










              answered Aug 3 '16 at 3:34









              cactus314cactus314

              15.4k42269




              15.4k42269












              • $begingroup$
                It's worse than that. The reference is stating it equals $$2 big[ w mathbf{a} + mathbf{v} times mathbf{a} big| mathbf{v}^top mathbf{a} mathbf{I} + mathbf{v}mathbf{a}^top - mathbf{a}mathbf{v}^top - w[mathbf{a}]_times big]$$, which in their notation is indicating a quaternion with the "real part" three vector valued, and the "imaginary part" 3x3 matrix valued. This really is just abusing "quaternions" as an object that carries four components. It doesn't actually have anything to do with derivatives of quaterionic functions or quaternion analysis.
                $endgroup$
                – JustThinking
                Aug 3 '16 at 6:19




















              • $begingroup$
                It's worse than that. The reference is stating it equals $$2 big[ w mathbf{a} + mathbf{v} times mathbf{a} big| mathbf{v}^top mathbf{a} mathbf{I} + mathbf{v}mathbf{a}^top - mathbf{a}mathbf{v}^top - w[mathbf{a}]_times big]$$, which in their notation is indicating a quaternion with the "real part" three vector valued, and the "imaginary part" 3x3 matrix valued. This really is just abusing "quaternions" as an object that carries four components. It doesn't actually have anything to do with derivatives of quaterionic functions or quaternion analysis.
                $endgroup$
                – JustThinking
                Aug 3 '16 at 6:19


















              $begingroup$
              It's worse than that. The reference is stating it equals $$2 big[ w mathbf{a} + mathbf{v} times mathbf{a} big| mathbf{v}^top mathbf{a} mathbf{I} + mathbf{v}mathbf{a}^top - mathbf{a}mathbf{v}^top - w[mathbf{a}]_times big]$$, which in their notation is indicating a quaternion with the "real part" three vector valued, and the "imaginary part" 3x3 matrix valued. This really is just abusing "quaternions" as an object that carries four components. It doesn't actually have anything to do with derivatives of quaterionic functions or quaternion analysis.
              $endgroup$
              – JustThinking
              Aug 3 '16 at 6:19






              $begingroup$
              It's worse than that. The reference is stating it equals $$2 big[ w mathbf{a} + mathbf{v} times mathbf{a} big| mathbf{v}^top mathbf{a} mathbf{I} + mathbf{v}mathbf{a}^top - mathbf{a}mathbf{v}^top - w[mathbf{a}]_times big]$$, which in their notation is indicating a quaternion with the "real part" three vector valued, and the "imaginary part" 3x3 matrix valued. This really is just abusing "quaternions" as an object that carries four components. It doesn't actually have anything to do with derivatives of quaterionic functions or quaternion analysis.
              $endgroup$
              – JustThinking
              Aug 3 '16 at 6:19













              0












              $begingroup$

              I needed to solve an easier problem then what I posted.



              If $mathbf{a}=(0,a_x,a_y,a_z)^T$ and the differential is by
              $bar{mathbf{a}}=(a_x,a_y,a_z)^T$ the answer simply becomes:



              $$ frac{partial(mathbf{q} otimes mathbf{a} otimes mathbf{qast})}{partial bar{mathbf{a}}} =
              frac{partial(mathbf{R} bar{mathbf{a}})}{partial bar{mathbf{a}}} = mathbf{R}$$



              Where $mathbf{R}$ is the rotation matrix derived from $mathbf{q}$






              share|cite|improve this answer









              $endgroup$


















                0












                $begingroup$

                I needed to solve an easier problem then what I posted.



                If $mathbf{a}=(0,a_x,a_y,a_z)^T$ and the differential is by
                $bar{mathbf{a}}=(a_x,a_y,a_z)^T$ the answer simply becomes:



                $$ frac{partial(mathbf{q} otimes mathbf{a} otimes mathbf{qast})}{partial bar{mathbf{a}}} =
                frac{partial(mathbf{R} bar{mathbf{a}})}{partial bar{mathbf{a}}} = mathbf{R}$$



                Where $mathbf{R}$ is the rotation matrix derived from $mathbf{q}$






                share|cite|improve this answer









                $endgroup$
















                  0












                  0








                  0





                  $begingroup$

                  I needed to solve an easier problem then what I posted.



                  If $mathbf{a}=(0,a_x,a_y,a_z)^T$ and the differential is by
                  $bar{mathbf{a}}=(a_x,a_y,a_z)^T$ the answer simply becomes:



                  $$ frac{partial(mathbf{q} otimes mathbf{a} otimes mathbf{qast})}{partial bar{mathbf{a}}} =
                  frac{partial(mathbf{R} bar{mathbf{a}})}{partial bar{mathbf{a}}} = mathbf{R}$$



                  Where $mathbf{R}$ is the rotation matrix derived from $mathbf{q}$






                  share|cite|improve this answer









                  $endgroup$



                  I needed to solve an easier problem then what I posted.



                  If $mathbf{a}=(0,a_x,a_y,a_z)^T$ and the differential is by
                  $bar{mathbf{a}}=(a_x,a_y,a_z)^T$ the answer simply becomes:



                  $$ frac{partial(mathbf{q} otimes mathbf{a} otimes mathbf{qast})}{partial bar{mathbf{a}}} =
                  frac{partial(mathbf{R} bar{mathbf{a}})}{partial bar{mathbf{a}}} = mathbf{R}$$



                  Where $mathbf{R}$ is the rotation matrix derived from $mathbf{q}$







                  share|cite|improve this answer












                  share|cite|improve this answer



                  share|cite|improve this answer










                  answered Nov 23 '17 at 13:15









                  Yonatan SimsonYonatan Simson

                  168




                  168






























                      draft saved

                      draft discarded




















































                      Thanks for contributing an answer to Mathematics Stack Exchange!


                      • Please be sure to answer the question. Provide details and share your research!

                      But avoid



                      • Asking for help, clarification, or responding to other answers.

                      • Making statements based on opinion; back them up with references or personal experience.


                      Use MathJax to format equations. MathJax reference.


                      To learn more, see our tips on writing great answers.




                      draft saved


                      draft discarded














                      StackExchange.ready(
                      function () {
                      StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fmath.stackexchange.com%2fquestions%2f1870305%2fderivative-of-quaternions%23new-answer', 'question_page');
                      }
                      );

                      Post as a guest















                      Required, but never shown





















































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown

































                      Required, but never shown














                      Required, but never shown












                      Required, but never shown







                      Required, but never shown







                      Popular posts from this blog

                      Human spaceflight

                      Can not write log (Is /dev/pts mounted?) - openpty in Ubuntu-on-Windows?

                      張江高科駅