Quad is a scipy package which is used for 1D integration in Python
Questions tagged [quad]
135 questions
0
votes
1 answer
Opengl : Can we still use GL_QUADS?
I am loading models from obj, colladae files where individual faces of the mesh are not triangulated if all the faces are perfect quads when exporting to save memory.
Now I know this won't work for most models but for some meshes say a cube where…

Sync it
- 1,180
- 2
- 11
- 29
0
votes
1 answer
How to intentionally crash Python code which has error print-outs ("IntegrationWarning")
I have a python script, which under some parameter space, prints out an error:
IntegrationWarning: The occurrence of round-off error is detected, which prevents the requested tolerance from being achieved. The error may be…

Canada709
- 41
- 8
0
votes
0 answers
Ways to improve computational efficiency in computing integrals using scipy Python
A bit of background: I am working on a project for university. Right now, I need to create shear force diagram. This is done by integrating the loads that are acting along the beam of interest. This is all well and good, and it is pretty straight…
0
votes
0 answers
Quad integrate function gives me some unexpected zeros?
I'm integrating a log-normal function and I'm encountering some unexpected zeros, so why?
My code is:
from numpy import pi, log, exp
import scipy.integrate
# My function (a log-normal function)
def Fbloqueo(Xb, wXb, Xbmed):
return (
1…

Charlie Vargas Sarmiento
- 15
- 1
- 8
0
votes
2 answers
quadpy IntegrationError: Tolerances (abs: 1.49e-08, rel: 1.49e-08) could not be reached with the given max_num_subintervals (= 50)
I am using quadpy to integrate a function in python.
Function
import numpy as np
T = 2*np.pi
def ex1(t):
return np.where(np.logical_and((t%T>=0), (t%T

charelf
- 3,103
- 4
- 29
- 51
0
votes
1 answer
Why does my defined function not accept an array as an input?
I am working with a double integral, and the inner integral has variable bounds. I wrote a function, using SciPy's quad integration, that allows me to evaluate this integral. However, what I want is to just evaluate the inner integral, so that all I…

physicsiscool
- 5
- 2
0
votes
0 answers
Least squares with quad and variable boundary
For my master's thesis I'm trying to implement a code that evaluates measured data of time and temperature and then calculates variables with the least-squares method. The problem is Python doesn't seem to change the variables in the integral…

BagpipeWayne
- 9
- 2
0
votes
1 answer
Probelm with Scipy.quad
I have been trying to work our my project using a Python code which needs integration within a sigma.
I get the following error and despite trying several ways, I was not able to solve it. Below you can find a shorter version of my code for error…

Ali Wali
- 179
- 2
- 8
0
votes
1 answer
Invalid Syntax error in python, what is the proper way to write f(x)= 6x*(1-x)?
So i'm very new to Python and i'm not used to the syntax yet. This is probably a simple problem but then again, i'm new so I don't know what is the proper way to write this. I'm supposed to integrate f(x)= 6x*(1-x) with intervals [0,1] but I get a…

aj_23
- 11
0
votes
2 answers
(How) Can Scipy integrate functions with array valued arguments efficiently (without loops)?
I want to integrate a function that takes array arguments using an efficient (vectorised/parallelised) method.
I can get the desired output using unwanted loops in the code as in the following (reduced complexity) example:
import numpy as np
from…

Mike
- 21
- 8
0
votes
2 answers
Parallelize calculation of matrix elements using scipy.integrate.quad
I have to evaluate every element of a matrix using a function with a numerical integral (scipy.integrate.quad). The elements of the matrix are pixels of a 5202x3465 gray image.
I have access to a GPU and I would like to evaluate as many elements as…

elena faillace
- 35
- 6
0
votes
2 answers
How to use `scipy.integrate.quad` to compute integral of a function which depends on the integral of another function
Any help to compute this integration, F function is defined using the f function which involves the first integration, finally, integrate F.
from scipy.integrate import quad
f = lambda x,a : a**2*x
def F(s,a):
return…

mathfun
- 101
- 7
0
votes
1 answer
Using the numpy.random.exponential to draw 10,000,000 samples of X to estimate the expected value of a payout
Assume the dollar amount of damage involved in an automobile accident is an exponential random variable with a mean of 1000. Of this, the insurance company only pays the amount exceeding the deductible of 400. If X is a random variable representing…

Adam
- 85
- 12
0
votes
2 answers
Speed up scipy quad integration (skip check_bounds and _asarray_validated?)
I am calling scipy.integrate.quad about 500 times for different integrations (x and y values).
This takes a total of 46 seconds.
However, 19 seconds is used by _evaluate._check_bounds alone and _prepare_x._asarray_validated takes up another 11…

torpedo
- 283
- 2
- 15
0
votes
2 answers
how to fix "only length-1 arrays can be converted to Python scalars" when getting integral with an array argument
I am using quad from scipy.integrate to get an integral in a limited range from an object. suppose the target object is in the blow:
∫expm(A*X).expm(B*X)dx
which both A and B are numpy matrix.
To solve this I have used blow code:
from…

samie
- 169
- 15