# Find mean of random numbers

**URL:** <https://cl.desmos.com/t/find-mean-of-random-numbers/7626>\
**Category:** Questions\
**Created:** [December 27, 2024, 8:00pm UTC](https://cl.desmos.com/t/find-mean-of-random-numbers/7626 "2024-12-27T20:00:05Z")\
**Posts on this page:** 11\
**Page:** 1

<div class="post-metadata">

**Author:** ![Garrott\_Roddy](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/garrott_roddy/32/6476_2.png) [@Garrott\_Roddy](https://cl.desmos.com/u/Garrott_Roddy)\
**Post date:** [December 27, 2024, 8:00pm UTC](https://cl.desmos.com/t/find-mean-of-random-numbers/7626/1 "2024-12-27T20:00:05Z")

</div>

How can I get the mean for line [7](https://www.desmos.com/calculator/xcjdlgnbeg) without manually pressing the randomize button a bunch of times and adding up the outputs manually

Sorry for all the questions lately thanks for everyone helping me out

---

<div class="post-metadata">

**Author:** ![Guzman\_Tierno](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/guzman_tierno/32/6149_2.png) [@Guzman\_Tierno](https://cl.desmos.com/u/Guzman_Tierno)\
**Post date:** [December 27, 2024, 9:24pm UTC](https://cl.desmos.com/t/find-mean-of-random-numbers/7626/2 "2024-12-27T21:24:26Z")

</div>

This might do what you want … but please check carefully 'cause I’m not sure:  
[https://www.desmos.com/calculator/5b5rt52aic](https://www.desmos.com/calculator/5b5rt52aic)

it looks like the mean converges to 0.57 more or less …

---

<div class="post-metadata">

**Author:** ![Garrott\_Roddy](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/garrott_roddy/32/6476_2.png) [@Garrott\_Roddy](https://cl.desmos.com/u/Garrott_Roddy)\
**Post date:** [January 6, 2025, 6:24am UTC](https://cl.desmos.com/t/find-mean-of-random-numbers/7626/3 "2025-01-06T06:24:31Z")

</div>

do you know how the “Definitions are nested too deeply.” error code on line [20](https://www.desmos.com/calculator/gbfszu5wvj) could be dealt with? Im trying to replicate what you did but for [this](https://www.desmos.com/calculator/ojsjvdsbct)

my solution was to simplify it by combining [lines](https://www.desmos.com/calculator/4pozbig2do) but it didn’t work

---

<div class="post-metadata">

**Author:** ![Guzman\_Tierno](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/guzman_tierno/32/6149_2.png) [@Guzman\_Tierno](https://cl.desmos.com/u/Guzman_Tierno)\
**Post date:** [January 6, 2025, 9:48am UTC](https://cl.desmos.com/t/find-mean-of-random-numbers/7626/4 "2025-01-06T09:48:38Z")

</div>

Things are getting really involved … here’s what Desmos says about getting such an error: “Thanks for pushing the limits of the calculator. Some of those warnings are set up so that it won’t crash the browser”.  
So you probably need to simplify the structure of what you’re doing if that is possible.

Line 19 may have some problems … you are joning 3 numbers into a list an than you’re asking to take the number in position CanaditeAmount-1 which is actually 2 … is that what you want? You are actually always choosing the second number …

If you simplify line 19 the errore goes away … I think there’s something wrong there. In any case it is that line that makes the dependencies of the definitions too involved.

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [January 6, 2025, 4:53pm UTC](https://cl.desmos.com/t/find-mean-of-random-numbers/7626/5 "2025-01-06T16:53:02Z")

</div>

There are a number of places where you’re using `.length` on a list of calculations where you could reduce calculator computations. The calculator will calculate that list of integrals and then take the length of that list, so it’s helpful to skip the calculations.

Playing a little, I’ve done so [here](https://www.desmos.com/calculator/ond4dklfw0) using @Guzman_Tierno 's graph.

---

<div class="post-metadata">

**Author:** ![Garrott\_Roddy](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/garrott_roddy/32/6476_2.png) [@Garrott\_Roddy](https://cl.desmos.com/u/Garrott_Roddy)\
**Post date:** [January 7, 2025, 12:37am UTC](https://cl.desmos.com/t/find-mean-of-random-numbers/7626/6 "2025-01-07T00:37:14Z")

</div>

how did you simplify line 19 to make the error go away.

---

<div class="post-metadata">

**Author:** ![Daniel\_Grubbs](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/daniel_grubbs/32/719_2.png) [@Daniel\_Grubbs](https://cl.desmos.com/u/Daniel_Grubbs)\
**Post date:** [January 7, 2025, 2:17am UTC](https://cl.desmos.com/t/find-mean-of-random-numbers/7626/7 "2025-01-07T02:17:52Z")

</div>

Looking back at this again, I think your use of list comprehension (i.e. all the lines using “for i = …”) where you’re essentially taking the list and selecting an element, but similar to what I noted before with your use on `.length`, I believe for each element of `i` it’s looking at the whole list, finding that element, and joining into the output list. I think using indexing alone may be more efficient, though I’m not certain.

Here’s one example of C\_m defined using list comprehension vs. C\_mNew using indexing:

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/desmos/original/2X/6/699e077cd1d14cfde0a8fc5f5110e6e59c3d2717.png)

Similarly, `random()` has additional arguments that negate the need for list comprehension. `random(list, number of elements, seed value)`:

 ![image](https://canada1.discourse-cdn.com/flex031/uploads/desmos/original/2X/5/5dd0094ee173bbec1c6bd9590dfed39eacb8efe3.png)

---

<div class="post-metadata">

**Author:** ![Guzman\_Tierno](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/guzman_tierno/32/6149_2.png) [@Guzman\_Tierno](https://cl.desmos.com/u/Guzman_Tierno)\
**Post date:** [January 7, 2025, 6:53am UTC](https://cl.desmos.com/t/find-mean-of-random-numbers/7626/8 "2025-01-07T06:53:34Z")

</div>

you are always choosing the second element in line 19:  
if you simply write

| min( C1(L) ) |

the error goes away.

To be clear:  
join( | min( C(L) ) |, | min( C1(L) ) |, | min( C2(L) ) | )  
is a list with 3 numbers and you are always choosing the second one. So there’s something strange there.

---

<div class="post-metadata">

**Author:** ![Garrott\_Roddy](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/garrott_roddy/32/6476_2.png) [@Garrott\_Roddy](https://cl.desmos.com/u/Garrott_Roddy)\
**Post date:** [January 9, 2025, 2:04am UTC](https://cl.desmos.com/t/find-mean-of-random-numbers/7626/9 "2025-01-09T02:04:26Z")

</div>

update: I bought chatgpt plus which is apparently powerful enough to run this equation [nestley | Desmos](https://www.desmos.com/calculator/iia06elqhu)

---

<div class="post-metadata">

**Author:** ![Guzman\_Tierno](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/guzman_tierno/32/6149_2.png) [@Guzman\_Tierno](https://cl.desmos.com/u/Guzman_Tierno)\
**Post date:** [January 9, 2025, 8:34am UTC](https://cl.desmos.com/t/find-mean-of-random-numbers/7626/10 "2025-01-09T08:34:20Z")

</div>

but do you get a number in line 6? (cause I dont)

---

<div class="post-metadata">

**Author:** ![Garrott\_Roddy](https://yyz1.discourse-cdn.com/flex031/user_avatar/cl.desmos.com/garrott_roddy/32/6476_2.png) [@Garrott\_Roddy](https://cl.desmos.com/u/Garrott_Roddy)\
**Post date:** [January 9, 2025, 9:05am UTC](https://cl.desmos.com/t/find-mean-of-random-numbers/7626/11 "2025-01-09T09:05:21Z")

</div>

chatgpt said it was 0.182
