837 questions
- Bountied 0
- Unanswered
- Frequent
- Score
- Trending
- Week
- Month
- Unanswered (my tags)
4
votes
1
answer
174
views
sympy unable to take simple integral
I'm trying to take the following integral using sympy and it won't take it:
>>> from sympy import *
>>> integrate(x*exp(-(x-x0)**2), (x, 0, k))
If I 'help' it by adding and ...
0
votes
0
answers
42
views
Can't install PyCuba
I am unable to use PyCuba, a Python interface for the multidimensional-integration library Cuba, on macOS 15.5. PyMultiNest, which requires PyCuba, is common for Bayesian analysis in the scientific ...
0
votes
0
answers
73
views
Optimal method to numerically calculate 4D integral on a large grid
Problem description
I am trying to numerically calculate 4d integral:
where d^4 x = dt d^3 x and the function f(x)=f(t,x) should be resolved on a large grid. In order to fit it in memory (I have a ...
0
votes
1
answer
66
views
sympy integration with quotient and cot(x) not getting simplifed results
I am trying to use sympy to integrate 1 / (1 + cot(x)) for variable x, (or its equivalent sin(x) / (sin(x) + cos(x)) ).
I tried
from sympy import *
x = symbols("x", real=True)
integrate(sin(...
0
votes
1
answer
64
views
How to define and compute the marginal densify function from the joint Gaussian distribution?
I try to numerically compute the marginal densify function from the joint Gaussian probability density function given a specific value in the joint density. I use dmvnorm from mvtnorm package:
library(...
0
votes
2
answers
64
views
different values when calculating definite integrals using python
One way of calculating definite integrals is using finite difference methods. I have two ways:
function1:
def function1(f, dx, a, b):
g=0
while a<b:
g=g + dx*f(a)
a=a + dx
...
1
vote
1
answer
99
views
Fast computation of 2D-convolution using "kernel" in fourier space
I want to numerically evaluate the following integral:
If the function f is given in discrete form on a grid, I want to be able to very efficiently compute the integral. The idea is to understand it ...
0
votes
1
answer
78
views
Can't make a Simpson rule algorithm working in C++: works for some functions and some numbers, but not for others. Tried multiple methods to no avail
I was trying to make a little c++ program that integrates using the Simpson rule, but while I was testing I found out that it only works for some functions and some intervals. For example it works for ...
2
votes
1
answer
153
views
Problems with a simple numerical integration in Python
I am trying to solve a simple integral in Python using different methods for numerical integration. However, when I try to calculate the integrals, I obtain wrong results for small values of my x ...
0
votes
2
answers
83
views
how to do integral in r
I have a data frame where each row represent a community with number of species and number of individuals:
n.species<- c(3,5,10,15,20)
n.indiv <- c(30, 40, 50, 100, 200, 300, 500, 750, 1000)
n....
0
votes
0
answers
129
views
Sympy does not calculate improper integrals with hermite polynomials
I am running a classic Quantum Harmonic Oscillator problem, and thus I need to find integrals containing Hermite polynomials. Unfortunately, sympy does not return a result for the integrals containing ...
0
votes
0
answers
92
views
I have been assigned to use the metropolis algorithm in order to solve numerically an integral. What am I doing wrong?
I have been trying to solve the following for a couple of days now, using the Metropolis algorithm:
This is taken from: https://arxiv.org/pdf/astro-ph/0505561.
I basically approximate A with the ...
0
votes
2
answers
151
views
Finding integral of (-1 * sin(2π/T * t))**(n+1) dt from zero to T/2
I have a problem with finding an integral of a function using Python sympy. I have tried the code below, but it prints the same expression as I had entered.
import sympy as sp
t, w, n = sp.symbols('t ...
0
votes
0
answers
123
views
Julia 2D integration
I am trying to integrate in Julia:
I have tried both QuadGK and Cubature with no success. This was my attempt with Cubature:
function h_10(K, i)
function integrand(x, v)
return f_X_opt(K, i, x) ...
2
votes
1
answer
44
views
Nonconformant arguments in Octave
So I got this exercise:
Using formula (18), implement the Gauss-Legendre method. The attached function [t, w] = gauleg(n) returns the node values ti and weights wi for the given polynomial degree n.
...