Dismiss Notice
Join Physics Forums Today!
The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

Question on how to efficiently compute a jacobian

  1. Feb 20, 2013 #1

    I was starting with an equation using hooke's law and with a damping factor appended to it. The equation is to calculate the x,y, and z components of the resulting force, as a vector. The hooke's law portion uses the current position in calculating the force (x, y, and z position components), and the damping part uses the velocity (additional x, y, and z components) in calculating the force.

    F(X,V) = -ks(magnitude(X) - r) * (X / magnitude(x)) - b * V
    --Here X is the 3 element position vector
    --Here V is the 3 element velocity vector
    --Here r is the rest length (a constant)
    --Here b is a damping constant
    --Here magnitude(X) = sqrt(x * x + y * y + z * z)
    --Note that magnitude is NOT a constant and must be part of the derivative computation.

    I was trying to compute the jacobian matrix resutling from taking the derivative of the force with respect to the position (I am ignoring velocity in this first step).

    Thus I will have a 3 X 3 resulting matrix of partial derivatives, where each Force x/y/z component corresponds to a row in the matrix and where each position x/y/z component corresponds to a column in the matrix.

    I'm sure there are several resources on the web that give the solution for this and several tutorials that walk through it, but I need to learn to do this without being given the exact answer.

    Obviously, it gets tricky above because of the magnitude - you would need the quotient, product, and chain rules from calculus.

    I was trying to use these derivative rules to calculate each element of the 9X9 matrix for the derivative of force with respect to position, one by one. However, each calculation was taking about 2 pages (I was substituting findings), and there would be 18 total pages.

    I think there are ways to apply derivative rules to vectors directly and better techniques to find Jacobian matrices than what I'm doing. Does anyone know of some good resources that explain this? Most of the derivative rule resources I've found only talk about derivatives for 1-D functions or partial derivatives that are not applied to vectors, and the resources about Jacobians usually talk about the forms easily found in wikipedia without providing much insight into an efficient method for solving them. I may just have looked in the wrong places.

    The goal of this exercise is to provide insight into implicit methods for integration that can be applied to a particle system implemented in C++ (the above example is for one particle). These methods require finding Jacobians.
  2. jcsd
  3. Feb 20, 2013 #2


    User Avatar
    Science Advisor

    Hey datahead8888.

    I'm not quite sure what you are getting at: Are you just trying to calculate a Jacobian for a specific transformation or are you trying to do something else?
  4. Feb 21, 2013 #3
    I'm trying to calculate a Jacobian for the vector equation I posted.

    I looked again at it, and I don't see any other way to do it other than to compute all 9 row / column entries individually. Although each column in the Jacobian corresponds to force-x, force-y, and force-z all-together, you can't "just" do derivatives on a vector because each different column is with respect to a different position dimension (x,y, or z).

    Maybe if I create variables on paper to represent redundant computations it will cut down on the work some.

    I imagine there is some trick to do this much faster, but it's certainly not something I'll find on my own now.
    Last edited: Feb 21, 2013
Know someone interested in this topic? Share this thread via Reddit, Google+, Twitter, or Facebook

Similar Threads - Question efficiently compute Date
B Function rules question Saturday at 9:49 AM
B Question about a limit definition Feb 27, 2018
A Angular Moment Operator Vector Identity Question Feb 10, 2018
I A question regarding Logistic population model Feb 1, 2018
How to calculate efficiency of Newton's Method Feb 18, 2015