G
Graeme Dennes
I've written an iterative Trapezoidal integrator in VBA for integrating an
analytic function f(x), where f(x) is defined in a cell, for example, B1:
=3*A1^3 + 2*A1^2 + A2^3 - A3, where the integrating variable x is in cell A1,
and cells A2 and A3 contain parameters. In this example, the cells B1, A1,
the cells with the lower and upper limits, and the cell to receive the
result, are passed as arguments.
All this works fine.
Now, this is the part I 'm wanting to do, but cannot achieve.
After the integrator produces its result, I'm wanting to call the Solver
tool to minimise the integral result (target cell), adjust the parameters in
A2 and A3 (changing cells), and then for the integrator to be run again,
producing its next result. This process is to be repeated, until such time as
the parameters have been so adjusted by the Solver, and the integral result
has reached its minimum value.
ie,
1. Set up initial values.
2. The integrator determines its result.
3. Solver reads the result, then adjusts the two parameters.
4. Repeat steps 2 and 3, until the Solver has minimised the integral via the
two changed parameters.
I am unable to determine how to combine the iterative integrator with the
Solver in the above manner, so they alternately operate until such time that
the integral has been minimised.
Any guidance greatly appreciated.
analytic function f(x), where f(x) is defined in a cell, for example, B1:
=3*A1^3 + 2*A1^2 + A2^3 - A3, where the integrating variable x is in cell A1,
and cells A2 and A3 contain parameters. In this example, the cells B1, A1,
the cells with the lower and upper limits, and the cell to receive the
result, are passed as arguments.
All this works fine.
Now, this is the part I 'm wanting to do, but cannot achieve.
After the integrator produces its result, I'm wanting to call the Solver
tool to minimise the integral result (target cell), adjust the parameters in
A2 and A3 (changing cells), and then for the integrator to be run again,
producing its next result. This process is to be repeated, until such time as
the parameters have been so adjusted by the Solver, and the integral result
has reached its minimum value.
ie,
1. Set up initial values.
2. The integrator determines its result.
3. Solver reads the result, then adjusts the two parameters.
4. Repeat steps 2 and 3, until the Solver has minimised the integral via the
two changed parameters.
I am unable to determine how to combine the iterative integrator with the
Solver in the above manner, so they alternately operate until such time that
the integral has been minimised.
Any guidance greatly appreciated.