# Flatten with Triangular Distribution

I have a problem with the Flatten function. First here below data tables.

tsample = Table[jj, {jj, 0.1, 0.25, 0.01}]
ε = EstimatedDistribution[tsample, TriangularDistribution[{min, max}]]
sample = Table[ii, {ii, 0.1, 0.35, 0.01}]
ω = EstimatedDistribution[sample, TriangularDistribution[{min, max}]]


Now, I need to have a Flatten for ω and ε, but I'm not able to find the right way. I wrote it like this but I don’t think it's the right way:

εω =
Flatten[
Table[
Table[{sample[[ii]], tsample[[jj]]}, {jj, 1, Length[tsample]}],
{ii, 1, Length[sample]}],
1]


tsample = Table[jj, {jj, 0.1, 0.25, 0.01}];

ε =
EstimatedDistribution[tsample, TriangularDistribution[{min, max}]]

(* TriangularDistribution[{0.0750068, 0.274993}] *)

dataε = RandomVariate[ε, 1000];

Show[
Histogram[dataε, Automatic, "PDF"],
Plot[PDF[ε, x], {x, 0, 0.3}]]


sample = Table[ii, {ii, 0.1, 0.35, 0.01}];

ω = EstimatedDistribution[sample, TriangularDistribution[{min, max}]]

(* TriangularDistribution[{0.0621028, 0.387897}] *)

dataω = RandomVariate[ω, 1000];

Show[
Histogram[dataω, Automatic, "PDF"],
Plot[PDF[ω, x], {x, 0, 0.45}]]


It is not clear to me what you are trying to accomplish. If you want a table of your underlying data then

Prepend[(Transpose@PadRight[{tsample, sample}]) /. 0 -> "-", {"tsample",
"sample"}] // Grid


If you want random data drawn from your distributions then

With[{n = 15},
Prepend[Transpose[
{RandomVariate[ε, n],
RandomVariate[ω, n]}], {ε, ω}] // Grid]


• Hi Bob, Thanks a lot. So i would like to generate some couples of {ε, ω} Following a triangular Distribution and using data from sample and tsample (the two data tables above). May 15 '20 at 20:34
• I do not understand what you are trying to do. ε and ω  are triangular distributions -- you defined them as such. The examples show how to generate random values from those distributions. The plots compare histograms of sampled data with the PDFs of the distributions. May 15 '20 at 21:33
• Dear Bob, my bad, i didn't understood your method. now its clear, this is exactly what i was looking for. thanks a lot for the help May 16 '20 at 3:12

Try Outer[List, sample, tsample]

• Hi xinbae, Thanks! But i sample and tsample are two tables. My flatten Function must contain epsilon and omega which are Following a triangular distribution and using data from sample and tsample. This is the hard part and i've tried find the good way to solve this problem but Nothing till now. Do you have any idea ? May 15 '20 at 14:50
• Sorry. I don't quite understand what you mean. May 15 '20 at 23:08