Timeline for Solving an integro-differential equation with Mathematica
Current License: CC BY-SA 4.0
20 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Aug 26, 2019 at 21:31 | comment | added | Michael E2 |
Re (2): Interpolation by default returns a piecewise cubic interpolation. Over each interpolating interval $f(x_p)$ is equal to a cubic polynomial. One might be able to take advantage of it. The trapezoid rule might work well, in fact, on the desingularized integrand in the previous comment. (The integrand still has weak singularities at the interpolation nodes, so it might not be that accurate.)
|
|
Aug 26, 2019 at 21:28 | comment | added | Michael E2 | @user55777 Sorry, I'm rather busy and haven't had time to investigate. Re (1): Your integral has the form $\int _{x-L}^{L+x}f(x_p)\cot(\pi(x-x_p)/(2 L))dx_p$. We have $\int _{x-L}^{L+x}f(x)\cot(\pi(x-x_p)/(2 L))dx_p=0$ (PV). If we subtract it from your integral, we get $\int _{x-L}^{L+x}[f(x_p)-f(x)]\cot(\pi(x-x_p)/(2 L))dx_p$, which no longer has a singularity at $x_p=x$. It should speed up the integration a bit. | |
Aug 26, 2019 at 2:51 | comment | added | user55777 |
@MichaelE2 I didn't understand your first suggestion. Did you mean I should use NIntegrate[(D[u[xp, 0], {xp, 3}]-u[xp, 0])*Cot[\[Pi] (x - xp)/(2*L)], {xp, x - L, x, x + L}] . Could you please give an update?
|
|
Aug 25, 2019 at 19:03 | comment | added | Michael E2 |
@user55777 (1) You could subtract u0*Cot[\[Pi] (x - xp)/(2*L)] from the integrand, where u0 is the value of the interpolation at xp == x . Then you don't need the principal value method, which numerically approximates a limit (probably slowly). (2) You could try to come up with an integration rule. The integrand between the grid points has the form of a cubic polynomial times the Cot[] . Then you can bypass the overhead of NIntegrate and Interpolation . That might require some considerable work, though.
|
|
Aug 25, 2019 at 16:41 | comment | added | user55777 |
@MichaelE2 The combination of NIntegrate and Interpolation makes the integration very slow, i.e., NIntegrate[Interpolation[periodize@Transpose@{xv, uppp}, xp, PeriodicInterpolation -> True]*Cot[\[Pi] (x - xp)/(2*L)], {xp, x - L, x, x + L}, ...] . Is it possible to avoid using the Interpolation ?
|
|
Jul 19, 2019 at 15:10 | history | edited | Michael E2 | CC BY-SA 4.0 |
Improved code
|
Jul 19, 2019 at 15:09 | comment | added | Michael E2 |
@user55777 The function int[] is called in sys with three arguments. At the initial condition at t == 0 , we can compute the integral from the initial condition and ignore u . I think the confusion is that the pattern u_ in the defintion of int[] has nothing to do with the function u[x, t] in sys . It's really the 3rd derivative of u (w.r.t. x ). I should have called it uppp_ as in the second definition. It won't change how the code works, but it's better style to use variable names that reflect the meaning of the variable. Will update.
|
|
Jul 19, 2019 at 4:20 | comment | added | user55777 |
@MichaelE2 sorry for troubling you. In the 1st int[u_, ...] , u hasn't been used in the function, why did u introduce it there? Could u have a look at the intnest my recent post. I am not sure if I did a correct extension. Thank you for your time.
|
|
Apr 27, 2019 at 22:28 | history | edited | Michael E2 | CC BY-SA 4.0 |
Responded to comment
|
Apr 27, 2019 at 15:29 | comment | added | Michael E2 | @jsxs They are probably a remnant of testing/development. I must have forgotten to remove them from Block[]. I can only remember that int[] was a wrapper for iint[] but I either solved some programming problem of setting up the NIntegrate[] or changed the approach. There was a problem but I’ve forgotten what it was | |
Apr 27, 2019 at 11:25 | comment | added | lxy |
@MichaelE2 why did u Block iint and xx , which did not appear in the expression subsequently?
|
|
Mar 17, 2019 at 16:49 | comment | added | bbgodfrey | @user55777 The method I thought would work no longer appears to, and my back-up approach is very similar to yours. I suggest that you add to your answer a plot of the result you obtain, and then accept the answer, if any, that looks correct to you. I shall try again later to solve this question, but I have little time at the moment. So, please do not wait for me. | |
Mar 10, 2019 at 4:06 | comment | added | Michael E2 | @user55777 I'm afraid I don't know what to suggest. It seems it would depend on which definitions are saved and whether some definitions have been cleared. | |
Mar 7, 2019 at 20:24 | comment | added | Michael E2 |
@user55777 NIntegrate::slwcon is just a warning and can often be ignored when not followed by another error. On a well-behaved integral, NIntegrate expects the error to converge to the precision/accuracy goals at a certain, probably heuristic, rate. As a result, integrating functions with singularities such as interpolating functions usually converge more slowly and sometimes trigger the warning.
|
|
Mar 7, 2019 at 19:35 | comment | added | Michael E2 |
Technically, it is a preprocessor "strategy" and so can take another Method argument, which may be another "strategy" or "rule." See NIntegrate Introduction, Strategies, Rules, and Preprocessors
|
|
Mar 7, 2019 at 19:31 | comment | added | Michael E2 | @user55777 Some posts concerning "InterpolationPointsSubdivision" shows use-cases, but it's not well documented. Basically, interpolating functions have (weak) singularities at the interpolation points (nodes), and integration rules are more effective on intervals over which functions do not have singularities. By dividing up the interval of integration at the interpolation points, convergence is more easily obtained. It can be inefficient if there are a lot of interpolation points. | |
Mar 7, 2019 at 4:34 | comment | added | user55777 | By testing the code as it is, i encounter the usual warning: >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. I don't understand the issue because the singular point has been specified. Please give me suggestion. Thanks a lot. | |
Mar 7, 2019 at 4:04 | comment | added | user55777 |
@Michael E2, your method is cool and far outside of my knowledge range about mma. Could you explain a little the reason Method -> {"InterpolationPointsSubdivision", Method... } in NIntegrate . I quickly go through tutorial/NIntegrateIntegrationStrategies, and found the general specification NIntegrate[f[x],{x,a,b,c}, Method->{"PrincipalValue",Method->methodspec,"SingularPointIntegrationRadius"->\[Epsilon]}] , which appears to be different from yours. Thank you for your answer.
|
|
Mar 6, 2019 at 17:21 | comment | added | bbgodfrey | Very impressive (+1). Thanks. | |
Mar 6, 2019 at 17:10 | history | answered | Michael E2 | CC BY-SA 4.0 |