Question on how to efficiently compute a jacobian

  • Thread starter datahead8888
  • Start date
  • Tags
    Jacobian
In summary, the conversation discusses the process of calculating a Jacobian for a vector equation that combines Hooke's Law and a damping factor. The goal is to find an efficient method for solving the Jacobian, which is necessary for implicit methods of integration in a particle system. The conversation also mentions the challenges of finding resources for this task and the need for finding a faster approach to computing the Jacobian.
  • #1
datahead8888
10
0
Hello,

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.
 
Physics news on Phys.org
  • #2
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?
 
  • #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:

Related to Question on how to efficiently compute a jacobian

1. What is a jacobian and why is it important in computing?

A jacobian is a mathematical matrix that represents the partial derivatives of a multivariate function. It is essential in computing because it allows for the calculation of the rate of change of a function with respect to its variables, which is crucial in optimization and numerical analysis.

2. How is the jacobian computed efficiently?

The jacobian can be computed efficiently using a variety of methods, such as forward or backward differentiation, automatic differentiation, or symbolic differentiation. Each method has its advantages and disadvantages, and the most efficient approach will depend on the specific problem being solved.

3. Can the jacobian be computed for any type of function?

Yes, the jacobian can be computed for any type of function, including multivariate functions, vector-valued functions, and even complex functions. However, the complexity of the computation may vary depending on the type of function and the chosen method.

4. How does the jacobian relate to gradient descent and other optimization algorithms?

The jacobian plays a crucial role in optimization algorithms such as gradient descent. It is used to calculate the gradient of a function, which is then used to determine the direction and magnitude of the next step in the optimization process. Therefore, an accurate and efficient computation of the jacobian is essential for the success of these algorithms.

5. Are there any common errors or challenges when computing the jacobian?

Yes, there can be several challenges when computing the jacobian, including numerical instabilities, round-off errors, and the curse of dimensionality. It is important to carefully choose the method and parameters used to compute the jacobian to minimize these errors and ensure accurate results.

Similar threads

Replies
1
Views
1K
  • Special and General Relativity
Replies
8
Views
1K
  • General Math
Replies
11
Views
1K
  • Calculus
Replies
15
Views
2K
Replies
2
Views
1K
Replies
22
Views
1K
Replies
13
Views
1K
Back
Top