I am looking for a solution to a set of non-linear equations. Let $K$ and $S$ be $N\times N$ real matrices. Given $K$ I would like to solve the following for $S$:
$$K_{jk} = \sum_a S_{ka} |S_{ja}|^\delta \mathrm{sign}(S_{ja}).$$
The exponent is $0 < \delta < 1$, but typically 1/2 and I can settle for a solution in that special case only, if that helps.
I realize that the solution will mostly likely be numerical. I have tried a brute-force solver in python, that converges well if $K$ is diagonal, but not really otherwise.
An example matrix where I'm having problems is $$K = \begin{pmatrix} 1.0 & 0.5 \\ 0.223 & 0.447 \end{pmatrix}.$$
I realize this is not a python forum, but here is my (ugly) code for reference:
import scipy.optimize
import numpy as np
N = 2
delta = 0.5
epsilon = 1e-3
K = np.array([[1.0, 0.5],
[0.223, 0.447]])
x0 = K.flatten()**0.666
def f(x):
return np.array([[sum([x[k*N+a]np.abs(x[jN+a])*deltanp.sign(x[j*N+a]) for a in range(N)])-K[j, k] for k in range(N)] for j in range(N)]).flatten()
def fprime(x):
ret = np.array([[np.array([[sum([(kdN+jd == kN+a)np.abs(x[jN+a])deltanp.sign(x[jN+a]) + ((kdN+jd == jN+a) and (np.abs(x[j*N+a]) > epsilon))x[kN+a]deltanp.abs(x[j*N+a])(delta-1.)np.sign(x[jN+a]) for a in range(N)])-K[j, k] for k in range(N)] for j in range(N)]) for jd in range(N)] for kd in range(N)])
return ret.reshape(len(x), -1)
S, infodict, status, msg = scipy.optimize.fsolve(f, x0, fprime=fprime, xtol=1e-16, epsfcn=1e-16, maxfev=2000, full_output=True)
printmsg = f"{msg} nfev = {infodict['nfev']}, njev = {infodict['njev']}"
assert status == 1, printmsg
Any feedback is welcome.