I have two functions, y = f(x) and y = g(x), defined through Array{Float64,2} -- a sequence of (x, y) points.
I want to find such f'(x) = f(x+dx) + dy that the distance between the functions on the chart is minimal. For example, here, the distance is already quite small, but it could be even smaller.
In my particular case, the number of points in two arrays is identical, so I tried to minimise the following function (assuming p = [dx, dy]):
loss(p) = sum(abs2, mapslices(x -> x .- p, f .- g, dims=2))
But, apparently, this doesn't work well. Also, it would be nice to be able to work with arrays of different sizes.


