search for: getmultival3

Displaying 1 result from an estimated 1 matches for "getmultival3".

2007 Jan 25
0
R programming question, one dimensional optimization
...ombine?the?variable?and?the?vector?and?generate?a?new?vector,?then? test?the? x'Ax/x'Bx. However?I?dodnot?know?if?there?is?a?way?that?can?calculate?the?x? automatically?instead?of? I?typing?different?values?to?get?the?result?and?compare. =================================================== getMultiVal3?=?function?(a,?b,?cc,?x)?{ +?????i-1;?j=1;?sum=0;?sum2=0 +?????n=nrow(a);?v=?c(x,?cc) +?????for?(i?in?1:n)?{ +???????for?(j?in?1:n)?{ +??????????sum=sum+a[i,j]*v[i]*v[j];?sum2=sum2+b[i,j]*v[i]*v[j] +???????} +?????} +????return(sum/sum2) +???}