Quad is a scipy package which is used for 1D integration in Python
Questions tagged [quad]
135 questions
1
vote
3 answers
multiply Python Quad integration by float
Hello I'm quite new to python and I'm trying to work through a set of equations. I'm trying to multiple the result of the quad integration by a float my code is:
from __future__ import division
import scipy.special as sp
from scipy import…

user3191569
- 485
- 1
- 7
- 24
1
vote
1 answer
quad function to work in a loop without calling to file
I need to use the quad method to integrate in a loop. I cant create and external file and call to it because the variables in the integration equation keep changing with the loop, so I cut the loop for the purpose of making is simple. It's giving me…

user3068699
- 25
- 4
1
vote
1 answer
How to integrate a signal in Python
I have to integrate a signal in a range that I decide.
I have used this method:
def integrand(x,y):
return y[x]
result=scipy.integrate.quad(integrand,t0,t1,args=(y))*0.2E-6
y is an array of 2500 points in 500microsec. For example t0 is 700 and…

user2046107
- 19
- 2
- 3
0
votes
1 answer
Openmesh faces on the same plane
I am playing with Python Openmesh. If I have a quad it will be split into triangles. When drawing on the screen I want to draw as a quad. Is there an easy was to check an edge and see if the normals of the two triangles are parallel? I assume dot…

iain
- 33
- 7
0
votes
1 answer
How do I integrate a nearly Dirac-delta-like function with scipy.integrate.quad?
I want to integrate a function from 0 to +inf, figured as below.
It goes to 0 rapidly outside a small interval centered at x=1. The positions of the two maxima are unknown. The positions of the minima is known.

Watheophy
- 119
- 3
0
votes
0 answers
How to solve the roundoff error problem in scipy.integrate.quad on specific integrand?
I'm doing the following numerical calculation.
import numpy as np
from scipy.integrate import quad
def E_k(gap, q, mu):
return np.sqrt(abs(gap) * abs(gap) + (q * q - mu) * (q * q - mu))
quad(lambda q: q * q * (1 - (q * q - mu) / E_k(gap, q,…

Watheophy
- 119
- 3
0
votes
1 answer
Integrating with python's quad function over multiple values using vectors (instead of for loops) with changing bounds
I have a problem which in principle can be illustrated with the following example:
a,b and c are constants. f(x) generates my integrand.
def f(x,a,b,c):
return (ax**2+bx+c)
I want to compute this integral from some lower limit to a fixed upper…

No_Diary_No_Gluten
- 19
- 4
0
votes
1 answer
The lambda function does not work with the scipy integral in python
I have the code structure below.
import numpy as np
from scipy import integrate
t = np.linspace(0, .85, 5)
s = np.ones_like(t)
f = lambda t, s: t - s
Int = integrate.quad(f, 1, 2)
Int
Even if I change the s and the bounds in (f, 1, 2), I received…

Nurdan
- 9
- 4
0
votes
1 answer
ZeroDivisionError: float division by zero; python scipy quad
I am writing a program that use integrals. I tried Sympy, but it was too slow, so I switched to SciPy integrate and it's improve my script so much, but I encountered one problem:
In general, it like this:
from scipy.integrate import quad
import…
0
votes
1 answer
modifying triangles and vertices on react-three-fiber mesh after render
I'm trying to recreate some old Unity QuadSphere code with a @react-three/fiber version, and I've written a quick test that creates a custom class, QuadGeometry extending from THREE.BufferGeometry in which I generate my vertices and indices. The…

bicarbon8
- 198
- 1
- 10
0
votes
0 answers
Why quad integration in for loop gives such an error
Here in my code, I need to use quad to compute J-ij and Jp_ij as following:
import numpy as np
from scipy.integrate import quad
xData = {'xCa': np.array([0.08177462, 0.07454374, 0.06799069, 0.0612067 , 0.05375614,
0.04635545, 0.03826685,…

user19396094
- 15
- 4
0
votes
0 answers
How can i write this complex integrals in python? it contains functions of functions
I am trying to write some integrals that contain functions of functions in python:
below is the code in python. i decided to break the problem into parts and integrate separately to simplify things. it returns error:
m2=quad(lambda h:fh(h), 0,…

Toye Aribisala
- 1
- 1
0
votes
0 answers
Double integration on an array multiplication
In my project, the integrand is a sophisticated multiplication of arrays. I should perform a double integration on this integrand. A very simplified version of my problem can be expressed as follows:
def func(x,y):
a = np.array([[x**2+2*y,…

Sadjad Abedi
- 31
- 6
0
votes
0 answers
Is there a method in python to numerically integrate data within curve_fit?
Cannot use quad integration with data array. The code only runs when I substitute a number for the lower limit (0.5076 in the code supplied), the parameters returned are unrealistic and the estimated function "avoids" the data. When I use x or data…

Mike Smith
- 1
- 2
0
votes
1 answer
Solve integral in an annular domain in Python
I am trying to solve a function in an annular domain that has a change of phase with respect to the angular direction of the annulus.
My attempt to solve it is the following:
import numpy as np
from scipy import integrate
def f(x0, y0):
r…

Monosgaitnas
- 27
- 4