I'm trying to write a program that calculates the probability distribution for different initial conditions of a population model. The probability is calculated over a for loop over the parameter 'q' (which can be considered as a scaled version of the correcting "struggle for life" term in the Malthus model).
The program includes methods for normalising the resulting probability distributions, and to test if they are working the program (in a seperate source file) performs a numerical integration (according to a Gauss-Laguerre method which basically picks out a number of, say 8, particular values of q and assigns them weights).
where pst is the probability for a particular value of q.
In the main source file, I put the function header as:
double norm(double, double);
Is that correct?
Also I call the function within the for loop:
for (double y =0.001; y<30.00; y+=0.001)
{
double pst = n*pow(y,n1)*exp(-y);
double q[] = norm(pst, y);
}
The idea being that for the 8 values of 'q' corresponding to those needed by the Gauss-Laguerre method, the norm function will return a number which I want to store in an array of 8 in the program.
The main problem is the error:
error C2064: term does not evaluate to a function taking 2 arguments
The second problem is that I don't want the array to be overwritten each time the function finds a matching value of 'q'...any ideas on how to store matches within the for loop?
It doesn't matter whether I need to declare the array size or not as there are always 8 matches.
Right...think that's it. I know this is relatively simple from a programming point of view, so I am posting this in the beginners forum. Any help would be much appreciated!