Message Boards Message Boards

15 Replies
1 Total Likes
View groups...
Share this post:

Complex integral with NDSolve

If seeking an indefinite integral, then Integrate[] solves the problem, but sometimes it chokes on hard ones. NDSolve seems to give an alternative producing an interpolated solution, but such solutions take only real variables, not complex. Is there a way to change this or a way to restate the integral altogether as a PDE?

15 Replies

Just to follow up, I eventually did get some positive results. The motivation for this problem was the Schwarz-Christoffel transformation (taken from Complex Analysis for Mathematics and Engineering by Mathews & Howell). A conformal map from an arbitrary polygon onto a unit circle is the solution of the integral. My result is a conformal map extending to a boundary roughly the shape of the starting polygon, but there are significant errors in accuracy for all but the simplest of polygons, as of yet. Perhaps I can find a way to improve the computation, but I find that increasing "MinPoints" doesn't always make things any better, and in fact, sometimes worse.

Here's a version of NDSolve used the way that I was imagining....and it gets going, but it's still not giving me quite what I had in mind...maybe it just needs a tweak.

enter image description here

enter image description here

Yes, but, see that the first example which succeeds with Integrate[], it gives a solution that meaningfully takes a complex value, and I would like to have something which does this for the second example. Anyway, I like the idea of the differential form that Daniel gave. I suppose I will go that route.

In[1]:= expr = Product[(x - i)^(-2/5), {i, 0, 3, 1}]

Out[1]= 1/((-3 + x)^(2/5) (-2 + x)^(2/5) (-1 + x)^(2/5) x^(2/5))

In[9]:= NIntegrate[expr, {x, 0, 10}]

During evaluation of In[9]:= NIntegrate::slwcon: Numerical integration converging too slowly; suspect one of the following: singularity, value of the integration is 0, highly oscillatory integrand, or WorkingPrecision too small. >>

During evaluation of In[9]:= NIntegrate::ncvb: NIntegrate failed to converge to prescribed accuracy after 9 recursive bisections in x near {x} = {2.01156}. NIntegrate obtained -0.982375-1.58796 I and 0.08710236099655635` for the integral and error estimates. >>

Out[9]= -0.982375 - 1.58796 I

In[15]:= int[x_] = 
 NDSolveValue[{y'[x] == expr, y[-1] == 0}, y[x], {x, -1, 10}]

Out[15]= InterpolatingFunction[{{-1., 10.}}, <>][x]

In[16]:= int[10] - int[0]

Out[16]= -0.975968 - 1.57868 I
POSTED BY: Frank Kampas

What's the range of integration?

POSTED BY: Frank Kampas

I think that the distinction here is that the goal is not to solve a contour integral per se but rather a complex-valued, indefinite integral. Perhaps I am mistaken in thinking that there is a difference between the two.

An example of the kind of problem you're trying to solve would be helpful.

POSTED BY: Frank Kampas

Here are two cases, one that works with Integrate, and one that doesn't. The latter is why I try to find an alternative using NDSolve[]





Daniel, I'm puzzled by your answer. Wouldn't it be easier to parameterize the integration path and do a change of variable?

POSTED BY: Frank Kampas

Yes, if the goal is to get a result on a linear path. From the wording I had thought the goal was to get a result that works on a region (rectangle, say) of C.

POSTED BY: Daniel Lichtblau

Maybe recast as d/dz (=1/2(d/dx-Id/dy) in the original ODE, and use d/dz==0 where that latter is 1/2(d/dx+I*d/dy). So now it is a PDE involving complex coordinates, but in terms of real x and y.

POSTED BY: Daniel Lichtblau

I was hoping somehow to use the fact that the solution is of the form f(x + i y) = u(x,y)+ i v(x,y), and moreover, that for the derivative, f'(x + i y) = du/dx + i dv/dx = dv/dy - I du/dy. I think that this comes from Cauchy-Riemann equations.

I see what you mean. Can you transform the problem so that the path of integration is along the real axis?

POSTED BY: Frank Kampas

yes, but in this case your solution is complex valued, but the domain is still pure real. What happens if you change x -> 1 to x -> 2 + 3 I in your line [21]?

I think NDSolve can handle complex variables:

In[22]:= sln = NDSolve[{y'[x] == y[x], y[0] == I}, y[x], {x, 0, 1}];

In[21]:= (y[x] /. sln[[1]]) /. x -> 1

Out[21]= 0. + 2.71828 I
POSTED BY: Frank Kampas
Reply to this discussion
Community posts can be styled and formatted using the Markdown syntax.
Reply Preview
or Discard

Group Abstract Group Abstract