Residue calculation in Sagemath
I have done the following calculation in maple, I want to know if we can do it in Sagemath and write a code using the recursive definition. We construct a family of meromorphic function $W_{g,n}(z_1, z_2, \ldots, z_n)$. We consturct it recursively. The intial data given is the following.
$$y(z) = 2 \frac{sinh^{-1}(z/(2a)^{1/2})}{(z^2 +2a)^{1/2}}$$ where $sinh(z)$ is sine hyperbolic funciton can be defined directly in maple as it is.
$$ K(z):=\frac{1}{z(y(z) - y(-z))} \rightarrow 1/2\,{\frac {a}{{z}^{2}}}+1/6-{\frac {{z}^{2}}{90\,a}}+{\frac {{z}^{4} }{378\,{a}^{2}}}-{\frac {23\,{z}^{6}}{28350\,{a}^{3}}}+{\frac {263\,{z }^{8}}{935550\,{a}^{4}}}-{\frac {133787\,{z}^{10}}{1277025750\,{a}^{5} }}+{\frac {157009\,{z}^{12}}{3831077250\,{a}^{6}}}-{\frac {16215071\,{ z}^{14}}{976924698750\,{a}^{7}}}+{\frac {2689453969\,{z}^{16}}{ 389792954801250\,{a}^{8}}}+O \left( {z}^{18} \right) $$ $K(z)$ we define using $sinh(z)$ and take the Taylor series expansion to study the few terms.
Let $W_{0,2}(z_1, z_2): = 1/(z_1 - z_2)^2$
Having this initial data we can construct a tower of $W_{g,n}(z_1, z_2, \ldots, z_n )$ as follows. Let me give few examples that I have computed by hand in maple.
Let's give some examples of how to generate families of functions $$W_{1,1} = Res_{z =0}\, K(z)\frac{1}{z-z_1} W_{0,2}(z,-z) = 1/24\,{\frac {{{\it z1}}^{2}+3\,a}{{{\it z1}}^{4}}} $$ Taking residue at $z =0$ means collecting the $1/z$ ceofficients. $$W_{0,3}(z_1, z_2 , z_3) = Res_{z =0}\, K(z)\frac{1}{z-z_1} \left(W_{0,2}(z_1,-z)W_{0,2}(z_2,z) + W_{0,2}(z_2,-z)W_{0,2}(z_1,z)\right)= {\frac {a}{{{\it z2}}^{2}{{\it z3}}^{2}{{\it z1}}^{2}}} $$
$$W_{1,2}(z_1 , z_2) =Res_{z =0}\, K(z)\frac{1}{z-z_1} \left( W_{0,3}(z,-z,z_2) + W_{0,2}(z,z_2)W_{1,1}(-z)+ W_{0,2}(-z,z_2)W_{1,1}(z)\right)= \ 1/8\,{\frac { \left( 2\,a{{\it z1}}^{2}+5\,{a}^{2} \right) {{\it z2}}^ {4}+ \left( 2\,a{{\it z1}}^{4}+3\,{a}^{2}{{\it z1}}^{2} \right) {{\it z2}}^{2}+5\,{a}^{2}{{\it z1}}^{4}}{{{\it z1}}^{6}{{\it z2}}^{6}}} $$ So let's define $W_{g,n}(z_1 , z_2, \ldots, z_n)$ in general by taking the residue of $$W_{g_1,n_1}(z,\ldots)W_{g_2 , n_2}(-z,\ldots) + W_{g-1 , n+1}()\tag{*}$$ along with the product $ K(z)\frac{1}{z-z_1}$. $W_{g_1,n_1}(z_1 , z_2, \ldots, z_{n_1})$ represent meromorphic functions in $n_1$ variables. And the sum is taken over all such possible combinations. And in case of $W_{g-1 , n+1}(z,-z,z_2 \ldots z_n)$.
In general, if we can write a code where we can give the initial data and then will compute $W_{g,n}(z_1, z_2, \ldots , z_n)$. It should be a recursive definition. I maple I cannot compute more than $(3,1)$ tuples. But with effective Dynamical programming, we definitely can do more. If someone shows me how to do the initial computation in sagemath, then I will try to write the general programme.
@Anupamsage : your notation is ambiguous (unbalanced parentheses) ; could you check ?
EDIT : Edited, corrected and given as an answer.
I have edited it now.