Mathematica: find mean value of an increasing list

In summary, to find the mean of a list L={a_{1}, ..., a_{n}} and plot the means for each 1<i<n, you can use the built-in mean function and the Take function to construct the L_{i} list. Then, create a new list with the means and use the ListPlot function to plot them. This method is more efficient than using a For loop to generate the means.
  • #1
skitapa
4
0
I have a list L={a_{1}, ..., a_{n}}. I would like to find the mean of
L_{i} := {a_{1}, ... , a_{i}} for each 1<i<n, and then plot the means.
How do to do that in a smart way?
 
Last edited:
Physics news on Phys.org
  • #2
I'm not suite sure what you're asking but there are build in mean funcitons.

So couldn't you do something like :

MeanList= List[Mean[L],{i,0,n}]
ListPlot[MeanList]
 
  • #3
The L_{i} can be constucted by the Take function. But it seems hard to plot the means afterwards. Thats the real problem, how to get something that can be plotted
 
  • #4
Well, your means will be scalars, one for each list, yes? well, make a list out of them and listplot.
 
  • #5
L = {11, 12, 13, 14, 15, 16}
MeanList = Table[Mean[Take[L, i]], {i, 1, 6}]
ListPlot[MeanList]
 
  • #6
Thank you very much.
I did generate the means by:
Code:
For[i = 1, i < 1000, i++, Print[Mean[Take[R, i]]]]
and from there I was not able to make a list will all the means. Anyhow, your way was way better.
 
1)

What is Mathematica and how can it help find the mean value of an increasing list?

Mathematica is a software program used for mathematical and scientific calculations. It has built-in functions and algorithms that can easily find the mean value of an increasing list of numbers.

2)

How do I input an increasing list of numbers into Mathematica?

You can input an increasing list of numbers into Mathematica by using the "List" function and separating each number with a comma, or you can type the numbers directly into the input field with a space between each number.

3)

Can Mathematica handle large lists of numbers and still accurately calculate the mean value?

Yes, Mathematica can handle large lists of numbers and accurately calculate the mean value. It has high precision and can handle large data sets without any loss of accuracy.

4)

What if my list of numbers contains non-numerical elements?

If your list contains non-numerical elements, Mathematica will return an error. It is important to ensure that your list only contains numerical values for the mean calculation to be accurate.

5)

Is there a specific function in Mathematica for finding the mean value of an increasing list?

Yes, there is a specific function called "Mean" in Mathematica that can be used to find the mean value of an increasing list. This function takes the list as an input and returns the mean value as the output.

Similar threads

  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
5
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
2
Views
262
  • MATLAB, Maple, Mathematica, LaTeX
Replies
4
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
10
Views
2K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • Calculus and Beyond Homework Help
Replies
11
Views
1K
  • Calculus and Beyond Homework Help
Replies
5
Views
489
  • MATLAB, Maple, Mathematica, LaTeX
Replies
1
Views
1K
  • MATLAB, Maple, Mathematica, LaTeX
Replies
6
Views
2K
Back
Top