-
Notifications
You must be signed in to change notification settings - Fork 21
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Integrating complex functions #21
Comments
I don't want a whole other set of 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. |
I suppose there is no way to do a clever dispatch based on what |
No, unfortunately, Julia doesn't have arrow types. |
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). |
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 |
Ultimately, the right way to solve this is to rewrite in pure Julia. |
See https://github.com/stevengj/HCubature.jl for a pure-Julia re-implementation of |
In the README you recommend integrating complex functions as vectors with PAIRED error. Would you be averse to having a simple Julia wrapper which accepts functions which return complex values? As in does it go against the library philosophy or is it a matter of time? If it is the latter I would be happy to contribute.
The text was updated successfully, but these errors were encountered: