<?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_7_EN</id>
		<title>KADD 2022 Laboratorium 7 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_7_EN"/>
		<link rel="alternate" type="text/html" href="http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_7_EN&amp;action=history"/>
		<updated>2026-07-22T09:55:07Z</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_7_EN&amp;diff=2913&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_7_EN&amp;diff=2913&amp;oldid=prev"/>
				<updated>2022-04-11T11:52: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 11:52, 11 April 2022&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 35:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 35:&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;* Read carefully '''Lecture 5''' [http://www.if.pw.edu.pl/~lgraczyk/KADD2022/Wyklad5-2022.pdf link] slides 9-&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;19&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;* Read carefully '''Lecture 5''' [http://www.if.pw.edu.pl/~lgraczyk/KADD2022/Wyklad5-2022.pdf link] slides 9-&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;17&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;* To generate numbers from the uniform distribution, use function &amp;lt;code&amp;gt;Uniform&amp;lt;/code&amp;gt; from class &amp;lt;code&amp;gt;TRandom&amp;lt;/code&amp;gt; OR the '''generator written last time'''&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;* To generate numbers from the uniform distribution, use function &amp;lt;code&amp;gt;Uniform&amp;lt;/code&amp;gt; from class &amp;lt;code&amp;gt;TRandom&amp;lt;/code&amp;gt; OR the '''generator written last time'''&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;* Remember, always accept points below the curve to all generated points.&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;* Remember, always accept points below the curve to all generated points.&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_7_EN&amp;diff=2912&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_7_EN&amp;diff=2912&amp;oldid=prev"/>
				<updated>2022-04-11T11:52:06Z</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 11:52, 11 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 helper function we will use a linear function.'''&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 helper function we will use a linear function.'''&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;* In the case of integration using a helper function, we always choose it in such a way that it is possible to generate the number from its distribution in an easy way (by inverting the cumulative distribution function) - in other words, we convert the rectangle (two uniform distributions) to another area inside which we draw (we must be able to draw numbers from this area)&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;* In the case of integration using a helper function, we always choose it in such a way that it is possible to generate the number from its distribution in an easy way (by inverting the cumulative distribution function) - in other words, we convert the rectangle (two uniform distributions) to another area inside which we draw (we must be able to draw numbers from this area)&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;* Quadratic function and its inverse:&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;* Quadratic function and its inverse &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;function&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:Odwracanie_kwadratowej.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:Odwracanie_kwadratowej.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_7_EN&amp;diff=2911&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_7_EN&amp;diff=2911&amp;oldid=prev"/>
				<updated>2022-04-11T11:51:57Z</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 11:51, 11 April 2022&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 35:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 35:&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;* Read carefully '''&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;LEcture &lt;/del&gt;5''' [http://www.if.pw.edu.pl/~lgraczyk/KADD2022/Wyklad5-2022.pdf link] slides 9-19&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;* Read carefully '''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Lecture &lt;/ins&gt;5''' [http://www.if.pw.edu.pl/~lgraczyk/KADD2022/Wyklad5-2022.pdf link] slides 9-19&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;* To generate numbers from the uniform distribution, use function &amp;lt;code&amp;gt;Uniform&amp;lt;/code&amp;gt; from class &amp;lt;code&amp;gt;TRandom&amp;lt;/code&amp;gt; OR the '''generator written last time'''&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;* To generate numbers from the uniform distribution, use function &amp;lt;code&amp;gt;Uniform&amp;lt;/code&amp;gt; from class &amp;lt;code&amp;gt;TRandom&amp;lt;/code&amp;gt; OR the '''generator written last time'''&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;* Remember, always accept points below the curve to all generated points.&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;* Remember, always accept points below the curve to all generated points.&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_7_EN&amp;diff=2910&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_7_EN&amp;diff=2910&amp;oldid=prev"/>
				<updated>2022-04-11T11:51:48Z</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 11:51, 11 April 2022&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 35:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 35:&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 &lt;/del&gt;'''&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Wykład &lt;/del&gt;5''' [http://www.if.pw.edu.pl/~lgraczyk/&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;KADD2019&lt;/del&gt;/Wyklad5-&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;2019&lt;/del&gt;.pdf link] &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;slajdy &lt;/del&gt;9-19&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 &lt;/ins&gt;'''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;LEcture &lt;/ins&gt;5''' [http://www.if.pw.edu.pl/~lgraczyk/&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;KADD2022&lt;/ins&gt;/Wyklad5-&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;2022&lt;/ins&gt;.pdf link] &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;slides &lt;/ins&gt;9-19&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;Do generowania liczb z rozkładu jednorodnego używamy funkcji &lt;/del&gt;&amp;lt;code&amp;gt;Uniform&amp;lt;/code&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;z klasy &lt;/del&gt;&amp;lt;code&amp;gt;TRandom&amp;lt;/code&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;lub &lt;/del&gt;'''&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;generatora napisanego w poprzednim zadaniu&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;To generate numbers from the uniform distribution, use function &lt;/ins&gt;&amp;lt;code&amp;gt;Uniform&amp;lt;/code&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;from class &lt;/ins&gt;&amp;lt;code&amp;gt;TRandom&amp;lt;/code&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;OR the &lt;/ins&gt;'''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;generator written last time&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;Pamiętajmy&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;że zawsze akceptujemy wylosowane punkty pod zadaną krzywą w stosunku do wszystkich wylosowanych (stosunek ten ma się do siebie (dla N dążących do nieskończoności) jak stosunki powierzchni obszarów wewnątrz których zostało dokonane losowanie)&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;Remember&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;always accept points below the curve to all generated points.&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;Jako funkcję pomocniczą przyjmujemy funkcję liniową&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 helper function we will use a linear function&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;W przypadku całkowania z wykorzystaniem funkcji pomocniczej zawsze dobieramy ją w taki sposób&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;aby można było wygenerować liczbę z jej rozkładu w łatwy sposób &lt;/del&gt;(&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;za pomocą odwracania dystrybuanty&lt;/del&gt;) - &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;innymi słowy&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;zamieniamy prostokąt &lt;/del&gt;(&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;dwa rozkłady jednorodne&lt;/del&gt;) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;na inny obszar, wewnatrz którego dokonujemy losowań &lt;/del&gt;(&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;musimy umieć wylosować liczby z tego obszaru&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;In the case of integration using a helper function&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;we always choose it in such a way that it is possible to generate the number from its distribution in an easy way &lt;/ins&gt;(&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;by inverting the cumulative distribution function&lt;/ins&gt;) - &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;in other words&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;we convert the rectangle &lt;/ins&gt;(&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;two uniform distributions&lt;/ins&gt;) &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;to another area inside which we draw &lt;/ins&gt;(&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;we must be able to draw numbers from this area&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;&amp;#160;&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;Quadratic function and its inverse&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;Funkcja kwadratowa i jej odwrotność&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;/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:Odwracanie_kwadratowej.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:Odwracanie_kwadratowej.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_7_EN&amp;diff=2909&amp;oldid=prev</id>
		<title>Lgraczyk at 11:48, 11 April 2022</title>
		<link rel="alternate" type="text/html" href="http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_7_EN&amp;diff=2909&amp;oldid=prev"/>
				<updated>2022-04-11T11:48:20Z</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:48, 11 April 2022&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 24:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 24:&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;double integra;VonNeumann(TF1 *g, double min, double max, int n)&amp;lt;/code&amp;gt; - function returning the definite integral&amp;nbsp; (area under the curve) from function g(y) in the range [min,max] with the number of generations n.&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;double integra;VonNeumann(TF1 *g, double min, double max, int n)&amp;lt;/code&amp;gt; - function returning the definite integral&amp;nbsp; (area under the curve) from function g(y) in the range [min,max] with the number of generations n.&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;metoda akceptacji i odrzucania &lt;/del&gt;von &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Neumanna z funkcją pomocniczą&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;Part three&lt;/ins&gt;:'' '''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;acceptance rejection method of &lt;/ins&gt;von &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Neumann with the helper function&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;W celu zwiększenia wydajności metody &lt;/del&gt;von &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Neumanna&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;można posłużyć się ograniczeniem przedziału losowania w postacji zadanej funkcji pomocniczej&lt;/del&gt;. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;W tej części zaimplementować funkcję, która oblicza całkę z funkcji g(y) metodą akceptacji i odrzucania von Neumanna z funkcją pomocniczą &lt;/del&gt;s(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;In order to improve the efficiency of the &lt;/ins&gt;von &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Neumann function&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;we can limit the area of random points generation with the use of a helper function&lt;/ins&gt;. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;In that case we can generate one number from the pair from the &lt;/ins&gt;s(y) &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;helper function, instead 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: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &amp;lt;code&amp;gt;double &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;calkaVonNeumannZPomoc&lt;/del&gt;(TF1 *g, TF1 *s, double min, double max, int n, double &amp;amp;wydajnosc)&amp;lt;/code&amp;gt; - &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;zwraca całkę na przedziale &lt;/del&gt;[min,max] &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;oraz dla zadanej liczby losowań &lt;/del&gt;n. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Ponadto&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;funkcja powinna zwrócić '''przez referencję''' &lt;/del&gt;(&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;ponieważ w języku &lt;/del&gt;C/C++ &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;funkcja nie może zwrócić dwóch wartości&lt;/del&gt;) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;wydajność tej metody&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;* &amp;lt;code&amp;gt;double &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;integralVonNeumannWithHelper&lt;/ins&gt;(TF1 *g, TF1 *s, double min, double max, int n, double &amp;amp;wydajnosc)&amp;lt;/code&amp;gt; - &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;returns the definite integral of the function g(y) in the range &lt;/ins&gt;[min,max] &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;for a given number of generations &lt;/ins&gt;n. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;In addition&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;the function should take as an argument through a reference &lt;/ins&gt;(&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;because in &lt;/ins&gt;C/C++ &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;any function can return only one quantity&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;Funkcję &lt;/del&gt;s(y) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;dobieramy tak, by &lt;/del&gt;'''&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;zawsze&lt;/del&gt;''' &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;znajdowała się powyżej funkcji &lt;/del&gt;g(y) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;i można z niej było łatwo wygenerować liczbę pseudolosową &lt;/del&gt;(&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;na przykład metodą transformacji rozkładu jednorodnego z wykorzystaniem odwrotności dystrybuanty; na wykładzie przykład z funkcją liniową&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;The function &lt;/ins&gt;s(y) &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;we choose &lt;/ins&gt;'''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;always&lt;/ins&gt;''' &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;in a way it is above the function &lt;/ins&gt;g(y) &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;and so that you can easily generate a random number from the s&lt;/ins&gt;(&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;y) distribution (i.e. by applying the transformation of the inverse cumulative distribution, like last time&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;Wszystkie obliczenia należy wykonać dla funkcji typu&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;All calculations please fo for the following function&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;[[File:Lab07_funkcja2.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:Lab07_funkcja2.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;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 5''' [http://www.if.pw.edu.pl/~lgraczyk/KADD2019/Wyklad5-2019.pdf link] slajdy 9-19&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 5''' [http://www.if.pw.edu.pl/~lgraczyk/KADD2019/Wyklad5-2019.pdf link] slajdy 9-19&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;* Do generowania liczb z rozkładu jednorodnego używamy funkcji &amp;lt;code&amp;gt;Uniform&amp;lt;/code&amp;gt; z klasy &amp;lt;code&amp;gt;TRandom&amp;lt;/code&amp;gt; lub '''generatora napisanego w poprzednim zadaniu'''&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;* Do generowania liczb z rozkładu jednorodnego używamy funkcji &amp;lt;code&amp;gt;Uniform&amp;lt;/code&amp;gt; z klasy &amp;lt;code&amp;gt;TRandom&amp;lt;/code&amp;gt; lub '''generatora napisanego w poprzednim zadaniu'''&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_7_EN&amp;diff=2908&amp;oldid=prev</id>
		<title>Lgraczyk at 11:43, 11 April 2022</title>
		<link rel="alternate" type="text/html" href="http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_7_EN&amp;diff=2908&amp;oldid=prev"/>
				<updated>2022-04-11T11:43:44Z</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:43, 11 April 2022&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 19:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 19:&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 g(y) distribution, but the drawback is that you have to generate two numbers, now one. This method will also work if the g(y) function is not a proper probability distribution (it even does not need to be normalized - every function you can always normalize). This allows for a very broad application of the von Neumann method - also to calculate definite integrals, when their analytical form does not exist. This is a typical example of a Monte Carlo method.&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 g(y) distribution, but the drawback is that you have to generate two numbers, now one. This method will also work if the g(y) function is not a proper probability distribution (it even does not need to be normalized - every function you can always normalize). This allows for a very broad application of the von Neumann method - also to calculate definite integrals, when their analytical form does not exist. This is a typical example of a Monte Carlo method.&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 stworzyć trzy &lt;/del&gt;'''&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;bardzo podobne&lt;/del&gt;''' &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;funkcje przyjmujące obiekt typu &lt;/del&gt;&amp;lt;code&amp;gt;TF1&amp;lt;/code&amp;gt;. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Powinny one przyjmować funkcję &lt;/del&gt;g &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;na przedziale &lt;/del&gt;[min,max]:&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 prepare thee &lt;/ins&gt;'''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;very similar&lt;/ins&gt;''' &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;functions taking as argument an object of type &lt;/ins&gt;&amp;lt;code&amp;gt;TF1&amp;lt;/code&amp;gt;. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;The arguments should be the function &lt;/ins&gt;g &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;and the range &lt;/ins&gt;[min,max]:&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;double &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;losujVonNeumann&lt;/del&gt;(TF1 *g, double min, double max)&amp;lt;/code&amp;gt; - &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;funkcja zwraca ''jedną'' liczbę pseudolosową z funkcji &lt;/del&gt;g(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;* &amp;lt;code&amp;gt;double &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;generateVonNeumann&lt;/ins&gt;(TF1 *g, double min, double max)&amp;lt;/code&amp;gt; - &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;function returning a generated pseudo random number from distribution &lt;/ins&gt;g(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: #ffa; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;* &amp;lt;code&amp;gt;double &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;wydajnoscVonNeumann&lt;/del&gt;(TF1 *g, double min, double max, int n)&amp;lt;/code&amp;gt; - &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;funkcja zwraca wydajność metody akceptacji i odrzucania &lt;/del&gt;von &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Neumanna dla danej funkcji &lt;/del&gt;g(y) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;oraz zadanej liczby losowań &lt;/del&gt;n,&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;double &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;efficiencyVonNeumann&lt;/ins&gt;(TF1 *g, double min, double max, int n)&amp;lt;/code&amp;gt; - &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;function returning the efficiency of the &lt;/ins&gt;von &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Neumann method for a given &lt;/ins&gt;g(y) &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;function and the number of generations &lt;/ins&gt;n,&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;double &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;calkaVonNeumann&lt;/del&gt;(TF1 *g, double min, double max, int n)&amp;lt;/code&amp;gt; - &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;funkcja zwraca całkę oznaczoną &lt;/del&gt;(&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;pole powierzchni pod krzywą&lt;/del&gt;) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;z funkcji &lt;/del&gt;g(y) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;na przedzialne &lt;/del&gt;[min,max] &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;przy liczbie losowań &lt;/del&gt;n.&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;double &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;integra;VonNeumann&lt;/ins&gt;(TF1 *g, double min, double max, int n)&amp;lt;/code&amp;gt; - &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;function returning the definite integral&amp;nbsp; &lt;/ins&gt;(&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;area under the curve&lt;/ins&gt;) &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;from function &lt;/ins&gt;g(y) &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;in the range &lt;/ins&gt;[min,max] &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;with the number of generations &lt;/ins&gt;n.&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:'' '''metoda akceptacji i odrzucania von Neumanna z funkcją pomocniczą''' (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;''Część trzecia:'' '''metoda akceptacji i odrzucania von Neumanna z funkcją pomocniczą''' (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_7_EN&amp;diff=2907&amp;oldid=prev</id>
		<title>Lgraczyk at 11:40, 11 April 2022</title>
		<link rel="alternate" type="text/html" href="http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_7_EN&amp;diff=2907&amp;oldid=prev"/>
				<updated>2022-04-11T11:40:27Z</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:40, 11 April 2022&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 47:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 47:&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;* [http://www.if.pw.edu.pl/~lgraczyk/KADD2016/Wyklad5-2016.pdf Wykład 5]&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;* [http://www.if.pw.edu.pl/~lgraczyk/KADD2016/Wyklad5-2016.pdf Wykład 5]&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;Część pierwsza&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;Part one&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:lab07_kolo2.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:lab07_kolo2.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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Output:&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;Output:&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;nbsp;&amp;nbsp; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Liczba &lt;/del&gt;Pi &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;wynosi&lt;/del&gt;: 3.14392&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;nbsp;&amp;nbsp; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;The &lt;/ins&gt;Pi &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;number equals&lt;/ins&gt;: 3.14392&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ęści druga i trzecia&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;Parts two and three&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:Lab07_dist.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:Lab07_dist.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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Output:&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;Output:&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;nbsp; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Calka&lt;/del&gt;: 0.199&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;nbsp; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Integral&lt;/ins&gt;: 0.199&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;nbsp; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Wydajnosc&lt;/del&gt;: 0.2072&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;nbsp; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Efficiency&lt;/ins&gt;: 0.2072&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;nbsp; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Calka &lt;/del&gt;(&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;metoda z funkcja pomocnicza&lt;/del&gt;): 0.198745&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;nbsp; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Integral &lt;/ins&gt;(&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;method with the helper function&lt;/ins&gt;): 0.198745&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;nbsp; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Wydajnosc &lt;/del&gt;(&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;metoda z funkcja pomocnicza&lt;/del&gt;): 0.39749&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;nbsp; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Efficiency &lt;/ins&gt;(&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;method with the helper function&lt;/ins&gt;): 0.39749&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;nbsp; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Calka liczona metoda&amp;nbsp; &lt;/del&gt;Integral: 0.198652&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;nbsp; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Integral calculated using the ROOT method &lt;/ins&gt;Integral: 0.198652&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_7_EN&amp;diff=2906&amp;oldid=prev</id>
		<title>Lgraczyk at 11:38, 11 April 2022</title>
		<link rel="alternate" type="text/html" href="http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_7_EN&amp;diff=2906&amp;oldid=prev"/>
				<updated>2022-04-11T11:38:33Z</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:38, 11 April 2022&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 16:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 16:&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;''Part two'': '''generation of pseudo random numbers from a any probability distribution using the acceptance rejection method of von Neumann''' (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;''Part two'': '''generation of pseudo random numbers from a any probability distribution using the acceptance rejection method of von Neumann''' (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;Wykorzystana tydzień temu metoda transformacji rozkładu jednorodnego z wykorzystaniem funkcji odwrotnej do dystrybuanty ma ograniczone zastosowanie&lt;/del&gt;. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Jej zastosowanie jest możliwe tylko wtedy, gdy znana jest jawna postać dystrybuanty oraz można znaleźć funkcję &lt;/del&gt;do &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;niej odwrotną&lt;/del&gt;. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'''Metoda &lt;/del&gt;von &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Neumanna''' pozwala wygenerowanie liczb pseudolosowych, gdy znany jest tylko rozkład &lt;/del&gt;g(y)&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;. W ogólności metoda działa nawet wtedy&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;gdy funkcja &lt;/del&gt;g(y) &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;''nie jest'' rozkładem gęstości prawdopodobieństwa &lt;/del&gt;(&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;całka z niej nie wynosi 1&lt;/del&gt;). &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Pozwala to na bardzo szerokie wykorzystanie metody &lt;/del&gt;von &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Neumanna &lt;/del&gt;- &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;przede wszystkim do obliczania całek oznaczonych ze skomplikowanych funkcji&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;gdy ich analityczne scałkowanie jest niemożliwe&lt;/del&gt;. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Metody tego typu noszą nazwę wspomnianych wcześniej '''metod &lt;/del&gt;Monte Carlo&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;'''&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;The transformation method used a week ago has limited applications&lt;/ins&gt;. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;You can &lt;/ins&gt;do &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;this when the analytical form of the cumulative function and its inverse function are known&lt;/ins&gt;. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;The &lt;/ins&gt;von &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Neumann method of generation of pseudo random numbers will work when you know only &lt;/ins&gt;&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;tr&gt;&lt;td colspan=&quot;2&quot;&gt;&amp;nbsp;&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;the &lt;/ins&gt;g(y) &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;distribution&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;but the drawback is that you have to generate two numbers, now one. This method will also work if the &lt;/ins&gt;g(y) &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;function is not a proper probability distribution &lt;/ins&gt;(&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;it even does not need to be normalized - every function you can always normalize&lt;/ins&gt;). &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;This allows for a very broad application of the &lt;/ins&gt;von &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Neumann method &lt;/ins&gt;- &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;also to calculate definite integrals&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;when their analytical form does not exist&lt;/ins&gt;. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;This is a typical example of a &lt;/ins&gt;Monte Carlo &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;method&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;Należy stworzyć trzy '''bardzo podobne''' funkcje przyjmujące obiekt typu &amp;lt;code&amp;gt;TF1&amp;lt;/code&amp;gt;. Powinny one przyjmować funkcję g na przedziale [min,max]:&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;Należy stworzyć trzy '''bardzo podobne''' funkcje przyjmujące obiekt typu &amp;lt;code&amp;gt;TF1&amp;lt;/code&amp;gt;. Powinny one przyjmować funkcję g na przedziale [min,max]:&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_7_EN&amp;diff=2905&amp;oldid=prev</id>
		<title>Lgraczyk at 11:28, 11 April 2022</title>
		<link rel="alternate" type="text/html" href="http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_7_EN&amp;diff=2905&amp;oldid=prev"/>
				<updated>2022-04-11T11:28:13Z</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:28, 11 April 2022&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 14:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 14:&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;* in addition, you can create a &amp;lt;code&amp;gt;TH1D&amp;lt;/code&amp;gt; object and fill it with accepted values of x. It will be a distribution of the circle.&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;* in addition, you can create a &amp;lt;code&amp;gt;TH1D&amp;lt;/code&amp;gt; object and fill it with accepted values of x. It will be a distribution of the circle.&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;''Part two'': '''&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;generowanie liczb pseudolosowych z dowolnego rozkładu metodą akceptacji i odrzucania &lt;/del&gt;von &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Neumanna&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;''Part two'': '''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;generation of pseudo random numbers from a any probability distribution using the acceptance rejection method of &lt;/ins&gt;von &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Neumann&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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Wykorzystana tydzień temu metoda transformacji rozkładu jednorodnego z wykorzystaniem funkcji odwrotnej do dystrybuanty ma ograniczone zastosowanie. Jej zastosowanie jest możliwe tylko wtedy, gdy znana jest jawna postać dystrybuanty oraz można znaleźć funkcję do niej odwrotną. '''Metoda von Neumanna''' pozwala wygenerowanie liczb pseudolosowych, gdy znany jest tylko rozkład g(y). W ogólności metoda działa nawet wtedy, gdy funkcja g(y) ''nie jest'' rozkładem gęstości prawdopodobieństwa (całka z niej nie wynosi 1). Pozwala to na bardzo szerokie wykorzystanie metody von Neumanna - przede wszystkim do obliczania całek oznaczonych ze skomplikowanych funkcji, gdy ich analityczne scałkowanie jest niemożliwe. Metody tego typu noszą nazwę wspomnianych wcześniej '''metod Monte Carlo'''.&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;Wykorzystana tydzień temu metoda transformacji rozkładu jednorodnego z wykorzystaniem funkcji odwrotnej do dystrybuanty ma ograniczone zastosowanie. Jej zastosowanie jest możliwe tylko wtedy, gdy znana jest jawna postać dystrybuanty oraz można znaleźć funkcję do niej odwrotną. '''Metoda von Neumanna''' pozwala wygenerowanie liczb pseudolosowych, gdy znany jest tylko rozkład g(y). W ogólności metoda działa nawet wtedy, gdy funkcja g(y) ''nie jest'' rozkładem gęstości prawdopodobieństwa (całka z niej nie wynosi 1). Pozwala to na bardzo szerokie wykorzystanie metody von Neumanna - przede wszystkim do obliczania całek oznaczonych ze skomplikowanych funkcji, gdy ich analityczne scałkowanie jest niemożliwe. Metody tego typu noszą nazwę wspomnianych wcześniej '''metod Monte Carlo'''.&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_7_EN&amp;diff=2904&amp;oldid=prev</id>
		<title>Lgraczyk at 11:27, 11 April 2022</title>
		<link rel="alternate" type="text/html" href="http://www.if.pw.edu.pl/~lgraczyk/wiki/index.php?title=KADD_2022_Laboratorium_7_EN&amp;diff=2904&amp;oldid=prev"/>
				<updated>2022-04-11T11:27:04Z</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:27, 11 April 2022&lt;/td&gt;
		&lt;/tr&gt;&lt;tr&gt;&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 7:&lt;/td&gt;
&lt;td colspan=&quot;2&quot; class=&quot;diff-lineno&quot;&gt;Line 7:&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;|}&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;|}&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;Zadanie &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;Exercise &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;Część pierwsza&lt;/del&gt;'': '''&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;obliczanie liczby &lt;/del&gt;Pi''' (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;Part one&lt;/ins&gt;'': '''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;estimation of the &lt;/ins&gt;Pi''' (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 napisać &lt;/del&gt;'''&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;funkcję&lt;/del&gt;'''&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;, która oblicza liczbę &lt;/del&gt;Pi '''&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;metodą &lt;/del&gt;von &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Neumanna&lt;/del&gt;''' (&lt;del class=&quot;diffchange diffchange-inline&quot;&gt;jest to bodajże najprostszy przykład wykorzystania metody typu &lt;/del&gt;'''Monte Carlo'''). &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;W tym celu losujemy z rozkładu jednorodnego na przedziale &lt;/del&gt;[0,1] &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;dwie liczby x i y, i sprawdzamy, czy wylosowana para mieści się wewnątrz koła o promieniu &lt;/del&gt;1. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Następnie używając stosunku par zaakceptowanych (mieszczących się wewnątrz) do odrzuconych (tych&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;które leżą poza okręgiem) oraz wzoru na pole koła&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;należy obliczyć liczbę &lt;/del&gt;Pi. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Ponadto&lt;/del&gt;, &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;należy narysować wykres trafień leżących wewnątrz oraz na zewnątrz koła&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 write a &lt;/ins&gt;'''&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;function&lt;/ins&gt;''' &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;which estimates the number &lt;/ins&gt;Pi &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;with the &lt;/ins&gt;'''von &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Neumann&lt;/ins&gt;''' (&lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;it is arguably one of the most simple examples of the use-case of a &lt;/ins&gt;'''Monte Carlo''' &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;method&lt;/ins&gt;). &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;In order to calculate the Pi, we randomly generate two numbers x and y from the uniform distribution &lt;/ins&gt;[0,1] &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;and we check whether the pair falls within the circle of the radius equal to &lt;/ins&gt;1. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Next&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;by calculating the ratio of accepted pairs to all of them, you approximate the ratio of areas of the circle to the rectangle. By performing such a random generation&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;calculate the &lt;/ins&gt;Pi &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;number&lt;/ins&gt;. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;In addition&lt;/ins&gt;, &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;draw the graph of the resulted points inside and outside the circle&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;stworzyć dwa obiekty typu &lt;/del&gt;&amp;lt;code&amp;gt;TGraph&amp;lt;/code&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;i jeden z nich wypełniać zaakceptowanymi parami &lt;/del&gt;(x,y), &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;drugi zaś odrzuconymi&lt;/del&gt;. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Oba wykresy narysować na jednym panelu&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;create two objects of type &lt;/ins&gt;&amp;lt;code&amp;gt;TGraph&amp;lt;/code&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;and fill one of them with accepted pairs &lt;/ins&gt;(x,y), &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;the second one with rejected pairs&lt;/ins&gt;. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;Both plots draw on one canvas&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;dodatkowo można stworzyć obiekt &lt;/del&gt;&amp;lt;code&amp;gt;TH1D&amp;lt;/code&amp;gt; &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;i wypełnić go zaakceptowanymi wartościami &lt;/del&gt;x. &lt;del class=&quot;diffchange diffchange-inline&quot;&gt;Będzie dany rozkładem wyznaczonym ze wzoru na pole koła&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;in addition, you can create a &lt;/ins&gt;&amp;lt;code&amp;gt;TH1D&amp;lt;/code&amp;gt; &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;object and fill it with accepted values of &lt;/ins&gt;x. &lt;ins class=&quot;diffchange diffchange-inline&quot;&gt;It will be a distribution of the circle&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;Część druga&lt;/del&gt;'': '''generowanie liczb pseudolosowych z dowolnego rozkładu metodą akceptacji i odrzucania von Neumanna''' (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;Part two&lt;/ins&gt;'': '''generowanie liczb pseudolosowych z dowolnego rozkładu metodą akceptacji i odrzucania von Neumanna''' (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: #eee; color:black; font-size: smaller;&quot;&gt;&lt;div&gt;Wykorzystana tydzień temu metoda transformacji rozkładu jednorodnego z wykorzystaniem funkcji odwrotnej do dystrybuanty ma ograniczone zastosowanie. Jej zastosowanie jest możliwe tylko wtedy, gdy znana jest jawna postać dystrybuanty oraz można znaleźć funkcję do niej odwrotną. '''Metoda von Neumanna''' pozwala wygenerowanie liczb pseudolosowych, gdy znany jest tylko rozkład g(y). W ogólności metoda działa nawet wtedy, gdy funkcja g(y) ''nie jest'' rozkładem gęstości prawdopodobieństwa (całka z niej nie wynosi 1). Pozwala to na bardzo szerokie wykorzystanie metody von Neumanna - przede wszystkim do obliczania całek oznaczonych ze skomplikowanych funkcji, gdy ich analityczne scałkowanie jest niemożliwe. Metody tego typu noszą nazwę wspomnianych wcześniej '''metod Monte Carlo'''.&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;Wykorzystana tydzień temu metoda transformacji rozkładu jednorodnego z wykorzystaniem funkcji odwrotnej do dystrybuanty ma ograniczone zastosowanie. Jej zastosowanie jest możliwe tylko wtedy, gdy znana jest jawna postać dystrybuanty oraz można znaleźć funkcję do niej odwrotną. '''Metoda von Neumanna''' pozwala wygenerowanie liczb pseudolosowych, gdy znany jest tylko rozkład g(y). W ogólności metoda działa nawet wtedy, gdy funkcja g(y) ''nie jest'' rozkładem gęstości prawdopodobieństwa (całka z niej nie wynosi 1). Pozwala to na bardzo szerokie wykorzystanie metody von Neumanna - przede wszystkim do obliczania całek oznaczonych ze skomplikowanych funkcji, gdy ich analityczne scałkowanie jest niemożliwe. Metody tego typu noszą nazwę wspomnianych wcześniej '''metod Monte Carlo'''.&lt;/div&gt;&lt;/td&gt;&lt;/tr&gt;
&lt;/table&gt;</summary>
		<author><name>Lgraczyk</name></author>	</entry>

	</feed>