[Scilab-users] Line integrals

Stéphane Mottelet stephane.mottelet at utc.fr
Tue Feb 25 12:25:13 CET 2020


Hello,

You can use intg, once you have forged the correct function of the 
parameter:

function  out=parabola(t)
     out  =  [t/2;t^2];
endfunction

function  out=my_f(M)
     out  =  2*M(1);
endfunction

function  out=line_int(a, b, curve, f)
     function  out=fun(t, f, curve)
         dcurve  =  imag(curve(t+%eps*%i))/%eps;
         out  =  f(curve(t))*norm(dcurve)
      end
      out  =  intg(a,b,list(fun,f,curve))
endfunction

--> line_int(0,6,parabola,my_f)
  ans  =

    144.36474604669

The derivative of the curve w.r.t. the parameter is computed by using 
the complex step.

S.

Le 25/02/2020 à 10:35, arctica1963 a écrit :
> Hello all,
>
> I am interested in doing line integrals on f(x,y) and f(x,y,z) for scalar
> and vector calculations.
>
> It is not an issue to do mathematically, but not so clear in Scilab how
> variable substitution should work in this process. As I understand it, one
> has to take the function and convert it to a parametric form in x,y,(z) in
> order to reduce the integrand to a single variable (e.g. t) that can be
> integrated simply.
>
> Now, clearly it is not a problem to do the substitutions by hand and then
> run the Scilab function (Integrate), but nice to simplify the procedure.
>
> For the integral over a path (C) of f(x,y) ds, x and y have to be parametric
> e.g. x(t) and y(t),
> where ds = sqrt( (dx(t)/dt)^2 + (dy(t)/dt)^2 ) dt
>
> Is there a simple route to solve line integrals in Scilab or building a
> function to do this?
> e.g. LineIntegral(expr,x(t),y(t),t,a,b), where x(t) and y(t) are the
> parametric forms.
>
> A very simple problem:
>
> f(x,y) = 2*x with x(t)=t/2 and y(t)=t^2 for t=0 to 6
> Substitution for x and y and solving the integral over t should result in
> 144.36 approx.
>
> Any pointers would be useful. Could not see any reference in the mailing
> list or help on this.
>
> Thanks
> Lester
>
>
>
> --
> Sent from: https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/mailinglists.scilab.org/Scilab-users-Mailing-Lists-Archives-f2602246.html
> _______________________________________________
> users mailing list
> users at lists.scilab.org
> https://antispam.utc.fr/proxy/1/c3RlcGhhbmUubW90dGVsZXRAdXRjLmZy/lists.scilab.org/mailman/listinfo/users

-- 
Stéphane Mottelet
Ingénieur de recherche
EA 4297 Transformations Intégrées de la Matière Renouvelable
Département Génie des Procédés Industriels
Sorbonne Universités - Université de Technologie de Compiègne
CS 60319, 60203 Compiègne cedex
Tel : +33(0)344234688
http://www.utc.fr/~mottelet

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.scilab.org/pipermail/users/attachments/20200225/a386feb0/attachment.htm>


More information about the users mailing list