```python
from IPython.core.interactiveshell import InteractiveShell
InteractiveShell.ast_node_interactivity = "all"
```


```python
from sympy import Symbol, symbols, Eq, Function #, init_printing; init_printing()
R, Z, Phi = symbols("R, Z, \phi", real=True)
x0_R, x0_Z = symbols("x_{0R}, x_{0Z}", real=True)
X_R, X_Z = [Function(latexstr, real=True)(x0_R, x0_Z, Phi) for latexstr in ["X_R", "X_Z"] ]
X_Phi = Symbol("X_{\phi}", real=True)
XRdot = Function("\dot{X}_{R}", real=True)(X_R, X_Z, X_Phi)
# XRdot, XZdot = symbols("$X_R$, dot{X_Z}", cls=Function)
```


```python
XRdot
```




$\displaystyle \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$




```python
from sympy import Array
from sympy.core.numbers import Integer
from sympy.core.function import Derivative
from sympy.core.power import Pow
ndiff_R, ndiff_Z = 3, 1
result = XRdot.diff(x0_R, ndiff_R, x0_Z, ndiff_Z)

import numpy as np
import pandas as pd
ndiff = ndiff_R + ndiff_Z
XRZ_index = ['C']
for idiff in range(1, ndiff+1):
    for idiff_R in range(idiff+1):
        idiff_Z = idiff - idiff_R
        XRZ_index.append('XR['+str(idiff_R)+','+str(idiff_Z)+']')
        XRZ_index.append('XZ['+str(idiff_R)+','+str(idiff_Z)+']')


# for R_diff_order in range(ndiff_R+ndiff_Z, -1, -1):
#     for Z_diff_order in range(ndiff_R+ndiff_Z -R_diff_order, -1, -1 ):
#         if R_diff_order >= 2:
#             R_partdiff_substr = "\partial_{R}^{"+f"{R_diff_order}"+"}"
#         elif R_diff_order == 1:
#             R_partdiff_substr = "\partial_{R}"
#         elif R_diff_order == 0:
#             R_partdiff_substr = ""
            
#         if Z_diff_order >= 2:
#             Z_partdiff_substr = "\partial_{Z}^{"+f"{Z_diff_order}"+"}"
#         elif Z_diff_order == 1:
#             Z_partdiff_substr = "\partial_{Z}"
#         elif Z_diff_order == 0:
#             Z_partdiff_substr = ""
            
#         result = result.subs(
#             XRdot.diff(X_R, R_diff_order, X_Z, Z_diff_order), 
#             Symbol(R_partdiff_substr + Z_partdiff_substr + " \dot{X}_{R}", real=True))

# for x0_R_diff_order in range(ndiff_R, -1, -1):
#     for x0_Z_diff_order in range(ndiff_Z, -1, -1):
#         if x0_R_diff_order >= 2:
#             x0_R_partdiff_substr = "\partial_{x_{0R}}^{"+f"{x0_R_diff_order}"+"}"
#         elif x0_R_diff_order == 1:
#             x0_R_partdiff_substr = "\partial_{x_{0R}}"
#         elif x0_R_diff_order == 0:
#             x0_R_partdiff_substr = ""
            
#         if x0_Z_diff_order >= 2:
#             x0_Z_partdiff_substr = "\partial_{x_{0Z}}^{"+f"{x0_Z_diff_order}"+"}"
#         elif x0_Z_diff_order == 1:
#             x0_Z_partdiff_substr = "\partial_{x_{0Z}}"
#         elif x0_Z_diff_order == 0:
#             x0_Z_partdiff_substr = ""
            
#         result = result.subs(
#             X_R.diff(x0_R, x0_R_diff_order, x0_Z, x0_Z_diff_order),
#             Symbol(x0_R_partdiff_substr+x0_Z_partdiff_substr+" X_{R}",real=True) )
    
#         result = result.subs(
#             X_Z.diff(x0_R, x0_R_diff_order, x0_Z, x0_Z_diff_order),
#             Symbol(x0_R_partdiff_substr+x0_Z_partdiff_substr+" X_{Z}",real=True) )

print("We show them term-by-term as the following:")
factored_result = result.factor()
how_many_terms_in_result = len(factored_result.args)
XRZ_df = pd.DataFrame(np.zeros( (len(XRZ_index),how_many_terms_in_result ), dtype=int), index= XRZ_index)
for i, term in enumerate(factored_result.args):
    term
    for factor in term.args:
        if factor.func is Integer:
            combinatorial_coeff = factor # Combinatorial number
            XRZ_df.at['C', i] = combinatorial_coeff
            continue
        
        if factor.func is Pow:
            factor_inside_power = factor.args[0]
            factor_power = factor.args[1]
        else:
            factor_inside_power = factor
            factor_power = 1
        
        assert(factor_inside_power.func is Derivative)
        if factor_inside_power.args[0] == XRdot:
            continue
        
        if factor_inside_power.args[0] == X_R:
            XR_or_XZ = 'XR'
        elif factor_inside_power.args[0] == X_Z:
            XR_or_XZ = 'XZ'
        
        x0_R_diff_n = 0
        x0_Z_diff_n = 0
        for xdiff in factor_inside_power.args[1:]:
            if xdiff[0] == x0_R:
                x0_R_diff_n = xdiff[1]
            elif xdiff[0] == x0_Z:
                x0_Z_diff_n = xdiff[1]
        
        XRZ_df.at[XR_or_XZ+'['+str(x0_R_diff_n)+','+str(x0_Z_diff_n)+']', i] = factor_power
    if XRZ_df.at['C', i] == 0:
        XRZ_df.at['C', i] = 1

pd.set_option('display.max_rows', None)
pd.set_option('display.max_columns', None)
pd.set_option('display.width', None)
pd.set_option('display.max_colwidth', None)
# df.head()

XRZ_df
```

    We show them term-by-term as the following:





$\displaystyle \frac{\partial}{\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)} \frac{\partial^{4}}{\partial x_{0Z}\partial x_{0R}^{3}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}$






$\displaystyle \frac{\partial}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)} \frac{\partial^{4}}{\partial x_{0Z}\partial x_{0R}^{3}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}$






$\displaystyle \left(\frac{\partial}{\partial x_{0R}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}\right)^{3} \frac{\partial}{\partial x_{0Z}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{4}}{\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}^{4}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle \left(\frac{\partial}{\partial x_{0R}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}\right)^{3} \frac{\partial}{\partial x_{0Z}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{4}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}^{3}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle \frac{\partial}{\partial x_{0Z}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \left(\frac{\partial}{\partial x_{0R}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}\right)^{3} \frac{\partial^{4}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}^{3}\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle \left(\frac{\partial}{\partial x_{0R}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}\right)^{3} \frac{\partial}{\partial x_{0Z}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{4}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}^{4}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle \frac{\partial^{3}}{\partial x_{0R}^{3}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial}{\partial x_{0Z}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}^{2}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle \frac{\partial^{3}}{\partial x_{0R}^{3}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial}{\partial x_{0Z}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle \frac{\partial}{\partial x_{0Z}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{3}}{\partial x_{0R}^{3}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle \frac{\partial^{3}}{\partial x_{0R}^{3}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial}{\partial x_{0Z}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}^{2}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle 3 \left(\frac{\partial}{\partial x_{0R}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}\right)^{2} \frac{\partial^{3}}{\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}^{3}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)} \frac{\partial^{2}}{\partial x_{0Z}\partial x_{0R}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}$






$\displaystyle 3 \left(\frac{\partial}{\partial x_{0R}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}\right)^{2} \frac{\partial^{2}}{\partial x_{0Z}\partial x_{0R}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{3}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}^{2}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle 3 \left(\frac{\partial}{\partial x_{0R}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}\right)^{2} \frac{\partial^{3}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}^{3}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)} \frac{\partial^{2}}{\partial x_{0Z}\partial x_{0R}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}$






$\displaystyle 3 \left(\frac{\partial}{\partial x_{0R}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}\right)^{2} \frac{\partial^{2}}{\partial x_{0Z}\partial x_{0R}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{3}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}^{2}\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle 3 \frac{\partial}{\partial x_{0R}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}^{2}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)} \frac{\partial^{3}}{\partial x_{0Z}\partial x_{0R}^{2}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}$






$\displaystyle 3 \frac{\partial}{\partial x_{0R}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{3}}{\partial x_{0Z}\partial x_{0R}^{2}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle 3 \frac{\partial^{2}}{\partial x_{0R}^{2}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}^{2}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)} \frac{\partial^{2}}{\partial x_{0Z}\partial x_{0R}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}$






$\displaystyle 3 \frac{\partial^{2}}{\partial x_{0R}^{2}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial x_{0Z}\partial x_{0R}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle 3 \frac{\partial}{\partial x_{0R}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}^{2}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)} \frac{\partial^{3}}{\partial x_{0Z}\partial x_{0R}^{2}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}$






$\displaystyle 3 \frac{\partial}{\partial x_{0R}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{3}}{\partial x_{0Z}\partial x_{0R}^{2}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle 3 \frac{\partial^{2}}{\partial x_{0R}^{2}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}^{2}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)} \frac{\partial^{2}}{\partial x_{0Z}\partial x_{0R}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}$






$\displaystyle 3 \frac{\partial^{2}}{\partial x_{0R}^{2}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial x_{0Z}\partial x_{0R}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle 3 \left(\frac{\partial}{\partial x_{0R}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}\right)^{2} \frac{\partial}{\partial x_{0Z}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial}{\partial x_{0R}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{4}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}^{3}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle 3 \left(\frac{\partial}{\partial x_{0R}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}\right)^{2} \frac{\partial}{\partial x_{0R}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial}{\partial x_{0Z}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{4}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}^{2}\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}^{2}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle 3 \frac{\partial}{\partial x_{0R}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial}{\partial x_{0Z}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \left(\frac{\partial}{\partial x_{0R}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}\right)^{2} \frac{\partial^{4}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}^{2}\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}^{2}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle 3 \frac{\partial}{\partial x_{0R}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \left(\frac{\partial}{\partial x_{0R}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}\right)^{2} \frac{\partial}{\partial x_{0Z}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{4}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}^{3}\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle 3 \frac{\partial}{\partial x_{0R}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial x_{0R}^{2}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial}{\partial x_{0Z}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{3}}{\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}^{3}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle 3 \frac{\partial}{\partial x_{0R}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial x_{0R}^{2}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial}{\partial x_{0Z}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{3}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}^{2}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle 3 \frac{\partial}{\partial x_{0R}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial}{\partial x_{0Z}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial x_{0R}^{2}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{3}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}^{2}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle 3 \frac{\partial}{\partial x_{0R}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial x_{0R}^{2}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial}{\partial x_{0Z}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{3}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}^{2}\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle 3 \frac{\partial^{2}}{\partial x_{0R}^{2}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial}{\partial x_{0Z}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial}{\partial x_{0R}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{3}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}^{2}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle 3 \frac{\partial^{2}}{\partial x_{0R}^{2}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial}{\partial x_{0R}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial}{\partial x_{0Z}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{3}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}^{2}\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle 3 \frac{\partial}{\partial x_{0Z}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial}{\partial x_{0R}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial x_{0R}^{2}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{3}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}^{2}\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle 3 \frac{\partial}{\partial x_{0R}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial x_{0R}^{2}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial}{\partial x_{0Z}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{3}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}^{3}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle 6 \frac{\partial}{\partial x_{0R}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial}{\partial x_{0R}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial x_{0Z}\partial x_{0R}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{3}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}^{2}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle 6 \frac{\partial}{\partial x_{0R}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial}{\partial x_{0R}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial x_{0Z}\partial x_{0R}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{3}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}^{2}\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






<div>
<style scoped>
    .dataframe tbody tr th:only-of-type {
        vertical-align: middle;
    }

    .dataframe tbody tr th {
        vertical-align: top;
    }

    .dataframe thead th {
        text-align: right;
    }
</style>
<table border="1" class="dataframe">
  <thead>
    <tr style="text-align: right;">
      <th></th>
      <th>0</th>
      <th>1</th>
      <th>2</th>
      <th>3</th>
      <th>4</th>
      <th>5</th>
      <th>6</th>
      <th>7</th>
      <th>8</th>
      <th>9</th>
      <th>10</th>
      <th>11</th>
      <th>12</th>
      <th>13</th>
      <th>14</th>
      <th>15</th>
      <th>16</th>
      <th>17</th>
      <th>18</th>
      <th>19</th>
      <th>20</th>
      <th>21</th>
      <th>22</th>
      <th>23</th>
      <th>24</th>
      <th>25</th>
      <th>26</th>
      <th>27</th>
      <th>28</th>
      <th>29</th>
      <th>30</th>
      <th>31</th>
      <th>32</th>
      <th>33</th>
      <th>34</th>
      <th>35</th>
    </tr>
  </thead>
  <tbody>
    <tr>
      <th>C</th>
      <td>1</td>
      <td>1</td>
      <td>1</td>
      <td>1</td>
      <td>1</td>
      <td>1</td>
      <td>1</td>
      <td>1</td>
      <td>1</td>
      <td>1</td>
      <td>3</td>
      <td>3</td>
      <td>3</td>
      <td>3</td>
      <td>3</td>
      <td>3</td>
      <td>3</td>
      <td>3</td>
      <td>3</td>
      <td>3</td>
      <td>3</td>
      <td>3</td>
      <td>3</td>
      <td>3</td>
      <td>3</td>
      <td>3</td>
      <td>3</td>
      <td>3</td>
      <td>3</td>
      <td>3</td>
      <td>3</td>
      <td>3</td>
      <td>3</td>
      <td>3</td>
      <td>6</td>
      <td>6</td>
    </tr>
    <tr>
      <th>XR[0,1]</th>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
    </tr>
    <tr>
      <th>XZ[0,1]</th>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
    </tr>
    <tr>
      <th>XR[1,0]</th>
      <td>0</td>
      <td>0</td>
      <td>3</td>
      <td>3</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>2</td>
      <td>2</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>2</td>
      <td>2</td>
      <td>1</td>
      <td>1</td>
      <td>1</td>
      <td>1</td>
      <td>1</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>1</td>
    </tr>
    <tr>
      <th>XZ[1,0]</th>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>3</td>
      <td>3</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>2</td>
      <td>2</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>1</td>
      <td>2</td>
      <td>2</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>1</td>
      <td>1</td>
      <td>1</td>
      <td>1</td>
      <td>1</td>
    </tr>
    <tr>
      <th>XR[0,2]</th>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
    </tr>
    <tr>
      <th>XZ[0,2]</th>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
    </tr>
    <tr>
      <th>XR[1,1]</th>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
    </tr>
    <tr>
      <th>XZ[1,1]</th>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
    </tr>
    <tr>
      <th>XR[2,0]</th>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
    </tr>
    <tr>
      <th>XZ[2,0]</th>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
    </tr>
    <tr>
      <th>XR[0,3]</th>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
    </tr>
    <tr>
      <th>XZ[0,3]</th>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
    </tr>
    <tr>
      <th>XR[1,2]</th>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
    </tr>
    <tr>
      <th>XZ[1,2]</th>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
    </tr>
    <tr>
      <th>XR[2,1]</th>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
    </tr>
    <tr>
      <th>XZ[2,1]</th>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
    </tr>
    <tr>
      <th>XR[3,0]</th>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
    </tr>
    <tr>
      <th>XZ[3,0]</th>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>1</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
    </tr>
    <tr>
      <th>XR[0,4]</th>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
    </tr>
    <tr>
      <th>XZ[0,4]</th>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
    </tr>
    <tr>
      <th>XR[1,3]</th>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
    </tr>
    <tr>
      <th>XZ[1,3]</th>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
    </tr>
    <tr>
      <th>XR[2,2]</th>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
    </tr>
    <tr>
      <th>XZ[2,2]</th>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
    </tr>
    <tr>
      <th>XR[3,1]</th>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
    </tr>
    <tr>
      <th>XZ[3,1]</th>
      <td>0</td>
      <td>1</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
    </tr>
    <tr>
      <th>XR[4,0]</th>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
    </tr>
    <tr>
      <th>XZ[4,0]</th>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
      <td>0</td>
    </tr>
  </tbody>
</table>
</div>




```python

```


```python

```


```python

# for X_R_x0_R_diff_order in range(ndiff_R, -1, -1):
#     for X_R_x0_Z_diff_order in range(ndiff_Z, -1, -1):
#         for X_Z_x0_R_diff_order in range(ndiff_R, -1, -1):
#             for X_Z_x0_Z_diff_order in range(ndiff_Z, -1, -1):
#                 for term in result.factor().args:

#                     if x0_R_diff_order >= 2:
#                         x0_R_partdiff_substr = "\partial_{x_{0R}}^{"+f"{x0_R_diff_order}"+"}"
#                     elif x0_R_diff_order == 1:
#                         x0_R_partdiff_substr = "\partial_{x_{0R}}"
#                     elif x0_R_diff_order == 0:
#                         x0_R_partdiff_substr = ""

#                     if x0_Z_diff_order >= 2:
#                         x0_Z_partdiff_substr = "\partial_{x_{0Z}}^{"+f"{x0_Z_diff_order}"+"}"
#                     elif x0_Z_diff_order == 1:
#                         x0_Z_partdiff_substr = "\partial_{x_{0Z}}"
#                     elif x0_Z_diff_order == 0:
#                         x0_Z_partdiff_substr = ""

#                     result = result.subs(
#                         X_R.diff(x0_R, x0_R_diff_order, x0_Z, x0_Z_diff_order),
#                         Symbol(x0_R_partdiff_substr+x0_Z_partdiff_substr+" X_{R}",real=True) )

#                     result = result.subs(
#                         X_Z.diff(x0_R, x0_R_diff_order, x0_Z, x0_Z_diff_order),
#                         Symbol(x0_R_partdiff_substr+x0_Z_partdiff_substr+" X_{Z}",real=True) )
```


```python
XRdot.diff(X_R).subs(XRdot.diff(X_R), Symbol("\partial_{1} \dot{X}_R", real=True))
```




$\displaystyle \partial_{1} \dot{X}_R$




```python
from sympy import FiniteSet
len(FiniteSet(FiniteSet(5,5,7),FiniteSet(3,6)))
```




    2




```python
from sympy import FiniteSet
def list_of_all_partitions(set_to_partition):
    
    def partition_into_two_parts(set_to_split):
        set_size = len(set_to_split)
        all_partitions = []
        list_elements = list(set_to_split)
        first_ele = list_elements[0]
        for i in range( 1, 2**(set_size-1) ): # we skip i==0, because that is full set
            first_part = [first_ele]
            second_part = [ ]
            for j, ele in enumerate(list_elements[1:]):
                if (i >> j) % 2 == 0:
                    first_part.append(ele)
                else:
                    second_part.append(ele)
            if len(second_part)!=0:
                all_partitions.append([FiniteSet(*first_part), FiniteSet(*second_part)])
    #             all_partitions.append(FiniteSet(
    #                 FiniteSet(*first_part), FiniteSet(*second_part)))
            else:
                all_partitions.append( [FiniteSet(*first_part)] )
    #             all_partitions.append(FiniteSet(
    #                 FiniteSet(*first_part) ))

        return all_partitions # FiniteSet(*all_partitions)
    all_partitions = [ [set_to_partition] ]
    binary_partitions = partition_into_two_parts(set_to_partition)
    for bi_part in binary_partitions:
        if len(bi_part[-1])>1:
            first_part = bi_part[0]
            for secondpart_partition in list_of_all_partitions(bi_part[-1]):
                all_partitions.append([first_part] + secondpart_partition)
        else:
            all_partitions.append(bi_part)
    return all_partitions

```


```python
list(FiniteSet(FiniteSet(5),1,2))
```




    [FiniteSet(5), 1, 2]




```python
from random import randrange
from sympy import derive_by_array, Intersection, tensorproduct, tensorcontraction
ndiff_R, ndiff_Z = 3, 0
ndiff = ndiff_R+ndiff_Z
sum_over_big_pi = 0
for small_pi in list_of_all_partitions(  FiniteSet(*list(range(1, ndiff+1))) ):
    small_pi_size = len(small_pi)
    repeated_grad_result = XRdot
    for _ in range(small_pi_size):
        repeated_grad_result = derive_by_array(repeated_grad_result, [X_R, X_Z])
    
    term_of_small_pi = repeated_grad_result
    for iB, B in enumerate(small_pi):
        B_size = len(B)
        _ndiff_R = len(Intersection(  B, FiniteSet(*list(range(1, ndiff_R+1))) ))
        _ndiff_Z = len(Intersection(  B, FiniteSet(*list(range(ndiff_R+1, ndiff+1))) ))
        term_of_small_pi = tensorcontraction(tensorproduct(
            term_of_small_pi, 
            [X_R.diff(x0_R, _ndiff_R, x0_Z, _ndiff_Z), X_Z.diff(x0_R, _ndiff_R, x0_Z, _ndiff_Z)]), 
          (randrange(small_pi_size - iB), small_pi_size - iB) ) # (small_pi_size - iB -1, small_pi_size - iB) 
    sum_over_big_pi += term_of_small_pi
result = sum_over_big_pi
```


```python
print("We show them term-by-term as the following:")
for term in result.factor().args:
    term
```

    We show them term-by-term as the following:





$\displaystyle \left(\frac{\partial}{\partial x_{0R}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}\right)^{3} \frac{\partial^{3}}{\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}^{3}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle \left(\frac{\partial}{\partial x_{0R}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}\right)^{3} \frac{\partial^{3}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}^{3}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle \frac{\partial^{3}}{\partial x_{0R}^{3}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial}{\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle \frac{\partial^{3}}{\partial x_{0R}^{3}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle 3 \left(\frac{\partial}{\partial x_{0R}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}\right)^{2} \frac{\partial}{\partial x_{0R}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{3}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}^{2}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle 3 \frac{\partial}{\partial x_{0R}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \left(\frac{\partial}{\partial x_{0R}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}\right)^{2} \frac{\partial^{3}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}^{2}\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle 3 \frac{\partial}{\partial x_{0R}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial x_{0R}^{2}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}^{2}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle 3 \frac{\partial}{\partial x_{0R}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial x_{0R}^{2}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle 3 \frac{\partial^{2}}{\partial x_{0R}^{2}} \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial}{\partial x_{0R}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}\partial \operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$






$\displaystyle 3 \frac{\partial}{\partial x_{0R}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial x_{0R}^{2}} \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)} \frac{\partial^{2}}{\partial \operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)}^{2}} \dot{X}_{R}{\left(\operatorname{X_{R}}{\left(x_{0R},x_{0Z},\phi \right)},\operatorname{X_{Z}}{\left(x_{0R},x_{0Z},\phi \right)},X_{\phi} \right)}$




```python

```


```python
list_of_all_partitions(  FiniteSet(*list(range(1, ndiff+1))) )
```




    [[FiniteSet(1, 2, 3)],
     [FiniteSet(1, 3), FiniteSet(2)],
     [FiniteSet(1, 2), FiniteSet(3)],
     [FiniteSet(1), FiniteSet(2, 3)],
     [FiniteSet(1), FiniteSet(2, 3)],
     [FiniteSet(1), FiniteSet(2), FiniteSet(3)]]




```python

```

2c1d67f27b32fba3315ce4f1eab7d7e3fbfa9453
ipynb
Jupyter Notebook
nb/Higher_dimensional_partial_derivatives_of_Poincare_Map.ipynb
WenyinWei/MHDpy
a1ba3cd4b1ca8287e32a97170c685dff1d7cd276
MIT
nb/Higher_dimensional_partial_derivatives_of_Poincare_Map.ipynb
WenyinWei/MHDpy
a1ba3cd4b1ca8287e32a97170c685dff1d7cd276
MIT
nb/Higher_dimensional_partial_derivatives_of_Poincare_Map.ipynb
WenyinWei/MHDpy
a1ba3cd4b1ca8287e32a97170c685dff1d7cd276
MIT
2021-05-27T14:13:48.000Z
2021-05-27T14:13:48.000Z
Qwen/Qwen-72B
1. YES
2. YES