Search   Memberlist   Usergroups
 Page 1 of 1 [3 Posts]
Author Message
Don11135
science forum beginner

Joined: 24 Mar 2005
Posts: 18

Posted: Thu Jul 20, 2006 8:56 pm    Post subject: Help in identifying a numerical method

I was provided with some code for refining the estimate of a initial
value, but I have no clue to what class of numerical method this
belongs. Any suggestions would be greatly appreciated. As you can
tell, I'm not a mathematician, just a programmer trying to understand
some code implementation.

Here's the code:

If I have an array of values, x[] and an initial estimated value e,
which all the values in the x array have a relationship to, then

double sum1, sum2

for(i = 0; i < x.length; i++)
{
double d_i = x[i] / e

for(j = 0; j < x.length; j++)
{
double val = min(i + 1, j + 1) - ((i+1)*(j+1)) / (x.length + 1)

double d_j = x[j] / e

sum1 += val * d_j * x[i]
sum2 += val * d_j * d_i
}
}

// finally the refined value

finalValue = sum1 / sum2

In the first iteration of the j loop, the numerator is increasing by
one (1,2,3,4,5..), in the 2nd iteration, the numerator increases by 2
(2,4,6,8...), in the 3rd iteration, the numerator increases by 3
(3,6,9,12...) and so on. The net result is that val becomes some type
of weighting scheme that is applied to both sum1 and sum2. Eventually,
the final value is calculated by dividing sum1 by sum2.

It appears to me to a way to statistically refine an estimated value.

Don
highegg
science forum beginner

Joined: 11 Feb 2005
Posts: 5

Posted: Fri Jul 21, 2006 5:09 am    Post subject: Re: Help in identifying a numerical method

Don wrote:
 Quote: I was provided with some code for refining the estimate of a initial value, but I have no clue to what class of numerical method this belongs. Any suggestions would be greatly appreciated. As you can tell, I'm not a mathematician, just a programmer trying to understand some code implementation. Here's the code: If I have an array of values, x[] and an initial estimated value e, which all the values in the x array have a relationship to, then double sum1, sum2

I guess you're missing
sum1 = sum2 = 0
here. Am I right?

 Quote: for(i = 0; i < x.length; i++) { double d_i = x[i] / e for(j = 0; j < x.length; j++) { double val = min(i + 1, j + 1) - ((i+1)*(j+1)) / (x.length + 1) double d_j = x[j] / e NOTE: at this point, d_i == x[i]/e sum1 += val * d_j * x[i] sum2 += val * d_j * d_i } } // finally the refined value finalValue = sum1 / sum2 At each update of sum1 and sum2, the increment for sum1 is e times the

increment for sum2.
Therefore, sum1/sum2 should be e (up to roundoff). Did you reproduce
the code correctly?
Jaroslav
Don11135
science forum beginner

Joined: 24 Mar 2005
Posts: 18

Posted: Fri Jul 21, 2006 11:34 am    Post subject: Re: Help in identifying a numerical method

You're right, sum1 = sum2 = 0 to start with. The only thing I left out
is that d_i and d_j are both rounded values:

double d_i = round(x[i] / e) // to nearest integer
double d_j = round(x[j] / e) // to nearest integer

highegg wrote:
 Quote: Don wrote: I was provided with some code for refining the estimate of a initial value, but I have no clue to what class of numerical method this belongs. Any suggestions would be greatly appreciated. As you can tell, I'm not a mathematician, just a programmer trying to understand some code implementation. Here's the code: If I have an array of values, x[] and an initial estimated value e, which all the values in the x array have a relationship to, then double sum1, sum2 I guess you're missing sum1 = sum2 = 0 here. Am I right? for(i = 0; i < x.length; i++) { double d_i = x[i] / e for(j = 0; j < x.length; j++) { double val = min(i + 1, j + 1) - ((i+1)*(j+1)) / (x.length + 1) double d_j = x[j] / e NOTE: at this point, d_i == x[i]/e sum1 += val * d_j * x[i] sum2 += val * d_j * d_i } } // finally the refined value finalValue = sum1 / sum2 At each update of sum1 and sum2, the increment for sum1 is e times the increment for sum2. Therefore, sum1/sum2 should be e (up to roundoff). Did you reproduce the code correctly? Jaroslav

 Display posts from previous: All Posts1 Day7 Days2 Weeks1 Month3 Months6 Months1 Year Oldest FirstNewest First
 Page 1 of 1 [3 Posts]
 The time now is Fri Dec 14, 2018 6:11 am | All times are GMT
 Jump to: Select a forum-------------------Forum index|___Science and Technology    |___Math    |   |___Research    |   |___num-analysis    |   |___Symbolic    |   |___Combinatorics    |   |___Probability    |   |   |___Prediction    |   |       |   |___Undergraduate    |   |___Recreational    |       |___Physics    |   |___Research    |   |___New Theories    |   |___Acoustics    |   |___Electromagnetics    |   |___Strings    |   |___Particle    |   |___Fusion    |   |___Relativity    |       |___Chem    |   |___Analytical    |   |___Electrochem    |   |   |___Battery    |   |       |   |___Coatings    |       |___Engineering        |___Control        |___Mechanics        |___Chemical

 Topic Author Forum Replies Last Post Similar Topics troubles in determination of specific surface area(air pe... eos Chem 0 Thu Jul 20, 2006 10:05 am troubles in determination of specific surface area(air pe... eos Chem 0 Thu Jul 20, 2006 10:02 am possible to use Generalized Method of Moments for this pr... comtech Math 1 Thu Jul 20, 2006 12:49 am Power Method and negative eigenvalues Skunk num-analysis 7 Wed Jul 19, 2006 10:19 pm modelling method for categorical data Arby Math 1 Wed Jul 19, 2006 12:09 pm