# Tag Info

0

If a problem can easily be solved analytically, you should not use the PC. You learn more from the analytical calculation. Given height: h and the acceleration: g, the distance after time t is: s[t_]= 1/2 g t^2 That means the maximal falling time is: tmax= Sqrt[2h/g] If we now calculate the mean of s[t] over t: Mean s = 1/tmax Integrate[1/2 g t^2,{t,0,tmax}...

4

These are all quite fancy solutions so far. For beginners' sake, I'd like to add a somewhat more elementary one that uses somewhat more universal tools: ages = {14, 15, 16, 22, 24, 25}; counts = {1, 1, 3, 2, 2, 5}; ages.counts/Total[counts] 21 The . (a.k.a. Dot) computes this sum Sum[ages[[i]] counts[[i]], {i, 1, Length[ages]}] and Total computes this ...

10

values = {14, 15, 16, 22, 24, 25}; weights = {1, 1, 3, 2, 2, 5}; You can also use WeightedData: Mean @ WeightedData[values, weights] 21 or use Mean with EmpiricalDistribution: Mean @ EmpiricalDistribution[weights -> values] 21 Both methods also work with symbolic input: values = Array[Subscript[x, #] &, 5]; weights = Array[Subscript[w, #] &, ...

3

Using your formula Clear["Global`*"] ages = {14, 15, 16, 22, 24, 25}; counts = {1, 1, 3, 2, 2, 5}; Evaluate[n /@ ages] = counts; ?n mean = Sum[j*n[j], {j, ages}]/Total[counts] (* 21 *)

12

You need EmpiricalDistribution: data = {14, 15, 16, 22, 24, 25}; weights = {1, 1, 3, 2, 2, 5}; \[ScriptCapitalD] = EmpiricalDistribution[weights -> data]; Expectation[x, x \[Distributed] \[ScriptCapitalD]] (* 21 *)

3

You mainly need TransformedDistribution: xrule = DSolve[{x'[t] == g t, x == 0}, x, t][] (* {x -> Function[{t}, (g t^2)/2]} *) grule = Solve[x[T] == h /. xrule, g][] (* {g -> (2 h)/T^2} *) dist = TransformedDistribution[x[t] /. xrule, t \[Distributed] UniformDistribution[{0, T}]]; Assuming[{T > 0, h > 0},...

3

If you want to see "how normal" your data appears to be, you first need to decide on a metric (or metrics) that characterize the departures from normality that are important to you. You also really need to know what values of those metrics imply "non-normality". I'd argue that many folks don't know they need to consider both the kind of ...

1

I never played roulette, so check my assumptions: There are 37 wholes, 18 red 18 black, 1 green. If I set on red and the ball stop on red, I get twice my money back, otherwise I lose all. With this assumptions: We mark "win" by 1 and loose by "0". Then playing n times the numbers of "wins" is: Count[RandomChoice[{18, 19} -> {...

3

The answer turns out to be quite simple at the end: (5 (956877309536 + 243 Sqrt (-3217542976 + 1024176615 ArcCos[5983/6561])))/2654208

0

TransformedDistribution[Max[E^(x-1)-κ,0],x\[Distributed] NormalDistribution[μ,σ]]//PDF[#,y]& 1/2 DiracDelta[y+κ] (1+Erf[(1-μ+Log[y+κ])/(Sqrt σ)]) (-1+UnitStep[-y]) (UnitStep[-y] (-1+UnitStep[-κ])-UnitStep[-κ])-DiracDelta[y] (1+Erf[(1-μ+Log[κ])/(Sqrt σ)]) (-1+UnitStep[-κ])-(E^(-((1-μ+Log[y+κ])^2/(2 σ^2))) (-1+UnitStep[-y]) (1+UnitStep[-y] (-1+...

3

Directly translating the Wikipedia article linked in the comments: poissonRandomNumber[λ_] := Module[{L = Exp[-λ], k = 0, p = 1, u}, While[p > L, ++k; p = p*RandomReal[]; ]; Return[k - 1]] Histogram[Table[poissonRandomNumber, 20000]]

3

Just to summarize, @cvgmt has shown how to find all the possible outcomes using 3 dice with 6 sides on each die. ndice = 3; nsides=6; outcomes = Tuples[Range[nsides], {ndice}]; @Anton has shown how to find those outcomes that have a given total. We can use GatherBy to group all of the outcomes according to their totals. Then we count the number of outcomes ...

2

t = Input["Give Sum"]; Select[Tuples[Range, 3], Total[#] == t &]

3

nCows = 3 nCalves = RandomChoice[Range, nCows] Counts[nCalves] Edit: This alternative answer is in response to a comment that reframed the question, so the two answers resond to different understandings of the question. Catenate[Permutations /@ Select[IntegerPartitions, 3 == Length@# &]]

1

To reiterate (this was not explicit in the original of the question posed), the 2D constrained integration problem I am seeking to solve takes the form Integrate[9081072000 (x - y)^2 (1 - 3 x + 3 y - 4 Sqrt[y - 2 x y])^2 (1 - 3 x +y - 2 Sqrt[y - 2 x y])^2 (2 y - 2 Sqrt[y - 2 x y])^2 (-1 + 2 x + 2 Sqrt[y - 2 x y])^2 (x - 3 y + 2 Sqrt[y - 2 x y])^2 Boole[x >...

1

You can use Manipulate, PopupMenu and InputField as follows: functions = {Total, Min, Max, MinMax, Mean, Median, Commonest, Quartiles}; flabels = {"Suma Datos", "Dato Minimo", "Dato Maximo", "Rango", "Media Aritmetica", "Mediana", "Moda", "Cuartiles"}; fl = Thread[functions -...

3

The probability distribution for count is dist = ParameterMixtureDistribution[ BinomialDistribution[10, p], p \[Distributed] BetaDistribution[1, 1]] (* BetaBinomialDistribution[1, 1, 10] *) The expected value of count is the Mean of dist Mean[dist] (* 5 *) Probability[count > 1/2, count \[Distributed] dist] (* 10/11 *)

5

Generating tuples and then machinating over them will get terribly inefficient very quickly (for example, try 10D20 with your code: you'll blow memory before getting anywhere). Much easier, and efficient, to appeal directly to a probabilistic result. Here's a function that given the number of dice and number of faces produces a grid with sums and various ...

2

The OP edit answer does what I need pretty snappily. For reference, the function and its usage is fn = With[{m = Sort@#, r = Range@Length@#}, Tr[m^Reverse@r/((Last@r - r + 1) (Last@r - r + 2) Append[ Reverse[FoldList[Times, Reverse[Rest@m]]], 1])]] &; fn@maxlist where $maxlist$ is a list of the endpoints (maximums) of your uniform ...

3

I'm not sure exactly what you're looking for. Anyway, here's an approximation to the mean of the order statistic that takes a second or two to compute on my laptop: Sort[#][[n]] & /@ RandomVariate[dist, 10^6] // Mean Of course you could take fewer or more draws depending on the accuracy you want.

3

Without filtering: Total[Times @@@ Map[If[# == 6, 1/2, 1/10] &, Flatten[Permutations /@ IntegerPartitions[18, {4}, Range], 1], {2}]] 12/125

5

pd = EmpiricalDistribution[({1, 1, 1, 1, 1, 5}/10) -> Range]; Probability[Total[Array[x, 4]] == 18, Thread[Array[x, 4] \[Distributed] pd]] (* result 12/125 *)

Top 50 recent answers are included