Post Reply 
Help for a "Surface and Flux integrals" program
11-03-2017, 10:26 PM
Post: #2
RE: Help for a "Surface and Flux integrals" program
Perhaps you can use this:
Code:
#cas
sfint(w):=
BEGIN

local f:=w[1];
local g:=w[2];
local uvals:=w[3];
local vvals:=w[4];
local gg;
IF TYPE(w)≠4 THEN 
PRINT("Help");
PRINT("Usage:sfint('f(x,y,z)',[φ1(u,v),φ2(u,v),φ3(u,v)],[ulow,uhigh],[vlow,vhigh])")
PRINT("f can be a vector, too, i.e.:['x*y*z','x+y','x^2+z^3']");
return 0;
END;
f:=subst(f,[x,y,z]=g);
gg:=transpose(grad(g,[u,v]));
gg:=cross(col(gg,1),col(gg,2));
IF type(f)==DOM_LIST THEN
f:=DOT(f,gg);
ELSE
f:=f*ABS(gg);
END;
f:=int(f,u,uvals[1],uvals[2])
  return int(f,v,vvals[1],vvals[2]);
END;
#end
I tried it with : sfint({'x*y*z',[u+v,u-v,2*u-3*v],[1,2],[3,4]})
and: sfint({'x*y*z',[u+v,u-v,2*u-3*v],[1,2],[3,4]})
both seem to provide correct results, must do that by hand to check.
If you need help you may enter for the param w what you want instead of a list.
Arno
Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
RE: Help for a "Surface and Flux integrals" program - Arno K - 11-03-2017 10:26 PM



User(s) browsing this thread: 3 Guest(s)