Elliptic integral

JensSimon j.s.strom at hslmg.de
Fri Sep 10 00:56:47 CEST 2010


 <Peter.Cusack at ...> writes:

> 
> Hi all.
> 
> I'm writing some code to simulate a magnetic field. It uses elliptic integrals
of the first and second kind.
> The elliptic integral of the second kind is not part of the Scilab function
list, so I created one as shown below....

> Variable returned by scilab argument function is incorrect.
> 
> at line       2 of function elliptic_ec called by :  
> at line       2 of function Bx called by :  
> at line       2 of function Bxt called by :  
> Bcentre=Bxt(0,0) //*Field at centre of winding*/
> 
> I'm looking for help to get past this. If the variable is incorrect, what
should it be and how can I correct it?
> 
> If, as I suspect, the error is what's left after a failed computation, can
someone point me to a more reliable
> method to calculate the elliptic integral?
> 
> Cheers;
> 
> Peter...
> 
------------------------------------------------------------------------ 
Hi Peter, 
You probably got the error message for arguments >1. In this case the sqrt
returns an imaginary number, which cannot be handled by intg. For arguments <=1
your function works  properly. However, I did not check if your code realizes
the integral you intend to calculate correctly.
Cheers, Jens





More information about the users mailing list