Search code examples
cinterpolationnumericnumerical-methodsgsl

How to interpolate a complex function form two complex variables using GSL library?


I am interpolating a complex analytical function from two complex variables given with arrays:

enter image description here

A, mu and t set using standard complex numbers presentation from GSL. I want to use the GSL function of two-dimensional interpolation, but it only works with double types. I can break down all the values of all variables (A, mu, t) into Re and Im parts (get double** arrays), but I don’t know how to interpolate “two real numbers depend on four real numbers”, since the interpolator does not know anything about the relationship of variables with each other. Also, each variable is a function of its real and imaginary parts. As I understand it, just combining multiple splines will not work: it is wrong to do a spline between real parts, a spline between minimum parts and then a spline between splines.

Can this be done using GSL and how, if so? And if not, is there somewhere a description of the multidimensional interpolation algorithm?


Solution

  • They are linearly independent. Like x and y coordinates in plane.

    1. Interpolate real and imaginary parts or depending on your problem better yet magnitude and phase individually.
    2. Put the results back together.

    In pseudo:

    interp(re(f(x)) + i * interp(im(f(x))) 
    

    Be careful if you do go mag/phase for phase jumps. You will have to unwrap the phase, which is straightforward in one dimension.