<?xml version="1.0"?>
<?xml-stylesheet type="text/css" href="http://www.if.pw.edu.pl/~lgraczyk/wiki/skins/common/feed.css?270"?>
<feed xmlns="http://www.w3.org/2005/Atom" xml:lang="en">
		<id>http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?action=history&amp;feed=atom&amp;title=KADD_2022_Laboratorium_6_EN</id>
		<title>KADD 2022 Laboratorium 6 EN - Revision history</title>
		<link rel="self" type="application/atom+xml" href="http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?action=history&amp;feed=atom&amp;title=KADD_2022_Laboratorium_6_EN"/>
		<link rel="alternate" type="text/html" href="http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_6_EN&amp;action=history"/>
		<updated>2026-04-13T16:41:49Z</updated>
		<subtitle>Revision history for this page on the wiki</subtitle>
		<generator>MediaWiki 1.16.5</generator>

	<entry>
		<id>http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_6_EN&amp;diff=2897&amp;oldid=prev</id>
		<title>Lgraczyk: /* Exercise */</title>
		<link rel="alternate" type="text/html" href="http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_6_EN&amp;diff=2897&amp;oldid=prev"/>
				<updated>2022-04-04T12:05:24Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Exercise&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 12:05, 4 April 2022&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 26:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 26:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The result of the macro execution should be a file with the name name.dat containing a series of generated numbers for a given set of parameters. The macro should be executed three times, resulting in three files: &amp;lt;code&amp;gt;random1.dat, random2.dat, random3.dat&amp;lt;/code&amp;gt;, for the following parameters, respectively:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;The result of the macro execution should be a file with the name name.dat containing a series of generated numbers for a given set of parameters. The macro should be executed three times, resulting in three files: &amp;lt;code&amp;gt;random1.dat, random2.dat, random3.dat&amp;lt;/code&amp;gt;, for the following parameters, respectively:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &amp;lt;code&amp;gt;m=97&amp;lt;/code&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;i &lt;/del&gt;&amp;lt;code&amp;gt;g=23&amp;lt;/code&amp;gt;,&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &amp;lt;code&amp;gt;m=97&amp;lt;/code&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;and &lt;/ins&gt;&amp;lt;code&amp;gt;g=23&amp;lt;/code&amp;gt;,&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &amp;lt;code&amp;gt;m=32363&amp;lt;/code&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;i &lt;/del&gt;&amp;lt;code&amp;gt;g=157&amp;lt;/code&amp;gt;,&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &amp;lt;code&amp;gt;m=32363&amp;lt;/code&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;and &lt;/ins&gt;&amp;lt;code&amp;gt;g=157&amp;lt;/code&amp;gt;,&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &amp;lt;code&amp;gt;m=147483647&amp;lt;/code&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;i &lt;/del&gt;&amp;lt;code&amp;gt;g=16807&amp;lt;/code&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &amp;lt;code&amp;gt;m=147483647&amp;lt;/code&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;and &lt;/ins&gt;&amp;lt;code&amp;gt;g=16807&amp;lt;/code&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;''Second part'': '''spectral test''' (1 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;''Second part'': '''spectral test''' (1 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Lgraczyk</name></author>	</entry>

	<entry>
		<id>http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_6_EN&amp;diff=2896&amp;oldid=prev</id>
		<title>Lgraczyk: /* Attention */</title>
		<link rel="alternate" type="text/html" href="http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_6_EN&amp;diff=2896&amp;oldid=prev"/>
				<updated>2022-04-04T12:02:47Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Attention&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 12:02, 4 April 2022&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 70:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 70:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Attention ==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== Attention ==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* '''&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Czytamy dokładnie Wykład &lt;/del&gt;4 ([http://www.if.pw.edu.pl/~lgraczyk/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;KADD2019&lt;/del&gt;/Wyklad4-&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;2019&lt;/del&gt;.pdf link]), &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;zwłaszcza slajdy &lt;/del&gt;6 &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;oraz 18&lt;/del&gt;-25&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* '''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Read carefully the Lecture &lt;/ins&gt;4 ([http://www.if.pw.edu.pl/~lgraczyk/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;KADD2022&lt;/ins&gt;/Wyklad4-&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;2022&lt;/ins&gt;.pdf link]), &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;especially slids &lt;/ins&gt;6 &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;and 8&lt;/ins&gt;-25&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* '''&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Na samym początku&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;przed losowaniem&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;musimy samodzielnie ustawić wartość pierwszej liczby pseudolosowej &lt;/del&gt;x0 (&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;tzw. ziarno, &lt;/del&gt;&amp;quot;seed&amp;quot;). &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Jeżeli chcemy&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;by za każdym razem liczby pseudolosowe były inne, możemy je ustawić z zegara systemowego&lt;/del&gt;:'''&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* '''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;At the beginning&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;before random number generation&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;we need to set the first number from the series &lt;/ins&gt;x0 (&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;so called &lt;/ins&gt;&amp;quot;seed&amp;quot;). &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;If we want that every time the random numbers are different&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;we can set the seed from the system clock&lt;/ins&gt;:'''&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;  x0 = time(NULL);&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp;  x0 = time(NULL);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Parametry histogramów z obrazków poniżej&lt;/del&gt;:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;PArameters of the histograms shown below&lt;/ins&gt;:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; TH1D *hUniform = new TH1D(&amp;quot;hUniform&amp;quot;,&amp;quot;Uniform distribution&amp;quot;,100,0,1);&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; TH1D *hUniform = new TH1D(&amp;quot;hUniform&amp;quot;,&amp;quot;Uniform distribution&amp;quot;,100,0,1);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; TH2D *hCorr = new TH2D(&amp;quot;hCorr&amp;quot;,&amp;quot;Correlation&amp;quot;,100,xmin,xmax,100,0,1);&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; TH2D *hCorr = new TH2D(&amp;quot;hCorr&amp;quot;,&amp;quot;Correlation&amp;quot;,100,xmin,xmax,100,0,1);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Ilość losowań w części pierwszej&lt;/del&gt;:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Number of random number generations&lt;/ins&gt;:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; const int N = 1000000;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp;&amp;nbsp; const int N = 1000000;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Wczytywanie danych z pliku&lt;/del&gt;:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Example of reading from the text file&lt;/ins&gt;:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; ifstream ifile;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; ifstream ifile;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; ifile.open(&amp;quot;dane.dat&amp;quot;);&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; ifile.open(&amp;quot;dane.dat&amp;quot;);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 88:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 88:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; ifile.close();&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; ifile.close();&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Zapisywanie danych do pliku&lt;/del&gt;:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Example of writing to the text file&lt;/ins&gt;:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; ofstream ofile;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; ofstream ofile;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; ofile.open(&amp;quot;dane.dat&amp;quot;);&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; ofile.open(&amp;quot;dane.dat&amp;quot;);&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Lgraczyk</name></author>	</entry>

	<entry>
		<id>http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_6_EN&amp;diff=2895&amp;oldid=prev</id>
		<title>Lgraczyk: /* Wynik */</title>
		<link rel="alternate" type="text/html" href="http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_6_EN&amp;diff=2895&amp;oldid=prev"/>
				<updated>2022-04-04T11:58:38Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;span class=&quot;autocomment&quot;&gt;Wynik&lt;/span&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 11:58, 4 April 2022&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 96:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 96:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; ofile.close();&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;nbsp; ofile.close();&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Wynik &lt;/del&gt;==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Results &lt;/ins&gt;==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Przykładowy rozkład dla parametrów&lt;/del&gt;:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Example distribution for parameters&lt;/ins&gt;:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &amp;lt;code&amp;gt;m=97, g=23&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &amp;lt;code&amp;gt;m=97, g=23&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[File:lab06_n97_g23_2.png]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[File:lab06_n97_g23_2.png]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 103:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 103:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[File:lab06_n2147483647_g16807_2.png]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[File:lab06_n2147483647_g16807_2.png]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Przykładowy wynik transformacji rozkładu jednorodnego&lt;/del&gt;:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Example transformation of a uniform distribution&lt;/ins&gt;:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[File:lab06_b_2.png]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[File:lab06_b_2.png]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Lgraczyk</name></author>	</entry>

	<entry>
		<id>http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_6_EN&amp;diff=2894&amp;oldid=prev</id>
		<title>Lgraczyk at 11:58, 4 April 2022</title>
		<link rel="alternate" type="text/html" href="http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_6_EN&amp;diff=2894&amp;oldid=prev"/>
				<updated>2022-04-04T11:58:03Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 11:58, 4 April 2022&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 46:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 46:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;code&amp;gt;g(y) = dx/dy f(x)&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;code&amp;gt;g(y) = dx/dy f(x)&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Teraz jeżeli założymy&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;że gęstość prawdopodobieństwa &lt;/del&gt;&amp;lt;code&amp;gt;f(x)&amp;lt;/code&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;wynosi &lt;/del&gt;1 &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;w &lt;/del&gt;&amp;lt;code&amp;gt;0&amp;lt;=x&amp;lt;=1&amp;lt;/code&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;i &lt;/del&gt;&amp;lt;code&amp;gt;f(x) = 0&amp;lt;/code&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;dla &lt;/del&gt;&amp;lt;code&amp;gt;x&amp;lt;= 0 &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;i &lt;/del&gt;x&amp;gt;1&amp;lt;/code&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;to powyższe równanie możemy zapisać w postaci&lt;/del&gt;:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Now&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;if we assume that the probability density &lt;/ins&gt;&amp;lt;code&amp;gt;f(x)&amp;lt;/code&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;equals &lt;/ins&gt;1 &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;in the range &lt;/ins&gt;&amp;lt;code&amp;gt;0&amp;lt;=x&amp;lt;=1&amp;lt;/code&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;and &lt;/ins&gt;&amp;lt;code&amp;gt;f(x) = 0&amp;lt;/code&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;for &lt;/ins&gt;&amp;lt;code&amp;gt;x&amp;lt;= 0 &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;and &lt;/ins&gt;x&amp;gt;1&amp;lt;/code&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;, then the above formula we can rewrite in the following form&lt;/ins&gt;:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;code&amp;gt;g(y)dy = dx = dG(y),&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;code&amp;gt;g(y)dy = dx = dG(y),&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;gdzie &lt;/del&gt;&amp;lt;code&amp;gt;G(y)&amp;lt;/code&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;jest dystrybuantą zmiennej losowej &lt;/del&gt;&amp;lt;code&amp;gt;Y&amp;lt;/code&amp;gt;. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Co po całkowaniu daje nam&lt;/del&gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;where &lt;/ins&gt;&amp;lt;code&amp;gt;G(y)&amp;lt;/code&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;is a cumulative distribution of the random variable &lt;/ins&gt;&amp;lt;code&amp;gt;Y&amp;lt;/code&amp;gt;. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;After integration this gives us:&lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;code&amp;gt;x = G(y) =&amp;gt; y = G^-1(x).&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;code&amp;gt;x = G(y) =&amp;gt; y = G^-1(x).&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Jeśli zmienna losowa &lt;/del&gt;&amp;lt;code&amp;gt;X&amp;lt;/code&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;ma rozkład jednostajny na odcinku pomiędzy &lt;/del&gt;0 &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;i &lt;/del&gt;1 &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;oraz jeśli znana jest funkcja odwrotna &lt;/del&gt;&amp;lt;code&amp;gt;G^-1(x)&amp;lt;/code&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;to funkcja &lt;/del&gt;&amp;lt;code&amp;gt;g(y)&amp;lt;/code&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;opisuje gęstość prawdopodobieństwa rozkładu zmiennej losowej &lt;/del&gt;Y.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;If the random variable &lt;/ins&gt;&amp;lt;code&amp;gt;X&amp;lt;/code&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;has a uniform distribution between &lt;/ins&gt;0 &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;and &lt;/ins&gt;1 &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;and we know the inverse function&amp;nbsp; &lt;/ins&gt;&amp;lt;code&amp;gt;G^-1(x)&amp;lt;/code&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;then the function &lt;/ins&gt;&amp;lt;code&amp;gt;g(y)&amp;lt;/code&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;describes the probability distribution of the random variable &lt;/ins&gt;Y.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Używając tej metody należy wygenerować &lt;/del&gt;10000 &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;liczb z rozkładu&lt;/del&gt;:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;By using this method please generate &lt;/ins&gt;10000 &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;numbers from the distribution&lt;/ins&gt;:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[File:Lab06_wzor.png]]&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;[[File:Lab06_wzor.png]]&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Dla &lt;/del&gt;&amp;lt;code&amp;gt;tau = 2&amp;lt;/code&amp;gt;:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;For &lt;/ins&gt;&amp;lt;code&amp;gt;tau = 2&amp;lt;/code&amp;gt;:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Należy wygenerować &lt;/del&gt;10000 &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;liczb z rozkładu &lt;/del&gt;0 &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;do &lt;/del&gt;1 &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;używając generatora z części pierwszej &lt;/del&gt;('''&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;zapisać do pliku wartości &lt;/del&gt;xn &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;makrem z pierwszej części &lt;/del&gt;a &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;następnie je wczytać w makrze z części drugiej&lt;/del&gt;''').&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Generate &lt;/ins&gt;10000 &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;numbers from the distribution from &lt;/ins&gt;0 &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;to &lt;/ins&gt;1 &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;using a generator from the first part &lt;/ins&gt;('''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;save in the file values of &lt;/ins&gt;xn &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;with &lt;/ins&gt;a &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;macro from the first file, in order to read them by a macro from the second part.&lt;/ins&gt;''').&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Analitycznie &lt;/del&gt;(&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;na kartce&lt;/del&gt;) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;policzyć dystrybuantę tego rozkładu&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;a następnie funkcję odwrotną&lt;/del&gt;. (1 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Analytically &lt;/ins&gt;(&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;on the piece of paper&lt;/ins&gt;)&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;calculate the cumulative distribution of this formula&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;then you need to invert it&lt;/ins&gt;. (1 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Wygenerować rozkład &lt;/del&gt;&amp;lt;code&amp;gt;f(x)&amp;lt;/code&amp;gt; - &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;wrzucając wygenerowane wartości do histogramu &lt;/del&gt;- korzystając z: (1 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Generate a distribution &lt;/ins&gt;&amp;lt;code&amp;gt;f(x)&amp;lt;/code&amp;gt; - &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;putting generated values into a histogram &lt;/ins&gt;- korzystając z: (1 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;** &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;liczb wygenerowanych wcześniej i wczytanych z plików &lt;/del&gt;&amp;lt;code&amp;gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;losowe1&lt;/del&gt;.dat, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;losowe2&lt;/del&gt;.dat, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;losowe3&lt;/del&gt;.dat&amp;lt;/code&amp;gt;,&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;** &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;numbers generated before and read from files&lt;/ins&gt;&amp;lt;code&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;random1&lt;/ins&gt;.dat, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;random2&lt;/ins&gt;.dat, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;random3&lt;/ins&gt;.dat&amp;lt;/code&amp;gt;,&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;** &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;standardowego generatora &lt;/del&gt;ROOT&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'a&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;np&lt;/del&gt;. &amp;lt;code&amp;gt;gRandom-&amp;gt;Uniform(1)&amp;lt;/code&amp;gt; (&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;obiekt &lt;/del&gt;gRandom &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;istnieje domyślnie w uruchomionej instancji &lt;/del&gt;ROOT&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;; można oczywiście również stworzyć samodzielnie obiekt &lt;/del&gt;TRandom - [https://root.cern.ch/root/html534/TRandom.html link]). &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;** &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;standard generator implemented in &lt;/ins&gt;ROOT, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;i.&lt;/ins&gt;.&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;e &lt;/ins&gt;&amp;lt;code&amp;gt;gRandom-&amp;gt;Uniform(1)&amp;lt;/code&amp;gt; (&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;the object &lt;/ins&gt;gRandom &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;exists in the default instance of &lt;/ins&gt;ROOT&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;, you can also create it by using &lt;/ins&gt;TRandom &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;objects via a standard way by using a constructor &lt;/ins&gt;- [https://root.cern.ch/root/html534/TRandom.html link]). &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Narysować na jednym wykresie &lt;/del&gt;histogram (&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;odpowiednio unormowany&lt;/del&gt;) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;oraz funkcję teoretyczną &lt;/del&gt;&amp;lt;code&amp;gt;f(x)&amp;lt;/code&amp;gt; (&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;obiekt &lt;/del&gt;&amp;lt;code&amp;gt;TF1&amp;lt;/code&amp;gt;). (1 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Draw on a single plot the &lt;/ins&gt;histogram (&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;normalized&lt;/ins&gt;) &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;and the theoretical function &lt;/ins&gt;&amp;lt;code&amp;gt;f(x)&amp;lt;/code&amp;gt; (&amp;lt;code&amp;gt;TF1&amp;lt;/code&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;object&lt;/ins&gt;). (1 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Uwagi &lt;/del&gt;==&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;== &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Attention &lt;/ins&gt;==&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* '''Czytamy dokładnie Wykład 4 ([http://www.if.pw.edu.pl/~lgraczyk/KADD2019/Wyklad4-2019.pdf link]), zwłaszcza slajdy 6 oraz 18-25&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* '''Czytamy dokładnie Wykład 4 ([http://www.if.pw.edu.pl/~lgraczyk/KADD2019/Wyklad4-2019.pdf link]), zwłaszcza slajdy 6 oraz 18-25&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* '''Na samym początku, przed losowaniem, musimy samodzielnie ustawić wartość pierwszej liczby pseudolosowej x0 (tzw. ziarno, &amp;quot;seed&amp;quot;). Jeżeli chcemy, by za każdym razem liczby pseudolosowe były inne, możemy je ustawić z zegara systemowego:'''&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* '''Na samym początku, przed losowaniem, musimy samodzielnie ustawić wartość pierwszej liczby pseudolosowej x0 (tzw. ziarno, &amp;quot;seed&amp;quot;). Jeżeli chcemy, by za każdym razem liczby pseudolosowe były inne, możemy je ustawić z zegara systemowego:'''&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Lgraczyk</name></author>	</entry>

	<entry>
		<id>http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_6_EN&amp;diff=2893&amp;oldid=prev</id>
		<title>Lgraczyk at 11:34, 4 April 2022</title>
		<link rel="alternate" type="text/html" href="http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_6_EN&amp;diff=2893&amp;oldid=prev"/>
				<updated>2022-04-04T11:34:55Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 11:34, 4 April 2022&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 40:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 40:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;As a result, we should have three spectral tests.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;As a result, we should have three spectral tests.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;''&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Część trzecia&lt;/del&gt;'': '''&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;generacja liczb losowych oparta na transformacji rozkładu jednorodnego&lt;/del&gt;''' (3 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Third part&lt;/ins&gt;'': '''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;generation of pseudorandom numbers based on transformation of a uniform distribution&lt;/ins&gt;''' (3 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Dowolna funkcja zmiennej losowej jest zmienną losową&lt;/del&gt;. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Powstaje więc pytanie jaka jest gęstość zmiennej losowej &lt;/del&gt;Y &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;jeżeli znana jest gęstość &lt;/del&gt;&amp;lt;code&amp;gt;f(x)&amp;lt;/code&amp;gt;. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Zakładamy&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;że prawdopodobieństwo &lt;/del&gt;&amp;lt;code&amp;gt;g(y)dy&amp;lt;/code&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;jest równe &lt;/del&gt;&amp;lt;code&amp;gt;f(x)dx&amp;lt;/code&amp;gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;gdzie &lt;/del&gt;&amp;lt;code&amp;gt;dx&amp;lt;/code&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;odpowiada wartością &lt;/del&gt;&amp;lt;code&amp;gt;dy&amp;lt;/code&amp;gt;. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Warunek jest spełniony dla odpowiednio małych &lt;/del&gt;&amp;lt;code&amp;gt;dx&amp;lt;/code&amp;gt;. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Wynika stąd, że&lt;/del&gt;:&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Each function of the random variable is also a random variable&lt;/ins&gt;. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;What is the probability distribution of a random variable &lt;/ins&gt;Y&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;, if the probability distribution of X, &lt;/ins&gt;&amp;lt;code&amp;gt;f(x)&amp;lt;/code&amp;gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;, is known&lt;/ins&gt;. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;We assume&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;that the probability &lt;/ins&gt;&amp;lt;code&amp;gt;g(y)dy&amp;lt;/code&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;is equal to &lt;/ins&gt;&amp;lt;code&amp;gt;f(x)dx&amp;lt;/code&amp;gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;where&amp;nbsp; &lt;/ins&gt;&amp;lt;code&amp;gt;dx&amp;lt;/code&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;equals &lt;/ins&gt;&amp;lt;code&amp;gt;dy&amp;lt;/code&amp;gt;. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;The condition is of course fulfilled for (infinitely) small &lt;/ins&gt;&amp;lt;code&amp;gt;dx&amp;lt;/code&amp;gt;. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;What results from this is the following&lt;/ins&gt;:&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;code&amp;gt;g(y) = dx/dy f(x)&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&amp;lt;code&amp;gt;g(y) = dx/dy f(x)&amp;lt;/code&amp;gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Lgraczyk</name></author>	</entry>

	<entry>
		<id>http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_6_EN&amp;diff=2892&amp;oldid=prev</id>
		<title>Lgraczyk at 11:31, 4 April 2022</title>
		<link rel="alternate" type="text/html" href="http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_6_EN&amp;diff=2892&amp;oldid=prev"/>
				<updated>2022-04-04T11:31:09Z</updated>
		
		<summary type="html">&lt;p&gt;&lt;/p&gt;
&lt;table style=&quot;background-color: white; color:black;&quot;&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
			&lt;col class='diff-marker' /&gt;
			&lt;col class='diff-content' /&gt;
		&lt;tr valign='top'&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;← Older revision&lt;/td&gt;
		&lt;td colspan='2' style=&quot;background-color: white; color:black;&quot;&gt;Revision as of 11:31, 4 April 2022&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 30:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 30:&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &amp;lt;code&amp;gt;m=147483647&amp;lt;/code&amp;gt; i &amp;lt;code&amp;gt;g=16807&amp;lt;/code&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &amp;lt;code&amp;gt;m=147483647&amp;lt;/code&amp;gt; i &amp;lt;code&amp;gt;g=16807&amp;lt;/code&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;''&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Część druga&lt;/del&gt;'': '''test &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;widmowy&lt;/del&gt;''' (1 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Second part&lt;/ins&gt;'': '''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;spectral &lt;/ins&gt;test''' (1 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Należy przeprowadzić &lt;/del&gt;test &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;widmowy aby przetestować jakość generatora&lt;/del&gt;. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;By &lt;/del&gt;to &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;zrobić należy narysować na płaszczyźnie punkty o współrzędnych &lt;/del&gt;&amp;lt;code&amp;gt;(x[n], x[n+1])&amp;lt;/code&amp;gt;. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Uzyskany obraz utworzy wzór przypominający widmo generatora &lt;/del&gt;- &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;stąd nazwa testu&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Please perform a spectral &lt;/ins&gt;test &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;to see what is the quality of the generator&lt;/ins&gt;. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;In order &lt;/ins&gt;to &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;do so please draw plot on the&amp;nbsp; &lt;/ins&gt;&amp;lt;code&amp;gt;(x[n], x[n+1])&amp;lt;/code&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;points from generated numbers&lt;/ins&gt;. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;The obtained graph will show a spectral pattern of the generator &lt;/ins&gt;- &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;hence the name of the test&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Jeśli punkty będą rozłożone równomiernie generator można uznać za dobry&lt;/del&gt;. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Jeśli zdecydowanie widać pewną okresowość &lt;/del&gt;- &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;punkty powtarzają się wielokrotnie - generator nie działa poprawnie&lt;/del&gt;. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Oczywiście na rozłożenie punktów wpływa jedynie dobór parametrów &lt;/del&gt;&amp;lt;code&amp;gt;g&amp;lt;/code&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;i &lt;/del&gt;&amp;lt;code&amp;gt;m&amp;lt;/code&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;If the points are distributed uniformly, the test can be judged good&lt;/ins&gt;. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;If they show a certain periodic pattern &lt;/ins&gt;- &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;the test doesn't work properly&lt;/ins&gt;. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Of course, for the position of the points what maters are the parameters &lt;/ins&gt;&amp;lt;code&amp;gt;g&amp;lt;/code&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;and &lt;/ins&gt;&amp;lt;code&amp;gt;m&amp;lt;/code&amp;gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Do tworzenia wykresów widma poleca się użycie obiektów &lt;/del&gt;&amp;lt;code&amp;gt;TH2D&amp;lt;/code&amp;gt;. &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;In order to draw spectral test, please use &lt;/ins&gt;&amp;lt;code&amp;gt;TH2D&amp;lt;/code&amp;gt;. &amp;nbsp;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt;-&lt;/td&gt;&lt;td style=&quot;background: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Wynikiem powinny być trzy wykresy widma&lt;/del&gt;.&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt;+&lt;/td&gt;&lt;td style=&quot;background: #cfc; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;As a result, we should have three spectral tests&lt;/ins&gt;.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;''Część trzecia'': '''generacja liczb losowych oparta na transformacji rozkładu jednorodnego''' (3 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;td class='diff-marker'&gt; &lt;/td&gt;&lt;td style=&quot;background: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;''Część trzecia'': '''generacja liczb losowych oparta na transformacji rozkładu jednorodnego''' (3 pkt.)&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Lgraczyk</name></author>	</entry>

	<entry>
		<id>http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_6_EN&amp;diff=2891&amp;oldid=prev</id>
		<title>Lgraczyk: Created page with &quot;{| align=&quot;right&quot; | __TOC__ |}   == Exercise ==  ''Part one'': '''linear congruent generator of pseudorandom numbers''' (1 pkt.)  Please write a generator of pseudorandom numbers ...&quot;</title>
		<link rel="alternate" type="text/html" href="http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_6_EN&amp;diff=2891&amp;oldid=prev"/>
				<updated>2022-04-04T11:26:55Z</updated>
		
		<summary type="html">&lt;p&gt;Created page with &amp;quot;{| align=&amp;quot;right&amp;quot; | __TOC__ |}   == Exercise ==  &amp;#39;&amp;#39;Part one&amp;#39;&amp;#39;: &amp;#39;&amp;#39;&amp;#39;linear congruent generator of pseudorandom numbers&amp;#39;&amp;#39;&amp;#39; (1 pkt.)  Please write a generator of pseudorandom numbers ...&amp;quot;&lt;/p&gt;
&lt;p&gt;&lt;b&gt;New page&lt;/b&gt;&lt;/p&gt;&lt;div&gt;{| align=&amp;quot;right&amp;quot;&lt;br /&gt;
| __TOC__&lt;br /&gt;
|}&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
== Exercise ==&lt;br /&gt;
&lt;br /&gt;
''Part one'': '''linear congruent generator of pseudorandom numbers''' (1 pkt.)&lt;br /&gt;
&lt;br /&gt;
Please write a generator of pseudorandom numbers and save generated numbers into a file.&lt;br /&gt;
&lt;br /&gt;
The generator should be based on the following formula:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;x[j+1] = (g*x[j] + c) mod m.&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
This generator is called LCG - linear congruent generator. Providing the first (beginning) number &amp;lt;code&amp;gt;x[0]&amp;lt;/code&amp;gt; defines the whole series, which is periodic. The period depends on the parameters and under certain conditions it reaches maximum value of &amp;lt;code&amp;gt;m&amp;lt;/code&amp;gt;. These conditions are:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;c&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;m&amp;lt;/code&amp;gt; do not have joint divisors,&lt;br /&gt;
* &amp;lt;code&amp;gt;b = g-1&amp;lt;/code&amp;gt; is a multiply of every prime number &amp;lt;code&amp;gt;p&amp;lt;/code&amp;gt;, which is a divisor of a number &amp;lt;code&amp;gt;m&amp;lt;/code&amp;gt;,&lt;br /&gt;
* &amp;lt;code&amp;gt;b&amp;lt;/code&amp;gt; is a multiply of 4 if &amp;lt;code&amp;gt;n&amp;lt;/code&amp;gt; is also a multiply of 4. &lt;br /&gt;
&lt;br /&gt;
For simplicity we can uuse &amp;lt;code&amp;gt;c = 0&amp;lt;/code&amp;gt;, and in that case we get a multiplicative generator (MLCG).&lt;br /&gt;
&lt;br /&gt;
* Value of &amp;lt;code&amp;gt;g&amp;lt;/code&amp;gt; and &amp;lt;code&amp;gt;m&amp;lt;/code&amp;gt; should be easy to modify in the program. &lt;br /&gt;
&lt;br /&gt;
The result of the macro execution should be a file with the name name.dat containing a series of generated numbers for a given set of parameters. The macro should be executed three times, resulting in three files: &amp;lt;code&amp;gt;random1.dat, random2.dat, random3.dat&amp;lt;/code&amp;gt;, for the following parameters, respectively:&lt;br /&gt;
&lt;br /&gt;
* &amp;lt;code&amp;gt;m=97&amp;lt;/code&amp;gt; i &amp;lt;code&amp;gt;g=23&amp;lt;/code&amp;gt;,&lt;br /&gt;
* &amp;lt;code&amp;gt;m=32363&amp;lt;/code&amp;gt; i &amp;lt;code&amp;gt;g=157&amp;lt;/code&amp;gt;,&lt;br /&gt;
* &amp;lt;code&amp;gt;m=147483647&amp;lt;/code&amp;gt; i &amp;lt;code&amp;gt;g=16807&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
''Część druga'': '''test widmowy''' (1 pkt.)&lt;br /&gt;
&lt;br /&gt;
Należy przeprowadzić test widmowy aby przetestować jakość generatora. By to zrobić należy narysować na płaszczyźnie punkty o współrzędnych &amp;lt;code&amp;gt;(x[n], x[n+1])&amp;lt;/code&amp;gt;. Uzyskany obraz utworzy wzór przypominający widmo generatora - stąd nazwa testu.&lt;br /&gt;
&lt;br /&gt;
Jeśli punkty będą rozłożone równomiernie generator można uznać za dobry. Jeśli zdecydowanie widać pewną okresowość - punkty powtarzają się wielokrotnie - generator nie działa poprawnie. Oczywiście na rozłożenie punktów wpływa jedynie dobór parametrów &amp;lt;code&amp;gt;g&amp;lt;/code&amp;gt; i &amp;lt;code&amp;gt;m&amp;lt;/code&amp;gt;.&lt;br /&gt;
&lt;br /&gt;
* Do tworzenia wykresów widma poleca się użycie obiektów &amp;lt;code&amp;gt;TH2D&amp;lt;/code&amp;gt;. &lt;br /&gt;
&lt;br /&gt;
Wynikiem powinny być trzy wykresy widma.&lt;br /&gt;
&lt;br /&gt;
''Część trzecia'': '''generacja liczb losowych oparta na transformacji rozkładu jednorodnego''' (3 pkt.)&lt;br /&gt;
&lt;br /&gt;
Dowolna funkcja zmiennej losowej jest zmienną losową. Powstaje więc pytanie jaka jest gęstość zmiennej losowej Y jeżeli znana jest gęstość &amp;lt;code&amp;gt;f(x)&amp;lt;/code&amp;gt;. Zakładamy, że prawdopodobieństwo &amp;lt;code&amp;gt;g(y)dy&amp;lt;/code&amp;gt; jest równe &amp;lt;code&amp;gt;f(x)dx&amp;lt;/code&amp;gt;, gdzie &amp;lt;code&amp;gt;dx&amp;lt;/code&amp;gt; odpowiada wartością &amp;lt;code&amp;gt;dy&amp;lt;/code&amp;gt;. Warunek jest spełniony dla odpowiednio małych &amp;lt;code&amp;gt;dx&amp;lt;/code&amp;gt;. Wynika stąd, że:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;g(y) = dx/dy f(x)&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Teraz jeżeli założymy, że gęstość prawdopodobieństwa &amp;lt;code&amp;gt;f(x)&amp;lt;/code&amp;gt; wynosi 1 w &amp;lt;code&amp;gt;0&amp;lt;=x&amp;lt;=1&amp;lt;/code&amp;gt; i &amp;lt;code&amp;gt;f(x) = 0&amp;lt;/code&amp;gt; dla &amp;lt;code&amp;gt;x&amp;lt;= 0 i x&amp;gt;1&amp;lt;/code&amp;gt; to powyższe równanie możemy zapisać w postaci:&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;g(y)dy = dx = dG(y),&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
gdzie &amp;lt;code&amp;gt;G(y)&amp;lt;/code&amp;gt; jest dystrybuantą zmiennej losowej &amp;lt;code&amp;gt;Y&amp;lt;/code&amp;gt;. Co po całkowaniu daje nam&lt;br /&gt;
&lt;br /&gt;
&amp;lt;code&amp;gt;x = G(y) =&amp;gt; y = G^-1(x).&amp;lt;/code&amp;gt;&lt;br /&gt;
&lt;br /&gt;
Jeśli zmienna losowa &amp;lt;code&amp;gt;X&amp;lt;/code&amp;gt; ma rozkład jednostajny na odcinku pomiędzy 0 i 1 oraz jeśli znana jest funkcja odwrotna &amp;lt;code&amp;gt;G^-1(x)&amp;lt;/code&amp;gt; to funkcja &amp;lt;code&amp;gt;g(y)&amp;lt;/code&amp;gt; opisuje gęstość prawdopodobieństwa rozkładu zmiennej losowej Y.&lt;br /&gt;
&lt;br /&gt;
Używając tej metody należy wygenerować 10000 liczb z rozkładu:&lt;br /&gt;
&lt;br /&gt;
[[File:Lab06_wzor.png]]&lt;br /&gt;
&lt;br /&gt;
Dla &amp;lt;code&amp;gt;tau = 2&amp;lt;/code&amp;gt;:&lt;br /&gt;
&lt;br /&gt;
* Należy wygenerować 10000 liczb z rozkładu 0 do 1 używając generatora z części pierwszej ('''zapisać do pliku wartości xn makrem z pierwszej części a następnie je wczytać w makrze z części drugiej''').&lt;br /&gt;
* Analitycznie (na kartce) policzyć dystrybuantę tego rozkładu, a następnie funkcję odwrotną. (1 pkt.)&lt;br /&gt;
* Wygenerować rozkład &amp;lt;code&amp;gt;f(x)&amp;lt;/code&amp;gt; - wrzucając wygenerowane wartości do histogramu - korzystając z: (1 pkt.)&lt;br /&gt;
** liczb wygenerowanych wcześniej i wczytanych z plików &amp;lt;code&amp;gt;losowe1.dat, losowe2.dat, losowe3.dat&amp;lt;/code&amp;gt;,&lt;br /&gt;
** standardowego generatora ROOT'a, np. &amp;lt;code&amp;gt;gRandom-&amp;gt;Uniform(1)&amp;lt;/code&amp;gt; (obiekt gRandom istnieje domyślnie w uruchomionej instancji ROOT; można oczywiście również stworzyć samodzielnie obiekt TRandom - [https://root.cern.ch/root/html534/TRandom.html link]). &lt;br /&gt;
* Narysować na jednym wykresie histogram (odpowiednio unormowany) oraz funkcję teoretyczną &amp;lt;code&amp;gt;f(x)&amp;lt;/code&amp;gt; (obiekt &amp;lt;code&amp;gt;TF1&amp;lt;/code&amp;gt;). (1 pkt.)&lt;br /&gt;
&lt;br /&gt;
== Uwagi ==&lt;br /&gt;
* '''Czytamy dokładnie Wykład 4 ([http://www.if.pw.edu.pl/~lgraczyk/KADD2019/Wyklad4-2019.pdf link]), zwłaszcza slajdy 6 oraz 18-25&lt;br /&gt;
* '''Na samym początku, przed losowaniem, musimy samodzielnie ustawić wartość pierwszej liczby pseudolosowej x0 (tzw. ziarno, &amp;quot;seed&amp;quot;). Jeżeli chcemy, by za każdym razem liczby pseudolosowe były inne, możemy je ustawić z zegara systemowego:'''&lt;br /&gt;
   x0 = time(NULL);&lt;br /&gt;
* Parametry histogramów z obrazków poniżej:&lt;br /&gt;
  TH1D *hUniform = new TH1D(&amp;quot;hUniform&amp;quot;,&amp;quot;Uniform distribution&amp;quot;,100,0,1);&lt;br /&gt;
  TH2D *hCorr = new TH2D(&amp;quot;hCorr&amp;quot;,&amp;quot;Correlation&amp;quot;,100,xmin,xmax,100,0,1);&lt;br /&gt;
* Ilość losowań w części pierwszej:&lt;br /&gt;
  const int N = 1000000;&lt;br /&gt;
* Wczytywanie danych z pliku:&lt;br /&gt;
 ifstream ifile;&lt;br /&gt;
 ifile.open(&amp;quot;dane.dat&amp;quot;);&lt;br /&gt;
 double val;&lt;br /&gt;
 while(ifile&amp;gt;&amp;gt;val)&lt;br /&gt;
 {&lt;br /&gt;
   cout&amp;lt;&amp;lt;val&amp;lt;&amp;lt;endl;&lt;br /&gt;
 }&lt;br /&gt;
 ifile.close();&lt;br /&gt;
&lt;br /&gt;
* Zapisywanie danych do pliku:&lt;br /&gt;
 ofstream ofile;&lt;br /&gt;
 ofile.open(&amp;quot;dane.dat&amp;quot;);&lt;br /&gt;
 for(int i=0;i&amp;lt;N;i++)&lt;br /&gt;
   ofile&amp;lt;&amp;lt;val&amp;lt;&amp;lt;endl;&lt;br /&gt;
 }&lt;br /&gt;
 ofile.close();&lt;br /&gt;
&lt;br /&gt;
== Wynik ==&lt;br /&gt;
Przykładowy rozkład dla parametrów:&lt;br /&gt;
* &amp;lt;code&amp;gt;m=97, g=23&amp;lt;/code&amp;gt;&lt;br /&gt;
[[File:lab06_n97_g23_2.png]]&lt;br /&gt;
* &amp;lt;code&amp;gt;m=2147483647, g=16807&amp;lt;/code&amp;gt;&lt;br /&gt;
[[File:lab06_n2147483647_g16807_2.png]]&lt;br /&gt;
&lt;br /&gt;
Przykładowy wynik transformacji rozkładu jednorodnego:&lt;br /&gt;
&lt;br /&gt;
&lt;br /&gt;
[[File:lab06_b_2.png]]&lt;/div&gt;</summary>
		<author><name>Lgraczyk</name></author>	</entry>

	</feed>