I want to write a 'Gauss' function in my main program like the way its written in Matlab. In the following example I want to pass the variables ('aar' & 'es' are matrices and other are scalars) "aar, es, x1value, x2value, x3value, x4value, y1value, y2value, y3value, y4value" like given below. I want the output to store in detjacobs & Invdetjacobs. Kindly suggest me the correct way.
[detjacobs, Invdetjacobs] = Gauss[aar, es, x1value, x2value, x3value, x4value, y1value, y2value, y3value, y4value]
Do[
Do[
r = aar[[i]]; s = es[[j]];
shape1 = ((1. - r) (1. - s))/4.; shape2 = ((1. + r) (1. - s))/4.; shape3 = ((1. + r) (1. + s))/4.; shape4 = ((1. - r) (1. + s))/4.; dhdr1 = 1./4. (-1. + s); dhdr2 = (1. - s)/4.; dhdr3 = 1./4. (1. + s); dhdr4 = -(1. + s)/4.; dhds1 = 1./4. (-1. + r); dhds2 = 1./4. (-1. - r); dhds3 = (1. + r)/4.; dhds4 = (1. - r)/4.;
detjacobs = {{dhdr1 x1value + dhdr2 x2value + dhdr3 x3value +
dhdr4 x4value,
dhdr1 y1value + dhdr2 y2value + dhdr3 y3value +
dhdr4 y4value}, {dhds1 x1value + dhds2 x2value + dhds3 x3value +
dhds4 x4value,
dhds1 y1value + dhds2 y2value + dhds3 y3value + dhds4 y4value}};
Invdetjacobs = 1/detjacobs;
,{j,1,4}];
,{i,1,4}];
Attachments: