5:52 PM
@Rithaniel Range[10^6]
in mathematica
it's not random, but it's simple!
(If I did want random reals, I'd do RandomReal[1,10^6]
. random reals in the range 0 to 1, sampled 10^6 times)
@Abcd I mean, you're basically asking about the concept of "expectation value" as a whole
where you have $E[f(X)]=\sum_i p_i f(x_i)$
empirically, those $p_i$ are obtained as $p_i = \frac{n_i}{\sum_i n_i}$ i.e. the frequency $n_i$ with which $X=x_i$ occurs, relative to the total number of outcomes $\sum_i n_i$
so empirically you'd have $\sum_i \frac{n_i f(x_i)}{n_i}$
which, if $n_i=1$, is just $\frac{1}{N}\sum_i f(x_i)$
So you gather your samples, compute $f(x_i)$ for each of them, and take the average value over all samples
Inspired by a question on the main site: Suppose I've got $X,Y,Z$ as quartic polynomials in $t$. It turns out that there exists a fourth-order homogeneous relation between these polynomials, i.e. there's a fourth-order homogeneous polynomial $f(x,y,z)$ such that $f(X,Y,Z)$ vanishes identically
What kind of math would that go under?
Seems like something out of commutative algebra
(To put things in more gory detail, the polynomials are $(X,Y,Z)=(t^4,3t^3+4t,t^2+2)$ and the fourth-order polynomial is annoying)
I can see some things. for instance, X^4 is the only degree-4 monomial in X,Y,Z with degree 16 in t, so x^4 can't show up at all in f(x,y,z)
but I don't know whether there's a systematic approach