All Questions
11 questions
3
votes
2
answers
2k
views
Inaccurate results of integration using scipy solve_ivp
I am trying to use solve_ivp to solve the following 1st order ODE:
$$ \frac{d \rho}{d z} = \frac{m \theta}{(1+\theta z)} \, \rho, $$
subject to $\rho(z=0)=1$, where ...
2
votes
1
answer
6k
views
Error in Simpson's 3/8 rule is higher than that of Simpson's 1/3 rule
For a given function $f(x)$, I have tried to find its numerical integral using Simpson's 1/3 and Simpson's 3/8 rules.
I then compare the solution from the numerical quadratures to the analytical ...
2
votes
0
answers
736
views
Errors in Integral Estimate of Gaussian using Trapezoidal Rule
I'm trying to estimate the percentage error in computing the integral of a Gaussian via composite trapezoidal rule versus via an exact formula. To do this I've generated a gaussian with mean 0, ...
2
votes
1
answer
2k
views
Trouble with backwards time integration in Python
I am struggling with a rather basic numerical integration task: Using Python's scipy.integrate.solve_ivp module to integrate an ODE sytem backwards in time. As a test, I am using the following ODE ...
2
votes
1
answer
3k
views
Numerical integration problem: IntegrationWarning The integral is probably divergent, or slowly convergent
I am trying to get the numerical integration of a function using scipy's integrate.quad as follows.
$$
\begin{equation}
G (\alpha) = \frac{4\alpha}{\pi}\int_0^{\...
4
votes
0
answers
339
views
How to numerically evaluate this double Integral?
I want to evaluate the following integral:
$$\int_{0}^{60} \ \left(\int_{0}^{2z} 0.5\cdot t \left(\mathrm{erf}(t-a) -1 \right)J_{0}(qt)\mathrm{d}t \right)^2 \mathrm{exp}\left(-\frac{(z-a)^2}{2s^2}\...
3
votes
4
answers
3k
views
Numerical integration in Python with unknown constant
I’d like to solve the below equation for the unknown $T$:
$$\int_0^\infty \frac{x^2}{\exp\left(\frac{x}{T}\right)-1}\kappa_x \mathrm{d}x = C,$$
where $C$ is a known constant and $\kappa_x$ is some ...
0
votes
1
answer
1k
views
How can this multidimensional integral be efficiently implemented in python using Gauss-Hermite quadrature
I'm playing around with dynamic programming and need to calculate a multidimensional integral $E[V(W)]$ where we assume $W$ has a log normal distribution. I was looking at the following example in ...
-1
votes
1
answer
6k
views
Using scipy.odeint to solve coupled equations [closed]
I have a set of three coupled autonomous equations:
${y_{1}}\prime = y_{1}(\frac{\Omega_{m}}{y_{1}^3} + \frac{y_{3}^2}{6.0} + \frac{V(y_{2})}{2.H_{0}^2})$
$y_{2}\prime = y_{3}$
$y_{3}\prime = -3\frac{...
2
votes
1
answer
247
views
Another way to evaluate the gravitational force from a uniform cube?
Appendix A of Liu, Baoyin, and Ma (2011) Equilibria, periodic orbits around equilibria, and heteroclinic connections in the gravity field of a rotating homogeneous cube shows an analytic expression ...
1
vote
1
answer
1k
views
Improper Numerical integral
I am self teaching myself python and computational physics via Mark Newmans book Computational Physics the exercise is 5.17 of Computational Physics. I have to shift the limits of integration for an ...