-1
$\begingroup$

This is the first list

lts1 = Table[i, {i, -1.8, 5.8, 0.1}]

1st question: In the interval between -1.8 and 5,8 how can I choose the step beforehand so as the list to contain 100 elements?

The second list

dist = MixtureDistribution[{1, 2}, {NormalDistribution[1, 1/2], 
NormalDistribution[4, 5/3]}]
lst2 = RandomVariate[dist, 10^2]

We know that the second list contains 100 elements.

2st question: How can I join these two lists so the new list to be {{lst1[[1]], lst2[[1]]}, {lst1[[2]], lst2[[2]]}, ..., {lst1[[100]], lst2[[100]]}}?

Many thanks in advance!

$\endgroup$
2
  • $\begingroup$ 32715 / 38009 + Transpose. $\endgroup$
    – Kuba
    Jul 13, 2015 at 14:30
  • 2
    $\begingroup$ I am voting to close this question because it seems to me of limited general usefulness. The first part of your question is not quite about Mathematica, but rather about how generally to find divisions of an interval. For the second part of your question, instead, take a look at the "Transpose and dimensions" section at the beginning of the following answer: mathematica.stackexchange.com/a/259/27951. $\endgroup$
    – MarcoB
    Jul 13, 2015 at 14:30

1 Answer 1

3
$\begingroup$

For (1) try step = (b-a)/(n-1), in your case

step = (5.8 - -1.8)/99;
lts1 = Table[i, {i, -1.8, 5.8, step}];
Length @ lts1

(* 100 *)

For (2) you just need

Transpose[{lts1,lst2}]
$\endgroup$

Not the answer you're looking for? Browse other questions tagged or ask your own question.