- #1

- 148

- 0

Hi This is a question somewhere between maths and numerical methods...

I am using the algorithm for Nelder Mead found here:

http://www.ssl.berkeley.edu/~mlampton/neldermead.java

in java. It works nicely with the two example functions - rosen and parab.

I am trying to adjust it to my function:

so that I can minimize for the sum and find p[0].

My test data is

timings.add(2.503);

timings.add(5.159);

timings.add(7.899);

timings.add(10.883);

timings.add(17.081);

The problem I think is occuring with my understanding of the 2D array simplex[]. As far as I understand the first two columns are the paramter initial values and the third is storing the value of the function, but Im not sure why there are three rows. I assume its three different values for the paramters or something, but it doesnt seem to make sense to me.

I have attached my version of the algorithm for my function, in the hope that someone can help me get it to solve the problem.

Thanks

EDIT:!!

Sorry I made a mistake in my attachment. I had done a couple of undo's that need to be put back.

The array simplex should be:

I am using the algorithm for Nelder Mead found here:

http://www.ssl.berkeley.edu/~mlampton/neldermead.java

in java. It works nicely with the two example functions - rosen and parab.

I am trying to adjust it to my function:

Code:

```
static double myFunction(double p[]) {
double v0;
double sum = 0;
double curve;
double errorVector;
int index = 0;
v0 = (1 + (p[0] / 2) * timings.get(0) * timings.get(0))
/ timings.get(0);
for (Double f : timings) {
index++;
curve = (v0 * f - (p[0] / 2)) * f * f;
errorVector = index - rotorCurve;
sum += errorVector * errorVector;
}
System.out.println("p:" + p[0]);
return sum;
}
```

My test data is

timings.add(2.503);

timings.add(5.159);

timings.add(7.899);

timings.add(10.883);

timings.add(17.081);

The problem I think is occuring with my understanding of the 2D array simplex[]. As far as I understand the first two columns are the paramter initial values and the third is storing the value of the function, but Im not sure why there are three rows. I assume its three different values for the paramters or something, but it doesnt seem to make sense to me.

I have attached my version of the algorithm for my function, in the hope that someone can help me get it to solve the problem.

Thanks

EDIT:!!

Sorry I made a mistake in my attachment. I had done a couple of undo's that need to be put back.

The array simplex should be:

Code:

```
double simplex[][] = // [row][col] = [whichvx][coord,FUNC]
{{ 0.004, 0.0}};
```