help-octave
[Top][All Lists]
Advanced

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

Re: complex line integral in octave


From: Stephen Montgomery-Smith
Subject: Re: complex line integral in octave
Date: Tue, 16 Apr 2013 12:14:26 -0500
User-agent: Mozilla/5.0 (X11; Linux i686; rv:17.0) Gecko/20130329 Thunderbird/17.0.5

Carlo's suggestion is definitely better than what I did.

When you are performing a complex integral over a line, I think you
should also pass the end points of the line as arguments to the
function, like the "a" and "b" I used in my code.

It might be possible that the quad command in octave is only capable of
doing real numbers.  According to "help quad", it is based upon quadpack
in fortran.  I did a google of "quadpack fortran".  It seems to be so
many pieces of code, but my impression is that it works with real values
rather than complex values.  In that case, you would have to split into
real and imaginary parts.

But if that is the case, then I think "help quad" should say this.


On 04/16/2013 10:12 AM, Urs Hackstein wrote:
> Dear Carlo,
> 
> thanks a lot for your suggestion which works well for the first edge of
> the rectangle. If I take the second edge, the function to integrate
> takes complex values and octave informs me that it will ignore the
> imaginary part. Have I thus to split up the integral into real resp.
> imaginary part after all while Stephen pointed out that this is not
> necessary? Or is there another routine than quad which allows to compute
> complex integrals directly?
> 
> 
> 2013/4/16 c. <address@hidden <mailto:address@hidden>>
> 
> 
>     On 16 Apr 2013, at 00:02, Stephen Montgomery-Smith
>     <address@hidden <mailto:address@hidden>> wrote:
> 
>     > This is a programming issue, not mathematics.  If you look at "help
>     > quad" you will see that the function takes only one parameter.  The
>     > other parameters, La,Lb,Lc,Ia,Ib,Ic,RC, will have to be passed in some
>     > other manner.  My suggestion would be to use global variables.
> 
>     the recommended way of doing this is by using a specialized anonymous
>     function rather than global variables, i.e. something like:
> 
>     function g1=complexfunction1(La,Lb,Lc,Ia,Ib,Ic,RC,t)
>      ...
>     endfunction
> 
> 
>     qaud (@(t) complexfunction1(La,Lb,Lc,Ia,Ib,Ic,RC,t), tmin, tmax)
> 
>     c.
> 
> 



reply via email to

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