#include <oxstd.h>
#import <maximize>

fMap(const avR, const vU)
{
    decl cu = rows(vU);

    avR[0] = vU[ : cu-2][] .^ 2; // drop last row and square

return 1;
}

main()
{
    decl vp, mjacob;

    if (NumJacobian(fMap, ones(4, 1), &mjacob))
        print("numerical Jacobian at <1;1;1;1>", mjacob);

    if (NumJacobian(fMap, zeros(4, 1), &mjacob))
        print("numerical Jacobian at <0;0;0;0>", mjacob);
}

