⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 page471.html

📁 Data Structures And Algorithms With Object-Oriented Design Patterns In Python (2003) source code and
💻 HTML
字号:
<HTML><HEAD><TITLE>Exponentially Distributed Random Variables</TITLE></HEAD><BODY bgcolor="#FFFFFF"> <a href="../index.html" target="_top"><img src="../icons/usins.gif" alt="Logo" align=right></a><b>Data Structures and Algorithms with Object-Oriented Design Patterns in Python</b><br><A NAME="tex2html6592" HREF="page472.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html6590" HREF="page468.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html6586" HREF="page470.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A>  <A NAME="tex2html6594" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <BR><HR><H3><A NAME="SECTION0014523000000000000000">Exponentially Distributed Random Variables</A></H3><P>Program&nbsp;<A HREF="page471.html#progexponentialRVa"><IMG  ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A> defines the <tt>ExponentialRV</tt> class.This class generates exponentially distributed random numbers with a mean value of  <IMG WIDTH=9 HEIGHT=16 ALIGN=MIDDLE ALT="tex2html_wrap_inline68653" SRC="img1928.gif"  >.The mean value  <IMG WIDTH=9 HEIGHT=16 ALIGN=MIDDLE ALT="tex2html_wrap_inline68653" SRC="img1928.gif"  > is specified in the <tt>__init__</tt> method.<P><P><A NAME="34002">&#160;</A><A NAME="progexponentialRVa">&#160;</A> <IMG WIDTH=575 HEIGHT=145 ALIGN=BOTTOM ALT="program33916" SRC="img1929.gif"  ><BR><STRONG>Program:</STRONG> <tt>ExponentialRV</tt> class.<BR><P><P>The <tt>ExponentialRV</tt> class generates a sequence of random numbers,  <IMG WIDTH=17 HEIGHT=22 ALIGN=MIDDLE ALT="tex2html_wrap_inline68657" SRC="img1930.gif"  >,<em>exponentially distributed</em><A NAME=33929>&#160;</A>on the interval  <IMG WIDTH=42 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline68659" SRC="img1931.gif"  > and having a mean value  <IMG WIDTH=9 HEIGHT=16 ALIGN=MIDDLE ALT="tex2html_wrap_inline68653" SRC="img1928.gif"  >.The numbers are said to be <em>exponentially distributed</em> becausethe probability that  <IMG WIDTH=17 HEIGHT=22 ALIGN=MIDDLE ALT="tex2html_wrap_inline68657" SRC="img1930.gif"  > falls between 0 and <I>z</I> is given by<P> <IMG WIDTH=348 HEIGHT=37 ALIGN=BOTTOM ALT="displaymath68651" SRC="img1932.gif"  ><P>where  <IMG WIDTH=102 HEIGHT=30 ALIGN=MIDDLE ALT="tex2html_wrap_inline68669" SRC="img1933.gif"  >.The function <I>p</I>(<I>x</I>) is called the<em>probability density function</em><A NAME=33937>&#160;</A>.Thus,<P> <IMG WIDTH=500 HEIGHT=58 ALIGN=BOTTOM ALT="eqnarray33938" SRC="img1934.gif"  ><P>Notice that  <IMG WIDTH=97 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline68673" SRC="img1935.gif"  > is a value between zero and one.Therefore, given a random variable,  <IMG WIDTH=14 HEIGHT=22 ALIGN=MIDDLE ALT="tex2html_wrap_inline68643" SRC="img1925.gif"  >,uniformly distributed between zero and one,we can obtain an exponentially distributed variable  <IMG WIDTH=17 HEIGHT=22 ALIGN=MIDDLE ALT="tex2html_wrap_inline68657" SRC="img1930.gif"  > as follows:<P><A NAME="eqnalgsedrv">&#160;</A> <IMG WIDTH=500 HEIGHT=43 ALIGN=BOTTOM ALT="eqnarray33946" SRC="img1936.gif"  ><P>Note, if  <IMG WIDTH=14 HEIGHT=22 ALIGN=MIDDLE ALT="tex2html_wrap_inline68643" SRC="img1925.gif"  > is uniformly distributed on (<I>O</I>,1),then so too is  <IMG WIDTH=15 HEIGHT=24 ALIGN=MIDDLE ALT="tex2html_wrap_inline68683" SRC="img1937.gif"  >.The implementation of the <tt>next</tt> methodfollows directly from Equation&nbsp;<A HREF="page471.html#eqnalgsedrv"><IMG  ALIGN=BOTTOM ALT="gif" SRC="../icons/cross_ref_motif.gif"></A>.<P><HR><A NAME="tex2html6592" HREF="page472.html"><IMG WIDTH=37 HEIGHT=24 ALIGN=BOTTOM ALT="next" SRC="../icons/next_motif.gif"></A> <A NAME="tex2html6590" HREF="page468.html"><IMG WIDTH=26 HEIGHT=24 ALIGN=BOTTOM ALT="up" SRC="../icons/up_motif.gif"></A> <A NAME="tex2html6586" HREF="page470.html"><IMG WIDTH=63 HEIGHT=24 ALIGN=BOTTOM ALT="previous" SRC="../icons/previous_motif.gif"></A>  <A NAME="tex2html6594" HREF="page611.html"><IMG WIDTH=43 HEIGHT=24 ALIGN=BOTTOM ALT="index" SRC="../icons/index_motif.gif"></A> <P><ADDRESS><img src="../icons/bruno.gif" alt="Bruno" align=right><a href="../copyright.html">Copyright &#169; 2003</a> by <a href="../signature.html">Bruno R. Preiss, P.Eng.</a>  All rights reserved.</ADDRESS></BODY></HTML>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -