Line integral and curvilinear integral

+- HP Forums (http://www.hpmuseum.org/forum)
+-- Forum: HP Software Libraries (/forum-10.html)
+--- Forum: HP Prime Software Library (/forum-15.html)
+--- Thread: Line integral and curvilinear integral (/thread-3851.html)



Line integral and curvilinear integral - salvomic - 05-15-2015 03:17 PM

hi all,
here there are two little programs (CAS) to cal Line integral (vectorial functions) and Curvilinear Integral (scalar function).


intcur: to input scalar function (x,y,z), parametric form of a curve [r(t), r(t), r(t)], lower and high bound to get a curvilinear integral
intlin: to input vectorial function, parametric form of a curve, lower, high to get line integral...

These programs works with 2 or 3 components (parametric expression: [r(t), r(t), r(t)] or [r(t), r(t)])...

Enjoy!

Salvo Micciché

Code:

#cas
intcur(args):=
BEGIN
local argv,argc, a, b;
local f, r, dr, ft, s;

argv:=[args];
argc:=size(argv);
IF argc !=4 THEN
return "Input:f(x,y,z), [r(t),r(t),r(t)] ,low, high"; 
 ELSE
f:=argv(1);
r:=argv(2);
a:=argv(3);
b:=argv(4);
dr:=diff(r,t);
s:= size(argv(2));
ft:= IFTE( s==3, subst(f,[x,y,z]=r), subst(f,[x,y]=r) );
return int(dot(ft,l2norm(dr)),t,a,b);
END;

END;
#end

...
Code:

#cas
intlin(args):=
BEGIN
local argv, argc, a, b;
local f, r, dr, ft,s;

argv:=[args];
argc:=size(argv);
IF argc !=4 THEN
return "Input:[x,y,z], [r(t),r(t),r(t)] ,low, high"; 
 ELSE
f:=argv(1);
r:=argv(2);
a:=argv(3);
b:=argv(4);
dr:=diff(r,t);
s:= size(argv(2));
ft:= IFTE( s==3, subst(f,[x,y,z]=r), subst(f,[x,y]=r) );
return int(dot(ft,dr),t,a,b);
END;

END;
#end