# Tag Info

12

Use Plancherel's theorem to evaluate this integral. The basic idea is that for two functions $f,g$, $$I=\int_{-\infty}^{\infty} f(x) g^*(x)dx = \int_{-\infty}^{\infty} F(k) G^*(k) dk$$ where $F,G$ are the Fourier transforms of $f,g$. Your functions both have relatively small support in the spectral domain. Here, $\sin x / x \rightarrow \text{rect}(k)$ ...

7

The key to the evaluation of oscillatory integrals is to truncate integral at the right point. For this example you need to choose upper limit of the form $$\pi\mathbb{N}+\frac{\pi}{2}$$ Before explaining why it should work, let me at first show that it actually produces good results. Asymptotics It is easy to guess that asymptotic series has the ...

6

Ooura's method for Fourier sine integrals works here, see: Ooura, Takuya, and Masatake Mori, A robust double exponential formula for Fourier-type integrals. Journal of computational and applied mathematics 112.1-2 (1999): 229-241. I wrote an implementation of this algorithm but never put in the work to get it fast (by, say caching nodes/weights), but ...

6

What you want seems inherently impossible, and that’s not due to restrictions of Python. The only way we can arrive at a situation where we only need to apply a single quadrature is to get analytically get rid of all dependencies of $T$ in the integral. To this end, the best we can do is to apply the substitution $x=Ty$ to your integral: $$I(T) = \int_0^∞ \... 5 The point is to guarantee that the Fourier coefficients exist, not to make really fine distinctions about what might happen if the guarantee is violated. Furthermore, you would be hard pressed to find a reasonable function for which this is an issue, if it exists at all. The class of integrable functions is already so wide as to include everything you might ... 4 We are considering the one-dimensional scalar conservation law,$$ \frac{\partial u}{\partial t} + \frac{\partial f(u)}{\partial x}= 0, \quad x \in \Omega, \quad t > 0, $$subject to appropriate initial and boundary conditions. For a DG method, we would like to seek solutions u_h(\cdot, t) in the space V_h \subset L^2(\Omega) containing functions that ... 4 This integral has a closed analytic solution. The trick is to write$$\frac{1}{x^3+ ax + 2a} = \frac{A}{x-x_1} + \frac{B}{x-x_2} + \frac{C}{x-x_3}$$by a method called partial fraction decomposition. The values x_i are the roots of the polynomial in the denominator. As your polynomial only has third degree, an analytic formula for the roots exists (aka "... 3 Yes, it is very well arguable that \frac{e^x-1}{x} is as right as'' expm1. It appears frequently in applications; see for instance Sections 2.1 and 10.7.4 of Higham's Function of Matrices, which mention exponential integrators and matrix functions; this function is called \psi_1(x) there. Your example, integrating exponentials, is another one, and it ... 3 You can do this computationally for both one-sides (first order similar to Euler) and center (second order) differences easily using the code below. Basically the error due to floating point takes over much sooner than machine epsilon would suggest even for double precision. The case is even worse for single precision of course (you can change the below ... 3 As all the commentators have already pointed out: Something is fishy about your ODE. why is there just m for \ddot r and then m_1 and m_2 for \dot \theta? why is there no equation involving \ddot \theta? why is l a parameter where one would actually expect something dynamic like r\dot \theta^2 for the angular momentum? why is it \frac k {mr^... 3 I think that there is a bit of confusion with change of variables in some of the previous answers as well as some errors. The integral of a log function is not the log of the integral. I think in general is difficult to write out the the integral of a function knowing the integral of its log. If anyone knows how to do that I would be interested. In the ... 3 The common way of tracking such properties is indeed to add an additional ODE to the system, here:$$\frac{df}{dt}=a(t)+b(t)+x(t)+z(t)$$with initial condition$$f(0)=0.$$If this is not possible, then a smart choice of output times e.g. quadrature points in t for an integration afterwards is recommend. 3 It seems to me that this question is about how you handle \kappa. I know you don't want to fit a function to it, but I don't think you can get around sampling it at positions other than the positions in the array. You may also need some kind of asymptotic approximation as x \rightarrow \infty so you can extrapolate in that range. Having said that, I ... 2 Lets assume that the given expression has a non-infinite integral you could actually write down. The question you should be asking -might- be more like: "To what precision do I need to calculate?". If you have$$K_x(x)$$only as an array of values anyway, you might only ever achieve a certain precision. Is an error of 1e-16 okay for your application? Do you ... 2 I would either interpolate the samples of u_0 or do a curve-fit, so as to obtain an approximate u_0(\eta) that is easy to integrate analytically. The choice of interpolation or fitting methods depends on what you know about u_0(\eta). For example, if it is a band-limited signal, and the sample frequency is greater than the Nyquist rate, then ... 2 expm1 is a primitive because for small x, the Taylor series for e^x=1+x+x^2+\cdots adds small terms to one -- which implies that if x is small enough, you lose almost all digits of accuracy other than the leading one and so the expression e^x-1 can not be accurately computed by first evaluating the exponential. The fact that you happen to have an ... 1 In essence, you are asking whether you have values for a function h'(r) at points r_i, you can obtain an approximation of h(r). The answer is of course yes: If you connect the points (r_i,h'(r_i)) by a piecewise linear curve, then you can integrate that to obtain a piecewise quadratic approximation of h(r). You can be more accurate if you connect ... 1 I think the easiest way may simply be an outer loop over the outer integral, while interatively increasing the inner one. So you basically do a midpoint rule for the outer integral, and remember the value of your inner integral from the last step. pseudocode: double dx = 1e-12; double inner_int =0.0; double outer_int =0.0; for(double x = 0.0; x<=1.0;x+=... 1 Please have a look at the answers to this question on CrossValidated. There you can find a worked out solution (including R-code) based on Gauss-Hermite quadrature, which is especially designed for this problem (note that it requires a variable transformation) and -in a different answer- a comparsion of MonteCarlo (slow) with the R builtin function integrate ... 1 Haven't checked the rest but 9/8 is an integer expression and so returns an integer which will be 1. Try 9.0/8.0, and also understand why this is important. 1 This could be done purely numerically, if you take the integral as part of your non-linear equation. First of all, I created a interpolating function for your \kappa_x function. It's just a dummy linear interpolation between data points allowing for end-point constant extrapolation (see interp1d). I leave it up to you to modify this according to your ... 1 If f is not integrable, then the first fourier coefficient obtained by considering n=0 (i.e., the mean) is not defined. Other Fourier coefficients are likely to be undefined as well (but some could very well exist, as Kirill already pointed out). In any case, the existence of the Fourier Series for such a function is doomed. 1 Applying Cauchy-Schwartz inequaility, we have:$$\begin{aligned} \left(\int_{0}^{\pi}f(x)\cos{(x)}\,dx \right)^2&\leq \left(\int_{0}^{\pi}|f(x)\cos{(x)}|\,dx \right)^2\\ &\leq \int_{0}^{\pi}f(x)^2\,dx \int_{0}^{\pi}\cos{(x)}^2\,dx=\frac{\pi}{2}\int_{0}^{\pi}f(x)^2\,dx \end{aligned} And if $f(x)\notin {L}^2(x)$ then the Fourier coefficients are ...

Only top voted, non community-wiki answers of a minimum length are eligible