It is an arithmetical rule for estimating the area under a curve where the values of an odd number of ordinates, including those at each end, are known.
Questions tagged [simpsons-rule]
63 questions
0
votes
1 answer
Numpy product of a vector and it's transpose
I have a N x N complex NumPy array U_0 and I have to do manipulation with it :
First, how can I increase the array with zero efficiently ? I can simply copy it into an np.zeros((2N-1, 2N-1)) but maybe you guys know a better method. Thanks to…

Apo
- 338
- 1
- 9
0
votes
1 answer
Error Simpson's rule for polynomial not equal to 0
I implemented Simpson's rule in Python and tested the error for a cubic polynomial. The error bound of Simpson's rule states that it should be equal to 0, but it is not. Does anybody know why?
def simps(f,a,b,N=50):
if N % 2 == 1:
raise…

Neri
- 101
- 1
0
votes
1 answer
Double integral Simpsons rule in python where the limits are functions
I have created a function where it can solve double integrals using the Simpsons rule but it only works when the limits of integration are constants
def double_integration(a,b,y1,y2,f,n):
### First, check that the number of strips is even.
…

Jordan_Mclean1
- 1
- 1
0
votes
1 answer
Integrating data from txt file in python
I have three columns of data (time (t), Thrust (T), distance (s)) from which I would like to calculate the work performed. The text (logdata.txt) file containing the data is structured as follows:
time, thrust, distance
1 2405 501
2 2500 702
3 2500…

thereiswaldo
- 87
- 1
- 8
0
votes
0 answers
error when i declare my simpson rule function, variable not used?
keep getting an error line 43, assignment to simpson not supported. variable has the same name as a local function.
Did i code this correctly if anyone on here is familiar with matlab/simpsons rule? line 43 is mu function line..
a=input("Enter…

Trace Sheets
- 31
- 2
0
votes
0 answers
Lambda functions maximum recursion depth exceeded
I was trying to create a function that solves multiple integrals using Simpson's method and my idea was to integrate out variables one by one until I'm left with a single integral but I'm getting recursion depth exceeded and I'm unable to figure out…

Akshat Sharma
- 121
- 4
0
votes
0 answers
Integrating between two function with simpson rule
I have a numerical problem. I need to calculate the integral between two functions f1 and f2. I already have the simpson rule for one function. I need help how to find the intercepts between the two function and calculate the integral.
F0 =…

Or Meiri
- 1
- 1
0
votes
0 answers
Numeric Integral Using Simpsons 3/8 rule in Matlab
I am trying to solve a numeric integral using Simpsons 3/8 rule in Matlab but I am getting an error which I don't understand.
The numeric integral is given in the picture (Equation 26)
Also this is the Matlab code:
clc;
clear all;
be = 1.5;
gam =…

Jalil Ahmad
- 101
- 1
0
votes
1 answer
Is it possible to parallelize this program (Simpson's Rule) in Python?
I am new to the parallelizing paradigm. I already have the algorithm working in its serial form but I can't parallelize it.
I have asked around and some have told me that the way my program is written can't be parallelized.
Here is my serial code,…

LAMC_ISDR
- 25
- 2
0
votes
0 answers
"unexpected EOF while parsing"
I'm trying to implement this part of code.
The error "unexpected EOF while parsing" occurs in the last line. I tried various things but can't seem to find what is wrong (T^T)
def simpsonsumme(f, a, b, N):
X = np.linspace(a, b, N)
if N%2 ==…

Venzke
- 11
- 2
0
votes
1 answer
integrating an array using np trapz
I have been using np.trapz for integration over arrays for a while and have not had any problems with it, until now. I have obtained a distribution which clearly has an area of less than 1, because its maxima are 0.16 and the width of the…

George
- 232
- 1
- 2
- 20
0
votes
1 answer
Why Simpson's rule of integration rewritten in Python giving a different result?
The following source codes are the implementation of Simpson's rule of Integration.
C# source code.
using System;
public class Simpson
{
private double Function(double x)
{
return 1.0 / (1.0 + Math.Pow(x, 5)); //Define the function…

user366312
- 16,949
- 65
- 235
- 452
0
votes
1 answer
Using Simpson's Rule in Python
I'm trying to get an array from an f(x) function this way:
array=list()
for i in range(x):
parameter= z+(i*change)
array=f(parameter)
Note that x is an integer, z and change are floats established in my code.
The next thing I want is to…

STEMQs
- 75
- 1
- 10
0
votes
0 answers
How to iterate for loop over epsilon=1e-8 to implement Simpson's integrator
I have implemented the following logic and had asked this question for a different question (array range). I'm getting output but it is not going through for loop for the iteration because I have given frange(start, stop, range)…

Mayur Potdar
- 451
- 1
- 8
- 18
0
votes
0 answers
Simpson's Method Adaptive Implementation using epsilon = 1e-8 and only one iteration is completing
I have tried to implement this question in my logic to calculate Simpson's Method Adaptive Implementation using epsilon = 1e-8. Following is the explanation:
"""The approximate definite integral of function from a to b using Simpson's method.
This…

Mayur Potdar
- 451
- 1
- 8
- 18