Skip to main content
Left closed in review as "Original close reason(s) were not resolved" by bbgodfrey, creidhne, MarcoB
added 658 characters in body
Added to review
Source Link
Mark
  • 25
  • 6

Model the law of distribution of a random vector Xi=(Xi1; Xi2) and vector (min{Xi1; Xi2},max{Xi1; Xi2}) using 100 tests, construct a cloud of points and a regression line on the plane. Random variables Xi1 Xi2 are uniformly distributed in a quadrilateral with vertices (2, 2), (1,-2), (-2,-2), (-2, 2).

n = 100; a = -2; b = 2;
gridData = {};
For[i = 1, i <= n, i++, 
  dist = {RandomVariate[UniformDistribution[{a,b}]], 
    RandomVariate[UniformDistribution[{a,b}]]};
  y = Min[{dist[[1]], dist[[2]]}] ; z = Max[{dist[[1]], dist[[2]]}];
  gridData = Append[gridData, {dist[[1]], dist[[2]], y, z}]];
gridlabel = {"\[Xi]1", "\[Xi]2", "min", "max"};
GRIDDATA = {gridlabel}~Join~gridData[[1 ;; 100]];
Grid[GRIDDATA, Frame -> All, FrameStyle -> Gray]
Table\[Xi] = Table[{GRIDDATA[[n, 1]], GRIDDATA[[n, 2]]}, {n, 100}];
Print["Point cloud"];
Show[ListPlot[Table\[Xi]], PlotRange -> All, 
 AxesLabel -> {Subscript[x, 1], Subscript[x, 2]}]
Table\[Xi]minmax = 
  Table[{GRIDDATA[[n, 3]], GRIDDATA[[n, 4]]}, {n, 100}];
Print["Regression line"];
Show[ListPlot[Table\[Xi]minmax, AxesLabel -> {"y", "z"}, 
  PlotRange -> All], 
 Plot[InverseFunction[Integrate[Integrate[1/14,{x,-2,(y+6)/4}],{y,-2,2}]&][t], {t, 0.0001, 20}]]

I need to construct a uniform distribution in a trapezoid. I don’t understand how to do it, since according to the syntax, a uniform distribution has clear left and right boundaries. PleasePlease help me correct my code.

Question to the moderators who closed my question. I wrote the terms of the task. An attempt at my own solution. I'm facing a problem that I can't solve. I am answered by a person who gives a separate example, which cannot help me correctin any way at all. The benefit of such an answer is 0. The documentation contains 50 examples that are just as useless for my codespecific case. It also surprises me that I’m already -10 for the question, and +20 for his answer. Despite the fact that I asked a normal question, and he absolutely did not answer it. Please delete this question. To which the person spent a lot of time answering. Apparently about 10 seconds.

Model the law of distribution of a random vector Xi=(Xi1; Xi2) and vector (min{Xi1; Xi2},max{Xi1; Xi2}) using 100 tests, construct a cloud of points and a regression line on the plane. Random variables Xi1 Xi2 are uniformly distributed in a quadrilateral with vertices (2, 2), (1,-2), (-2,-2), (-2, 2).

n = 100; a = -2; b = 2;
gridData = {};
For[i = 1, i <= n, i++, 
  dist = {RandomVariate[UniformDistribution[{a,b}]], 
    RandomVariate[UniformDistribution[{a,b}]]};
  y = Min[{dist[[1]], dist[[2]]}] ; z = Max[{dist[[1]], dist[[2]]}];
  gridData = Append[gridData, {dist[[1]], dist[[2]], y, z}]];
gridlabel = {"\[Xi]1", "\[Xi]2", "min", "max"};
GRIDDATA = {gridlabel}~Join~gridData[[1 ;; 100]];
Grid[GRIDDATA, Frame -> All, FrameStyle -> Gray]
Table\[Xi] = Table[{GRIDDATA[[n, 1]], GRIDDATA[[n, 2]]}, {n, 100}];
Print["Point cloud"];
Show[ListPlot[Table\[Xi]], PlotRange -> All, 
 AxesLabel -> {Subscript[x, 1], Subscript[x, 2]}]
Table\[Xi]minmax = 
  Table[{GRIDDATA[[n, 3]], GRIDDATA[[n, 4]]}, {n, 100}];
Print["Regression line"];
Show[ListPlot[Table\[Xi]minmax, AxesLabel -> {"y", "z"}, 
  PlotRange -> All], 
 Plot[InverseFunction[Integrate[Integrate[1/14,{x,-2,(y+6)/4}],{y,-2,2}]&][t], {t, 0.0001, 20}]]

I need to construct a uniform distribution in a trapezoid. I don’t understand how to do it, since according to the syntax, a uniform distribution has clear left and right boundaries. Please help me correct my code.

Model the law of distribution of a random vector Xi=(Xi1; Xi2) and vector (min{Xi1; Xi2},max{Xi1; Xi2}) using 100 tests, construct a cloud of points and a regression line on the plane. Random variables Xi1 Xi2 are uniformly distributed in a quadrilateral with vertices (2, 2), (1,-2), (-2,-2), (-2, 2).

n = 100; a = -2; b = 2;
gridData = {};
For[i = 1, i <= n, i++, 
  dist = {RandomVariate[UniformDistribution[{a,b}]], 
    RandomVariate[UniformDistribution[{a,b}]]};
  y = Min[{dist[[1]], dist[[2]]}] ; z = Max[{dist[[1]], dist[[2]]}];
  gridData = Append[gridData, {dist[[1]], dist[[2]], y, z}]];
gridlabel = {"\[Xi]1", "\[Xi]2", "min", "max"};
GRIDDATA = {gridlabel}~Join~gridData[[1 ;; 100]];
Grid[GRIDDATA, Frame -> All, FrameStyle -> Gray]
Table\[Xi] = Table[{GRIDDATA[[n, 1]], GRIDDATA[[n, 2]]}, {n, 100}];
Print["Point cloud"];
Show[ListPlot[Table\[Xi]], PlotRange -> All, 
 AxesLabel -> {Subscript[x, 1], Subscript[x, 2]}]
Table\[Xi]minmax = 
  Table[{GRIDDATA[[n, 3]], GRIDDATA[[n, 4]]}, {n, 100}];
Print["Regression line"];
Show[ListPlot[Table\[Xi]minmax, AxesLabel -> {"y", "z"}, 
  PlotRange -> All], 
 Plot[InverseFunction[Integrate[Integrate[1/14,{x,-2,(y+6)/4}],{y,-2,2}]&][t], {t, 0.0001, 20}]]

I need to construct a uniform distribution in a trapezoid. I don’t understand how to do it, since according to the syntax, a uniform distribution has clear left and right boundaries. Please help me correct my code.

Question to the moderators who closed my question. I wrote the terms of the task. An attempt at my own solution. I'm facing a problem that I can't solve. I am answered by a person who gives a separate example, which cannot help me in any way at all. The benefit of such an answer is 0. The documentation contains 50 examples that are just as useless for my specific case. It also surprises me that I’m already -10 for the question, and +20 for his answer. Despite the fact that I asked a normal question, and he absolutely did not answer it. Please delete this question. To which the person spent a lot of time answering. Apparently about 10 seconds.

Post Closed as "Not suitable for this site" by David G. Stork, bbgodfrey, creidhne, MarcoB, E. Chan-López
Source Link
Mark
  • 25
  • 6

Uniform distribution in trapezoid

Model the law of distribution of a random vector Xi=(Xi1; Xi2) and vector (min{Xi1; Xi2},max{Xi1; Xi2}) using 100 tests, construct a cloud of points and a regression line on the plane. Random variables Xi1 Xi2 are uniformly distributed in a quadrilateral with vertices (2, 2), (1,-2), (-2,-2), (-2, 2).

n = 100; a = -2; b = 2;
gridData = {};
For[i = 1, i <= n, i++, 
  dist = {RandomVariate[UniformDistribution[{a,b}]], 
    RandomVariate[UniformDistribution[{a,b}]]};
  y = Min[{dist[[1]], dist[[2]]}] ; z = Max[{dist[[1]], dist[[2]]}];
  gridData = Append[gridData, {dist[[1]], dist[[2]], y, z}]];
gridlabel = {"\[Xi]1", "\[Xi]2", "min", "max"};
GRIDDATA = {gridlabel}~Join~gridData[[1 ;; 100]];
Grid[GRIDDATA, Frame -> All, FrameStyle -> Gray]
Table\[Xi] = Table[{GRIDDATA[[n, 1]], GRIDDATA[[n, 2]]}, {n, 100}];
Print["Point cloud"];
Show[ListPlot[Table\[Xi]], PlotRange -> All, 
 AxesLabel -> {Subscript[x, 1], Subscript[x, 2]}]
Table\[Xi]minmax = 
  Table[{GRIDDATA[[n, 3]], GRIDDATA[[n, 4]]}, {n, 100}];
Print["Regression line"];
Show[ListPlot[Table\[Xi]minmax, AxesLabel -> {"y", "z"}, 
  PlotRange -> All], 
 Plot[InverseFunction[Integrate[Integrate[1/14,{x,-2,(y+6)/4}],{y,-2,2}]&][t], {t, 0.0001, 20}]]

I need to construct a uniform distribution in a trapezoid. I don’t understand how to do it, since according to the syntax, a uniform distribution has clear left and right boundaries. Please help me correct my code.