Skip to content

Julia functions for Simpson's rule and trapezoidal rule analogous to scipy.integrate

License

Notifications You must be signed in to change notification settings

jishnub/NumericallyIntegrateArrays.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

20 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

NumericallyIntegrateArrays.jl

Build Status

Julia functions for Simpson's rule and trapezoidal rule analogous to scipy.integrate

Installation

Install the package using

julia> ]
pkg> add https://github.com/jishnub/NumericallyIntegrateArrays.jl.git

Usage

The package exports the functions trapz and simps that perform integration using the trapezoidal rule and Simpson's rule respectively.

julia> x = range(0,π,length=10);

julia> f = sin.(x);

julia> trapz(f,x)
1.9796508112164835

julia> simps(f,x)
1.9995487365804028

Multidimensional arrays work as well, where the integration is over the first axis.

julia> f2 = sin.(x) * cos.(x)';

julia> hcat( simps(f2,x), 2cos.(x) ) # the second column is the expected result
10×2 Array{Float64,2}:
  1.99955    2.0
  1.87896    1.87939
  1.53174    1.53209
  0.999774   1.0
  0.347218   0.347296
 -0.347218  -0.347296
 -0.999774  -1.0
 -1.53174   -1.53209
 -1.87896   -1.87939
 -1.99955   -2.0

About

Julia functions for Simpson's rule and trapezoidal rule analogous to scipy.integrate

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Languages