|
|
back to boardApproximation method Posted by VladG 23 Oct 2002 14:26 I think that this problem could be solved also by an approximation method. (In adition to discovering the exact expression for a[1]) The method that I offer in simplifaction look as follows: for (i=1; i<=elemNum; i++) a[i] = 0; for (j=0; j<elemNum*N; j++) { for (i=1; i<=elemNum; i++) a[i] = (a[i-1] + a[i+1]) / 2 - c[i]; printf("%.2f", a[1]); I think that after enough number of iterations it should reach the exact answer. Though, some tests that I ran with this method gave the right result, but it gave a Wrong Answer when I submitted. May be I need to make some tunnings to my method. What do you think? There's an exact formula (-) > I think that this problem could be solved also by an approximation > method. (In adition to discovering the exact expression for a[1]) > > The method that I offer in simplifaction look as follows: > > for (i=1; i<=elemNum; i++) > a[i] = 0; > > for (j=0; j<elemNum*N; j++) { > for (i=1; i<=elemNum; i++) > a[i] = (a[i-1] + a[i+1]) / 2 - c[i]; > > printf("%.2f", a[1]); > > I think that after enough number of iterations it should reach the > exact answer. > > Though, some tests that I ran with this method gave the right result, > but it gave a Wrong Answer when I submitted. > May be I need to make some tunnings to my method. > > What do you think? |
|
|