In[]:=
(* Step 1.- Construction of test functions *)
In[]:=
fA1[w1_,w2_,w3_,w4_]:= 10+w1+w2+w3+w4
In[]:=
fB2[r1_,r2_,r3_,r4_]:= 1+r1+r2+r3+r4
In[]:=
fC3[t1_]:=5*t1
In[]:=
(* construction of the rule where the functions will be evaluated *)
In[]:=
hF1[fA1_,fB2_,fC3_]:= (2*fA1)*(3*fB2)*(4*fC3)
In[]:=
(* Step 3.- Construction of the Second function called *)
In[]:=
GT5[fA1_,fB2_,fC3_,x1_,x1min_,x1max_,x2_,x2min_,x2max_,x3_,x3min_,x3max_,x4_,x4min_,x4max_,NN_]:=​​Module[​​ {​​ p1, p1min, p1max, ​​ p2, p2min, p2max,​​ p3, p3min, p3max,​​ p4, p4min, p4max,​​ n, selectedData,LowerLimit,UpperLimit​​ },​​ LowerLimit = 1;​​ UpperLimit = 10000000;​​ selectedData={};​​ p1=x1; p1min=x1min; p1max=x1max;​​ p2=x2; p2min=x2min; p2max=x2max; ​​ p3=x3; p3min=x3min; p3max=x3max; ​​ p4=x4; p4min=x4min; p4max=x4max;​​ n=1;​​ Do[​​ { ​​ x1 = RandomReal[{p1min, p1max}];​​ x2 = RandomReal[{p2min, p2max}];​​ x3 = RandomReal[{p3min, p3max}];​​ x4 = RandomReal[{p4min, p4max}]; ​​ If[​​ LowerLimit <= hF1[fA1, fB2, fC3] <= UpperLimit,​​ selectedData = AppendTo[selectedData, {p1,p2,p3,p4,hF1[fA1, fB2, fC3]}], ​​ 0​​ ]; ​​ }, {n, NN}​​ ];​​ selectedData​​]
In[]:=
GT5[​​ fA1[D1+D2,D3,D1,D2],​​ fB2[D1+D2,D3,D1,D2],​​ fC3[2*D1],​​ D1,1,2,​​ D2,1,2,​​ D3,1,2,​​ D4,1,2,​​ 10​​ ]
Set
:Cannot assign to raw object 1.8061.
Set
:Cannot assign to raw object 1.44104.
Set
:Cannot assign to raw object 1.01251.
General
:Further output of Set::setraw will be suppressed during this calculation.
Out[]=
{{1.8061,1.44104,1.01251,1.13217,64553.9},{1.8061,1.44104,1.01251,1.13217,64553.9},{1.8061,1.44104,1.01251,1.13217,64553.9},{1.8061,1.44104,1.01251,1.13217,64553.9},{1.8061,1.44104,1.01251,1.13217,64553.9},{1.8061,1.44104,1.01251,1.13217,64553.9},{1.8061,1.44104,1.01251,1.13217,64553.9},{1.8061,1.44104,1.01251,1.13217,64553.9},{1.8061,1.44104,1.01251,1.13217,64553.9},{1.8061,1.44104,1.01251,1.13217,64553.9}}