Skip to content

Instantly share code, notes, and snippets.

@czajkovsky
Created June 2, 2013 18:46
Show Gist options
  • Save czajkovsky/5694462 to your computer and use it in GitHub Desktop.
Save czajkovsky/5694462 to your computer and use it in GitHub Desktop.
function f(i,n:Integer; x: vector) : Extended; far;
begin
case i of
1: f:=3*x[1]-Cos(x[2]*x[3])-0.5;
2: f:=Sqr(x[1])-81*Sqr(x[2]+0.1)+Sin(x[3])+1.06;
3: f:=Exp(-x[1]*x[2])+20*x[3]+(10*Pi-3)/3;
end
end;
function f1(i,n:Integer; x: vector) : Extended; far;
begin
case i of
1: f1:=Sqr(x[1])+8*x[2]-16;
2: f1:=x[1]-Exp(x[2]);
end
end;
procedure df1(i, n: Integer; x: vector; var dfatx: vector); far;
begin
case i of
1: begin
dfatx[1]:=2*x[1];
dfatx[2]:=8
end;
2: begin
dfatx[1]:=1;
dfatx[2]:=-Exp(x[2])
end;
end
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment