| Author |
Comment/Response |
Eric Harley
|
10/12/05 09:57am
If I understand what you want, take a look at what this does:
Clear[f, a, b, i, j];
A = Table[{i, j}, {j, 1, 3}, {i, 1, 10}]
A // TraditionalForm
f[a_, b_] := a + b;
B = Table[f[i, j], {j, 1, 3}, {i, 1, 10}]
B // TraditionalForm
Hopefully that should be relatively self-explanatory. You can do a lot of things when you get comfortable with list manipulation in Mathematica, and you can basically view a matrix as a nested list.
You can look up Table, List, //, and TraditionalForm in the help to get a better understanding of what is going on here.
Note that a ; at the end of a line suppresses output. Leaving the ; off allows output to be generated.
You can use lines like
f[a_, b_] := a + b;
to define functions. The underbars have to be there in the function definition for the definition to apply to any arguments you stick into f[,]. The : on the := is probably safest to keep there in function definitions if you don't understand what it does, although depending on what you're doing it might slow things down some. Also, the := has the side effect that you don't really need a ; to suppress output from this line.
URL: , |
|