cancel
Showing results for 
Search instead for 
Did you mean: 
cancel
Showing results for 
Search instead for 
Did you mean: 

Calculating the average successively from an array of numbers

Eng_ReyD_497
5-Regular Member

Calculating the average successively from an array of numbers

I have an array, and I need to create another array, and calculate the successive average of the numbers as I move along the first array.

For instance, the average of 1st & 2nd, then the average of 1st,2nd, and 3rd, etc. till end of the array

 

Below some more explanation, including my attempt, but I could not reach what I am looking for. I appreciate your help... Thanks

Eng_ReyD_497_1-1620405215427.png

 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Here are my 2 Cents.
I can't read Prime 7 files and was working from the picture you posted.

I tried to provide a solution as close as possible to the attempt you made.

Werner_E_0-1620438989023.png

 

Nonetheless, personally I would prefer a userwritten uitility function with no need for any range variables defines on worksheet level and which is also independent from the setting of ORIGIN:

Werner_E_1-1620439416312.png

 

Prime 6 worksheet attached

 

View solution in original post

9 REPLIES 9

Send please the sheet.

Eng_ReyD_497
5-Regular Member
(To:ValeryOchkov)

Thanks @ValeryOchkov .. attached is the file 

kip.png

Eng_ReyD_497
5-Regular Member
(To:ValeryOchkov)

Thanks @ValeryOchkov, but this still give me an error, when I try it with the file that I sent... 

Here is my approach using MCP 5.0.  I set ORIGIN to 1 to simplify the division of [running sum]/[running count] = running average.  I tried it inside the program, but the global setting in the Calculation menu seemed to defeat it, so it goes (for now at least) outside the program.  And, as best I can tell, the last step is required to get the complete vector of solutions.  Without it, I get just the last average.  A better programmer might be able to make this better.  At any rate, it's short and it works.

 

Running Average Through a Vector_001.jpg

Eng_ReyD_497
5-Regular Member
(To:FredLusk)

Perfect... This works fine with me!!! Thanks @FredLusk ... I appreciate it...

Thanks for the compliment.  However, Valery's is a little simpler and fits better on the page.  🙂

Here are my 2 Cents.
I can't read Prime 7 files and was working from the picture you posted.

I tried to provide a solution as close as possible to the attempt you made.

Werner_E_0-1620438989023.png

 

Nonetheless, personally I would prefer a userwritten uitility function with no need for any range variables defines on worksheet level and which is also independent from the setting of ORIGIN:

Werner_E_1-1620439416312.png

 

Prime 6 worksheet attached

 

View solution in original post

Eng_ReyD_497
5-Regular Member
(To:Werner_E)

Thanks @Werner_E for the effort

That is really great!

Announcements
Check out the latest
Mathcad Tip
"PTC Mathcad 15 / Prime 1-6 Update."