Help for a "Surface and Flux integrals" program
11-06-2017, 04:37 PM
Post: #32
 salvomic Senior Member Posts: 1,366 Joined: Jan 2015
RE: Help for a "Surface and Flux integrals" program
(11-04-2017 11:39 AM)Arno K Wrote:  I think the help can be implemented in the comments, then the list can be omitted. As the program works like it shall I will add some comments and then put it in the software forum.
Arno

Arno,
as we have privately discussed, to avoid problems with the exportation of u and v vars in CAS variables, in the code it would be better to insert u,v in the local statement and then the two lines purge(u); and purge(v).
The code would be this:
Code:
 #cas sfint(f,g,uvals,vvals):= BEGIN local gg, u, v; purge(u); purge(v); //  Help; //  Usage:sfint(f(x,y,z),[φ1(u,v),φ2(u,v),φ3(u,v)],[ulow,uhigh],[vlow,vhigh]) //  f can be a vector, too, i.e.:[x*y*z,x+y,x^2+z^3] f:=subst(f,[x,y,z]=g);// perform the substitution in f gg:=transpose(grad(g,[u,v]));//compute the jacobian gg:=cross(col(gg,1),col(gg,2)); IF type(f)==DOM_LIST THEN// in case a vector-function is entered f:=DOT(f,gg); ELSE f:=f*ABS(gg);//f is a scalar END; f:=int(f,u,uvals[1],uvals[2])   return int(f,v,vvals[1],vvals[2]);//return the double integral END; #end