En esta caja hay el doble de partículas
amarillas que de rojas.

Mezclar aquí

Coger 50 partículas

Muestra de 50 partículas de la caja.

n = 230 (slider from 50 to 500, step 1)
n_2 = 1 (slider from 0 to 1, step 1)
E = (0, 0)
F = (1, 0)
e = Circle(E, F)
A = (-1.0440090341268677, -1.0386890051185391)
B = (1.04009830193981, -1.044019202908991)
poly1, a, b, c, d, C, D = Polygon(A, B, 4.0)
G = Intersect(xAxis, yAxis)
H = (1, 0)
f = Segment(G, H)
L3 = Sequence((1.0 - 2.0 * random() + 0.0 * n_2 * i, -1.0 + 2.0 * random() + 0.0 * n_2 * i), i, 1.0, n)
L1 = Sequence((1.0 - 2.0 * random() + 0.0 * n_2 * i, -1.0 + 2.0 * random() + 0.0 * n_2 * i), i, 1.0, n)
L2 = Sequence((1.0 - 2.0 * random() + 0.0 * n_2 * i, -1.0 + 2.0 * random() + 0.0 * n_2 * i), i, 1.0, n)
L4 = Sequence((1.5 + random() + 0.0 * n_2 * i, 0.2 * random() + 0.0 * n_2 * i), i, 1.0, 20.0)
L5 = Sequence((1.5 + random() + 0.0 * n_2 * i, 0.2 * random() + 0.0 * n_2 * i), i, 1.0, 20.0)
L6 = Sequence((1.5 + random() + 0.0 * n_2 * i, 0.2 * random() + 0.0 * n_2 * i), i, 1.0, 10.0)
I = (1.9995339042211449, 0.09131292645725556)
h = Line(I, yAxis)
K = Point(h)
L = Mirror(K, I)
g = Line(I, xAxis)
J = Point(g)
k = Circle(I, J)
M = Mirror(J, I)
i = Line(M, h)
j = Line(K, g)
l = Line(L, j)
m = Line(J, h)
N = Intersect(i, j)
O = Intersect(m, j)
P = Intersect(l, m)
Q = Intersect(i, l)
poly2, n_1, o, p, q = Polygon(N, O, P, Q)
R = (1.0614190931016174, 0.09131292645725556)
u = Vector(R, M)
r = true
jaune: round(4.0 * random() + n_2 * 0.0) + 32.0
T6: "" + (50.0 - jaune) + " partículas rojas y " + jaune + " partículas amarillas"
T2: "" + n + " partículas rojas y  " + (2.0 * n) + " partículas amarillas"

Tool: somme des numeros (command sommedesnumeros)
somme des listes
Input: L1
Output: a

L1: {0.0, 1.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 0.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 1.0, 0.0, 0.0, 1.0, 1.0, 1.0, 1.0, 0.0, 1.0, 1.0}
L2 = Sequence(If[i ≤ Length[L1], Element[L1, i], 0.0 * Element[L1, 1.0]], i, 1.0, 10.0 * ceil(Length[L1] / 10.0))
L3 = Sequence(Element[L2, i] + Element[L2, i + 1.0] + Element[L2, i + 2.0] + Element[L2, i + 3.0] + Element[L2, i + 4.0] + Element[L2, i + 5.0] + Element[L2, i + 6.0] + Element[L2, i + 7.0] + Element[L2, i + 8.0] + Element[L2, i + 9.0], i, 1.0, Length[L2], 10.0)
L4 = Sequence(If[i ≤ Length[L3], Element[L3, i], 0.0 * Element[L3, 1.0]], i, 1.0, 10.0 * ceil(Length[L3] / 10.0))
L5 = Sequence(Element[L4, i] + Element[L4, i + 1.0] + Element[L4, i + 2.0] + Element[L4, i + 3.0] + Element[L4, i + 4.0] + Element[L4, i + 5.0] + Element[L4, i + 6.0] + Element[L4, i + 7.0] + Element[L4, i + 8.0] + Element[L4, i + 9.0], i, 1.0, Length[L4], 10.0)
L6 = Sequence(If[i ≤ Length[L5], Element[L5, i], 0.0 * Element[L5, 1.0]], i, 1.0, 10.0 * ceil(Length[L5] / 10.0))
L7 = Sequence(Element[L6, i] + Element[L6, i + 1.0] + Element[L6, i + 2.0] + Element[L6, i + 3.0] + Element[L6, i + 4.0] + Element[L6, i + 5.0] + Element[L6, i + 6.0] + Element[L6, i + 7.0] + Element[L6, i + 8.0] + Element[L6, i + 9.0], i, 1.0, Length[L6], 10.0)
L8 = Sequence(If[i ≤ Length[L7], Element[L7, i], 0.0 * Element[L7, 1.0]], i, 1.0, 10.0 * ceil(Length[L7] / 10.0))
L9 = Sequence(Element[L8, i] + Element[L8, i + 1.0] + Element[L8, i + 2.0] + Element[L8, i + 3.0] + Element[L8, i + 4.0] + Element[L8, i + 5.0] + Element[L8, i + 6.0] + Element[L8, i + 7.0] + Element[L8, i + 8.0] + Element[L8, i + 9.0], i, 1.0, Length[L8], 10.0)
a = Element(L9, 1.0)

Tool: bipoint
Input: A
Output: B, C

B = If(Length[A] > 1.0, A)
C = If(Length[A] ≤ 1.0, A)