help-octave
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Why is there no function for complex integrals?


From: Brett Green
Subject: Why is there no function for complex integrals?
Date: Fri, 19 Jun 2020 13:58:34 -0400

I needed to evaluate a complex integral, but Octave only handles real integrals, so I wrote a very simple function to split a complex function into its real and imaginary parts to be integrated separately.

function cmplx_int_val = complex_integral(cmplx_fx_handle,lowerlim,upperlim)
fx_re = @(x) real(cmplx_fx_handle(x));
fx_im = @(x) imag(cmplx_fx_handle(x));
int_val_re = integral(fx_re,lowerlim,upperlim);
int_val_im = integral(fx_im,lowerlim,upperlim);
cmplx_int_val = int_val_re + i*int_val_im;
end

There is nothing novel about this, which is why I'm surprised I didn't read in the documentation about an existing function that serves the same purpose. Is there some subtle numerical reason why writing a complex integral this way may be a bad idea and produce unreliable results, or something like that?

- Brett Green

reply via email to

[Prev in Thread] Current Thread [Next in Thread]