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.
I assume you already looked in Help and found your answers. And I’m unsure what your Guass function is (what book what equation) (there must be many guass equations).
I do know in the old Mathematica book it could be hard to find the right section in Help (if one looked up Function one got a lesson on that keyword). However in the new Help there are tutorial related guides and suggested other readings: I assume you’ve already found your answer.
where the last expr evaluated is the return value (Return[value] can be used). I used Block because
n=fun[x_]:=x+1;
does not include any facility for “local variables” which you may be used to (it actually DOES but that’s a lesson on Context[]).
Delayed assignment (value is evaluated each time variable as a value appears)
{detjacobs, Invdetjacobs} := Gauss …
Now note aar_Integer - it says this function is ignored if Guass is called with something other than. There can be many Guass each matching certain variable types or even certain patterned expressions.
Thanks Mr. John. This time I uploaded the notebook file. Kindly look into it. I have so many local variables. Will “Block” and" Return" commands consume more time? Actually, I am trying to write a time-efficient program.So, I thought of using this function in between to minimize time.
In Matlab, there is room to define local variables while maintaining time efficiency. How to doit in mathematica?