pythongeometrysympyanalytical

deriving equations for point clouds in sympy or alternatives


Assume you have a point cloud (stored in R, 3xN dimensional matrix) in a 3D orthogonal coordinate system, and you would like to derive analytical expressions for complicated functions of R (including differentiation, summations, etc.

As a simple example:

A_il(R)=\sum_jk df(R)/dR_ij  df(R)/dR_kl 

Is there any way to do this in sympy (or anything else...) with eg generalizing x,y,z to X={x_i}, Y={y_i}, Z={z_i}?

I would like to obtain general expression with Dirac deltas so that I do not need to handle all options separately. If it is an option I would prefer Einstein notation.

Thanks in anticipation


Solution

  • Responding to your comment here. Maybe this does what you want:

    In [12]: X = IndexedBase('X')                                                                                                                  
    
    In [13]: i, j = symbols('i, j')                                                                                                                
    
    In [14]: X[i].diff(X[j])                                                                                                                       
    Out[14]: 
    δ   
     i,j