<html><body><div style="color:#000; background-color:#fff; font-family:HelveticaNeue, Helvetica Neue, Helvetica, Arial, Lucida Grande, sans-serif;font-size:12px"><div id="yui_3_16_0_1_1416322549117_6155" dir="ltr"><span id="yui_3_16_0_1_1416322549117_6177">Boa tarde pessoal,</span></div><div id="yui_3_16_0_1_1416322549117_6155" dir="ltr"><span><br></span></div><div id="yui_3_16_0_1_1416322549117_6155" dir="ltr"><span id="yui_3_16_0_1_1416322549117_6178">tenho certeza que meu problema é bem simples mas não estou conseguindo visualizar a solução, criei a função:</span></div><div id="yui_3_16_0_1_1416322549117_6155" dir="ltr"><span><br></span></div><div id="yui_3_16_0_1_1416322549117_6155" dir="ltr" class="" style="">conv<- function(n){u<-matrix(nrow=n+1,ncol=1)</div><div id="yui_3_16_0_1_1416322549117_6155" dir="ltr" class="" style=""> for (i in 0:n) { </div><div id="yui_3_16_0_1_1416322549117_6155" dir="ltr" class="" style=""> if(i==0) f<-function(i) {pnorm(i,m,dp)}</div><div id="yui_3_16_0_1_1416322549117_6155" dir="ltr" class="" style=""> else f<- function(i) {pnorm(i*1/n,m,dp)}</div><div id="yui_3_16_0_1_1416322549117_6155" dir="ltr" class="" style=""> if(i==0) p<- function(i) {f(i)}</div><div id="yui_3_16_0_1_1416322549117_6155" dir="ltr" class="" style=""> else p<- function(i) {f(i)-f(i-1)}</div><div id="yui_3_16_0_1_1416322549117_6155" dir="ltr" class="" style=""> I<- function (i) {-p(i)*log2(p(i))}</div><div id="yui_3_16_0_1_1416322549117_6155" dir="ltr" class="" style=""> u[i,]<- I(i)}</div><div id="yui_3_16_0_1_1416322549117_6155" dir="ltr" class="" style=""> y<-u[0:n,]; y}</div><div id="yui_3_16_0_1_1416322549117_6155" dir="ltr"></div><div id="yui_3_16_0_1_1416322549117_6155" dir="ltr" class="" style=""><br></div><div id="yui_3_16_0_1_1416322549117_6155" dir="ltr" class="" style="">Mas para o caso onde i==0 não está sendo feito corretamente, e preciso idendificar se não tenho problemas na condição <span style="font-size: 11.8181819915771px;" class="" id="yui_3_16_0_1_1416322549117_6184">f(i)-f(i-1), o que ele retorna no lugar do i=0 é o valor do i=1.</span></div><div id="yui_3_16_0_1_1416322549117_6155" dir="ltr" class="" style=""><span style="font-size: 11.8181819915771px;" class=""><br></span></div><div id="yui_3_16_0_1_1416322549117_6155" dir="ltr" class="" style=""><span style="font-size: 11.8181819915771px;" class="">Alguém saberia me dar uma dica?</span></div><div id="yui_3_16_0_1_1416322549117_6155" dir="ltr" class="" style=""><span style="font-size: 11.8181819915771px;" class=""><br></span></div><div id="yui_3_16_0_1_1416322549117_6155" dir="ltr" class="" style=""><span style="font-size: 11.8181819915771px;" class="">Abraços,</span></div><div id="yui_3_16_0_1_1416322549117_6155" dir="ltr" class="" style=""><span style="font-size: 11.8181819915771px;" class=""><br></span></div><div id="yui_3_16_0_1_1416322549117_6155" dir="ltr" class="" style=""><span style="font-size: 11.8181819915771px;" class="">Daniela</span></div><div></div><div id="yui_3_16_0_1_1416322549117_6179"> </div><div class="signature" id="yui_3_16_0_1_1416322549117_6181"><div id="yui_3_16_0_1_1416322549117_6180"><span style="font-size:16px;">-- <br><font size="2">Daniela Rodrigues Recchia</font></span></div><div id="yui_3_16_0_1_1416322549117_6194"><br></div><div style="color:rgb(0, 0, 0);font-size:13px;font-family:arial, helvetica, clean, sans-serif;background-color:transparent;font-style:normal;"><span style="font-size:16px;"><font size="2"><br></font></span></div><div><span style="font-size:10px;"></span></div><div id="yui_3_16_0_1_1416322549117_6200"><span style="font-size:10px;"><span style="line-height:18px;font-family:'helvetica neue', arial, sans-serif;font-style:italic;"><font size="2">“The standard of success in life is absolutely the amount of joy you feel”</font></span><br></span><span style="font-size:13px;"><span style="font-size:10px;"><span style="line-height:18px;font-family:'helvetica neue', arial, sans-serif;font-style:italic;"><font size="2">Esther & Jerry Hick</font></span></span><br></span></div><div id="yui_3_16_0_1_1416322549117_6201"><span style="font-size:small;"> </span></div></div></div></body></html>