hi Han,
a little idea, following your precious advice (and thanks Snorre for a "C like" approach that's I like), to start; but these functions need some controls to avoid incorrect input and reset...
We can use two little programs:
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...
EDIT: these programs now works with 2 or 3 components (parametric expression: [r(t), r(t), r(t)] or [r(t), r(t)])...
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