Wolfram 언어

확장된 확률 및 통계 기능

영역에서 샘플 포인트

RandomPoint는 지정된 영역의 의사 난수 점의 집합을 균일하게 샘플링합니다.

In[1]:=
Click for copyable input
Graphics[{Polygon[CirclePoints[5]], White, Point[RandomPoint[Polygon[CirclePoints[5]], 200]]}, ImageSize -> Medium]
Out[1]=

어두운 리사주 영역의 샘플 점을 찾습니다.

In[2]:=
Click for copyable input
\[ScriptCapitalR] = ImplicitRegion[-1 + (-1 + 18 x^2 - 48 x^4 + 32 x^6)^2 + (-1 + 18 y^2 - 48 y^4 + 32 y^6)^2 <= 0, {x, y}];
In[3]:=
Click for copyable input
Graphics[{PointSize[Tiny], Point[RandomPoint[\[ScriptCapitalR], 10^4]]}, ImageSize -> Medium]
Out[3]=

Text 프리미티브에서 샘플 점을 찾습니다.

In[4]:=
Click for copyable input
mr = DiscretizeGraphics[Text[Style["\[CapitalSigma]", Bold]], _Text, MaxCellMeasure -> 0.1];
In[5]:=
Click for copyable input
Graphics[{PointSize[Tiny], Point[RandomPoint[mr, 10000]]}, ImageSize -> Medium]
Out[5]=

몬테카를로 방법을 사용하여 파라메트릭 영역의 범위에서 적분을 근사합니다.

In[6]:=
Click for copyable input
region = ParametricRegion[{{s, s t}, s^2 + t^2 <= 1}, {s, t}];
전체 Wolfram 언어 입력 표시하기
In[7]:=
Click for copyable input
RegionPlot[region, ImageSize -> Medium, PlotTheme -> "Detailed", PlotLegends -> None]
Out[7]=

범위 내에서 적분되는 함수를 알아봅니다.

In[8]:=
Click for copyable input
f[{x_, y_}] := x^3 - 2 x^2 y + 4 x^6 - y^5; val = NIntegrate[f[{x, y}], {x, y} \[Element] region]
Out[8]=

샘플 크기 증가에 따른 몬테카를로 통계의 융합을 시각화합니다.

전체 Wolfram 언어 입력 표시하기
In[9]:=
Click for copyable input
ListLogLogPlot[ Transpose[{2^Range[20], ParallelTable[ RegionMeasure[region] Mean[f /@ RandomPoint[region, 2^n]], {n, 1, 20}]}], PlotRange -> All, PlotTheme -> "Detailed", ImageSize -> Medium, Joined -> True, Filling -> val]
Out[9]=

관련 예제

de en es fr ja pt-br ru zh