#include "MtxExpr.hpp"
#include "Math387.hpp"
void __fastcall VecFun(
TVec*
const x,
TVec*
const f,
const double* c, conts
int c_count,
System::TObject*
const* o,
const int o_count);
{
double* X = x->PValues(0);
double* F = f->PValues(0);
F[0] = 100.0*
IntPower(X[1]-
IntPower(X[0],2),2);
F[1] =
IntPower(1.0-X[0],2);
}
// Jacobian is 2x2 matrix
void __fastcall BananaJac(
TVec*
const x,
TVec*
const y,
TMtx*
const Jac);
begin
double* X = x->PValues(0);
Jac->Values[0,0] = -400*(X[1]-
IntPower(X[0],2))*x[0];
// partial(f0)/ partial(x0)
Jac->Values[0,1] = -2*(1-X[0]);
// partial(f1)/ partial(x0)
Jac->Values[1,0] = 200*(X[1]-
IntPower(X[0],2));
// partial(f0)/ partial(x1)
Jac->Values[1,1] = 0.0;
// partial(f1)/ partial(x1)
end;