Post Reply 
Jacobian of a Matrix
05-15-2015, 08:20 PM
Post: #1
Jacobian of a Matrix
hi all,
here there is a CAS program to calc the Jacobian of a Matrix.

Input: [f(1), f(2), ...], [x,y,...]

Enjoy!

Salvo Micciché

Code:

#cas
jacob(args):=
// Jacobian Matrix by Salvo Micciché
// input vectorial expression, vector of variables
BEGIN
local argv, argc, mat, f, var, fn, j, k,  gr, vd;
argv:=[args];
argc:=size(argv);
IF argc !=2 THEN
return "Input:[f1(x),f1(y),f1(z)...], [x,y,z,...]"; 
ELSE
f:=argv(1);
var:=argv(2);
fn:=size(f);
vd:=size(var);
mat:=makemat(0,fn,vd);
FOR j FROM 1 TO fn DO // gradients
gr:=grad(f(j),var);
FOR k FROM 1 TO vd DO // items
mat[j,k]:=gr(k);
END; // for k
END; // for j
return mat;
END; // if-else

END;
#end

∫aL√0mic (IT9CLU), HP Prime 50g 41CX 71b 42s 12C 15C - DM42 WP34s :: Prime Soft. Lib
Visit this user's website Find all posts by this user
Quote this message in a reply
Post Reply 


Messages In This Thread
Jacobian of a Matrix - salvomic - 05-15-2015 08:20 PM
RE: Jacobian of a Matrix - Rudi - 03-25-2017, 02:51 PM
RE: Jacobian of a Matrix - Han - 03-25-2017, 03:23 PM
RE: Jacobian of a Matrix - Rudi - 03-26-2017, 11:36 AM
RE: Jacobian of a Matrix - sitomix - 04-09-2018, 12:49 PM
RE: Jacobian of a Matrix - salvomic - 04-09-2018, 03:00 PM
RE: Jacobian of a Matrix - Arno K - 04-15-2018, 10:38 PM
RE: Jacobian of a Matrix - Arno K - 04-09-2018, 10:16 PM



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