Stven,
Point 1:
In reply to your question how to make a grid in Mathematica I have attached a simple Notebook example for you. The most important ingredient is the Table-function. That is THE way for making vectors or matrices or objects of even higher dimensionalities than matrices. If you've never used the Table-function before, I highly recommend you spend some time reading up on it in the Wolfram documentation. I find the Table-function an indispensible tool. I couldn't live a day without it (Mathematica-wise, that is).
In the attached Notebook I show you the following example. I make a grid in the (x,z)-plane. x goes from 0 to 2 and I take linear steps in the x-direction of 0.1. The z-coordinate is a bit more interesting. I wanted uneven spacings in the z-direction. Z goes from 1 to 2.8 but the spacing gets wider as z gets larger.
In the Notebook you'll see that I created an object called "gridff". If you pay good attention to the output you'll notice that there are multiple levels of brackets (like {...,...} ). In many situations this might turn out to be a pain in the butt. (Mathematica can be very picky sometimes). Usually (at least how I use these things mostly) you want all the (x,z) pairs inside the Table to be treated on an equal footing. If that is your aim, you have to add one additional line of code and that is the Flatten-command. (Again, if you have no idea what that is, do read up on it in the documentation. It is a most useful thing to know about.) After you "flatten" the original grid, you're left with only two levels of hierarchy within the Table: like this: { { }, { }, { }, { },.......{ } }. It is also always very useful to know how many XZ-pairs you generated. That's what the Length-command tells you.
Point 2:
You ask: Will the grid in Mathematica be able to store an equation? The answer is: once you have a grid, you can then use it to define a function on each grid point that you generated. I also illustrate how to do this in the Notebook. I define (external to the Table) a simple function f(x,z) = x^2+z^2. Then I show inside a new Table command how one-by-one I extract every (x,z)-pair in grid, calculate f for that pair and add it as a third member to the list {x,z,f}. I hope the principle is clear.
Point 3:
You ask how to define functions in Mathematica. There are many ways of doing this, but the way that is shown in my Notebook is one of the most common ways. Once you have defined your function you should be able to integrate it over the domain on which it is defined, using e.g. the function NIntegrate (the prefix N indicates that it is a numerical integration procedure). I have done that for the simple example in my note book; scroll down in the Notebook to find the command and the result.
I hope this is useful.
Good luck,
René
Attachments: