Comments (7)
No, unfortunately, Julia doesn't have arrow types.
from cubature.jl.
I don't want a whole other set of cubature
functions. I guess we could have a wrapper
complexfunc(f) = (x,v) -> let c = f(x); v[1] = real(c); v[2] = imag(c); end
vec2complex(v) = Complex(v[1],v[2])
So that they you could do e.g. vec2complex(hquadrature(2, complexfunc(f), ...)[1])
.
from cubature.jl.
I suppose there is no way to do a clever dispatch based on what f
returns (or even the type of arguments it takes).
from cubature.jl.
That's very neat, I have never seen the concept expressed like that, thank you. Also on an off topic note, I must thank you for your online maths resources, which I have found useful on several occasions (namely your PML tutorial and differentiation by FFT).
from cubature.jl.
Here's a slight generalisation of the wrapper which also allows for complex intervals of integration:
complexfunc(f) = (x,v) -> let c = f(x); v[1] = real(c); v[2] = imag(c); end;
vec2complex(v) = Complex(v[1],v[2]);
hquadratureCOMPLEX(f,a,b) = vec2complex(hquadrature(2, complexfunc(t -> f(a+t*(b-a))*(b-a)),0,1,abstol=1e-8)[1]);
It must be possible to improve this so that the named argument abstol
can be passed to hquadratureCOMPLEX
rather than set in the wrapper itself, but I'm new to Julia. I'll update if I figure it out.
from cubature.jl.
Ultimately, the right way to solve this is to rewrite in pure Julia.
from cubature.jl.
See https://github.com/stevengj/HCubature.jl for a pure-Julia re-implementation of hcubature
that handles complex integrands, etc.
from cubature.jl.
Related Issues (20)
- Pkg.build failing on 0.6.0 HOT 1
- Example of bivariate integration over semi-infinite domain HOT 2
- h-adaptive algorithm only evaluates the integrand at the interior of the domain? HOT 3
- hquadrature hangs for function that integrates to zero (unless abstol is set) HOT 2
- hcubature does not converge on discontinuous functions HOT 14
- Improper integration problem. HOT 1
- Sorry... post to the wrong repository.. plz ignore~
- New updates to Julia 1.0.0 HOT 5
- Suggest a example, which is easy to understand, of function 'hcubature'.
- Suggest a simple example of change of variables. HOT 2
- Possible error on 1.1
- Use the cubature_jll artifact HOT 1
- Move package to JuliaMath HOT 2
- Error: Error building `Cubature` HOT 2
- hquadrature and pquadrature do not match for a simple 1d example HOT 2
- a better notation in the README
- Access to number of function evaluations HOT 3
- how to cite when using this package? HOT 1
- Unable to automatically install 'Cubature'
- Very slow for one-dimensional integral HOT 3
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from cubature.jl.