Questions tagged [numerical-integration]
Algorithms that integrate functions over one or more dimensions using approximation techniques, instead of exact, closed-form solutions using symbolic algebra and calculus. Includes concepts like adaptive quadrature, Monte-Carlo methods, finite element analysis, Markov chains.
numerical-integration
1,336
questions
0
votes
0
answers
18
views
Calculation of a 5-d integral using Julia HCubature
I am calculating the integral above.
My code is
using HCubature
function FUN_trans(x)
return k1_FUN([1/x[1]-1, 1/x[2]-1, x[3], x[4], 1/x[5]-1]) / x[1] / x[1] / x[2] / x[2] / x[5] / x[5]
end
...
0
votes
1
answer
34
views
why my adhesion force is increasing when I increase the number of points
function adh = adhesionScheme(o,H, delta, m, n,walls,wallsInt,wallsExt)
% flag whether we have walls or not
confined = 0;
if ~isempty(walls) || ~isempty(wallsInt)
confined = 1;
end
% flag for ...
0
votes
0
answers
37
views
Memory Error when computing ODE solutions
I am modelling a Klein-Gordon equation (similar to a wave equation), by mode decomposition, i.e. I need to solve the eigenvalue problem y_n'' = - omega_n ** 2 * y (This is of course a vast ...
0
votes
0
answers
36
views
Applying the Trapezoidal Method for Integration on Matrix in C
I have a 2x2 matrix, called "one_elect", which is a function of a variable "r" but I am a little confused as to how to apply the Trapezoidal Method for integrating onto this matrix....
3
votes
2
answers
95
views
Performing integral over infinity with numbers in excess of 10^1000
I am attempting to perform on an integral from -infinity to infinity, with an equation containing a term that is raised to the power M. At very high (5000+) values of M, this value of this term can ...
-2
votes
2
answers
85
views
How to make integration faster?
I'm using following code but it takes about an hour. Function chi and integrand are working fine, but chi_dop is taking too much time.
How to make it faster?
Any better way to integrate other than ...
1
vote
1
answer
86
views
What is going on behind this numerical integration?
I am calculating the value of the integral
∫₀¹ ∫₁² (r - u)r drdu
I would like to understand how the following error is handled in R.
Looking around the forum, I realized that a vectorization of the ...
0
votes
0
answers
93
views
Does Modern Fortran (gfortran) has h-adaptive multi-dimensional integration package?
I wonder whether there is an h-adaptive multi-dimensional integration package, containing the algorithm like hcubarture package of Julia language, for modern Fortran?
The algorithm is better if it can ...
0
votes
0
answers
64
views
Different answer for numerical integral from nquad and Mathematica
I am trying to write a function that returns the numerical answer of a very complicated integral. I have the following code
import numpy as np
import scipy as sp
import sympy as smp
import matplotlib....
2
votes
1
answer
36
views
scipy.integrate.quad gives incorrect value
I was trying defining a trajectory using velocity and curvature by time; i.e. v(t) and k(t).
To get x and y position at time t, I used scipy.integrate.quad but it gives a wrong value.
Below is what I'...
1
vote
0
answers
33
views
double integration in python using trapezoid method
I am trying to solve an integral given as
$\int_{-pi}^{pi} \int_{-1}^{1} d(cos_theta) d(phi) sin_{theta}*cos_{phi}*g $
using scipy.integrate.trapezoid method.
The code is as follows:
def dist(a, vz):
...
1
vote
0
answers
37
views
How to solve the divergence error in dblquad python
Any help to double integrate this function probably in python:
Becaue when I run the following code it gives an error:
IntegrationWarning: The integral is probably divergent, or slowly convergent.
...
0
votes
0
answers
46
views
scipy.integrate.simpson gives different result when x (sampled points) is explicitly given
I was writing a simple integration function using Simpson's rule and was comparing my result to both an analytic result as well as the result from scipy's simpson function (scipy.integrate.simpson). I ...
0
votes
0
answers
40
views
How to integrate a discontinuous function by tplquad or nquad
I try to triple integrate the following function but it gives many errors:
IntegrationWarning: The integral is probably divergent, or slowly convergent.
IntegrationWarning: The maximum number of ...
1
vote
0
answers
56
views
how to prevent scipy's solve_ivp solution error from increasing in large domain
My code is used to simulate various forms of the differential equation -2 / (h(t) - λ(t)) for some starting point h0 and driver λ(t). I've ran this for some h0 and λ(t) with good success (such as λ(t) ...