Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; plgContentJComments has a deprecated constructor in /var/www/astarmathsandphysics/plugins/content/jcomments/jcomments.php on line 25 Call Stack: 0.0001 361104 1. {main}() /var/www/astarmathsandphysics/index.php:0 0.3964 1210040 2. Joomla\CMS\Application\SiteApplication->execute() /var/www/astarmathsandphysics/index.php:49 0.3964 1210040 3. Joomla\CMS\Application\SiteApplication->doExecute() /var/www/astarmathsandphysics/libraries/src/Application/CMSApplication.php:267 0.5505 4103144 4. Joomla\CMS\Application\SiteApplication->dispatch() /var/www/astarmathsandphysics/libraries/src/Application/SiteApplication.php:233 0.5518 4131032 5. Joomla\CMS\Component\ComponentHelper::renderComponent() /var/www/astarmathsandphysics/libraries/src/Application/SiteApplication.php:194 0.5527 4148744 6. Joomla\CMS\Component\ComponentHelper::executeComponent() /var/www/astarmathsandphysics/libraries/src/Component/ComponentHelper.php:356 0.5527 4165752 7. require_once('/var/www/astarmathsandphysics/components/com_content/content.php') /var/www/astarmathsandphysics/libraries/src/Component/ComponentHelper.php:381 0.5535 4173488 8. ContentController->execute() /var/www/astarmathsandphysics/components/com_content/content.php:42 0.5535 4173488 9. ContentController->display() /var/www/astarmathsandphysics/libraries/src/MVC/Controller/BaseController.php:710 0.5964 4409464 10. ContentController->display() /var/www/astarmathsandphysics/components/com_content/controller.php:113 0.5979 4426864 11. Joomla\CMS\Cache\Controller\ViewController->get() /var/www/astarmathsandphysics/libraries/src/MVC/Controller/BaseController.php:663 0.5984 4447792 12. ContentViewArticle->display() /var/www/astarmathsandphysics/libraries/src/Cache/Controller/ViewController.php:102 0.6085 4522184 13. Joomla\CMS\Plugin\PluginHelper::importPlugin() /var/www/astarmathsandphysics/components/com_content/views/article/view.html.php:189 0.6086 4522440 14. Joomla\CMS\Plugin\PluginHelper::import() /var/www/astarmathsandphysics/libraries/src/Plugin/PluginHelper.php:182 Deprecated: Methods with the same name as their class will not be constructors in a future version of PHP; JCommentsACL has a deprecated constructor in /var/www/astarmathsandphysics/components/com_jcomments/classes/acl.php on line 17 Call Stack: 0.0001 361104 1. {main}() /var/www/astarmathsandphysics/index.php:0 0.3964 1210040 2. Joomla\CMS\Application\SiteApplication->execute() /var/www/astarmathsandphysics/index.php:49 0.3964 1210040 3. Joomla\CMS\Application\SiteApplication->doExecute() /var/www/astarmathsandphysics/libraries/src/Application/CMSApplication.php:267 0.5505 4103144 4. Joomla\CMS\Application\SiteApplication->dispatch() /var/www/astarmathsandphysics/libraries/src/Application/SiteApplication.php:233 0.5518 4131032 5. Joomla\CMS\Component\ComponentHelper::renderComponent() /var/www/astarmathsandphysics/libraries/src/Application/SiteApplication.php:194 0.5527 4148744 6. Joomla\CMS\Component\ComponentHelper::executeComponent() /var/www/astarmathsandphysics/libraries/src/Component/ComponentHelper.php:356 0.5527 4165752 7. require_once('/var/www/astarmathsandphysics/components/com_content/content.php') /var/www/astarmathsandphysics/libraries/src/Component/ComponentHelper.php:381 0.5535 4173488 8. ContentController->execute() /var/www/astarmathsandphysics/components/com_content/content.php:42 0.5535 4173488 9. ContentController->display() /var/www/astarmathsandphysics/libraries/src/MVC/Controller/BaseController.php:710 0.5964 4409464 10. ContentController->display() /var/www/astarmathsandphysics/components/com_content/controller.php:113 0.5979 4426864 11. Joomla\CMS\Cache\Controller\ViewController->get() /var/www/astarmathsandphysics/libraries/src/MVC/Controller/BaseController.php:663 0.5984 4447792 12. ContentViewArticle->display() /var/www/astarmathsandphysics/libraries/src/Cache/Controller/ViewController.php:102 0.7369 12315856 13. JEventDispatcher->trigger() /var/www/astarmathsandphysics/components/com_content/views/article/view.html.php:199 0.7372 12316304 14. plgContentJComments->update() /var/www/astarmathsandphysics/libraries/joomla/event/dispatcher.php:160 0.7372 12316304 15. plgContentJComments->onContentAfterDisplay() /var/www/astarmathsandphysics/libraries/joomla/event/event.php:70 0.7374 12324552 16. plgContentJComments->onAfterDisplayContent() /var/www/astarmathsandphysics/plugins/content/jcomments/jcomments.php:339 0.7376 12326288 17. JComments::show() /var/www/astarmathsandphysics/plugins/content/jcomments/jcomments.php:282 0.7382 12359336 18. JCommentsFactory::getACL() /var/www/astarmathsandphysics/components/com_jcomments/jcomments.php:188 0.7383 12359736 19. spl_autoload_call() /var/www/astarmathsandphysics/components/com_jcomments/classes/factory.php:274 0.7384 12359816 20. JLoader::load() /var/www/astarmathsandphysics/components/com_jcomments/classes/factory.php:274

Expected Number of Purchases to Complete a Set of Plastic Toys in Cereal Packets

A breakfast cereal company decide to give a plastic toy away with each box of cereal. There are 16 toys to give away. What is the average number of purchases needed to collect the set?
We can solved this problem using matrices. Someone may have anywhere between 0 and 16 different toys. We may represent this by saying there are 17 states. If someone has  
\[r\]
  different toys. then the probability that he will find a toy he does not have in the next purchare, and move onto the state  
\[r+1\]
  is  
\[\frac{16-r}{16}\]
. We can represent this my a square transition matrix with 17 rows and 17 columns.
\[T=\frac{1}{16} \left( \begin{array}{ccccccc} 0 & 16 & 0 & 0 & \ldots & \ldots & \vdots \\ 0 & 1 & 15 & 0 & \ldots & \ldots & \vdots \\ 0 & 0 & 2 & 14 & \ldots & \ldots & \vdots \\ \vdots & \ldots & \ldots & 3 & \ldots & \ldots & \vdots \\ \vdots & \ldots & \dots & \dots & \ldots & 15 & 1 \\ \vdots & \ldots & \dots & \dots & \ldots & 0 & 1 \end{array} \right)\]


\[T=\frac{1}{16} \left( \begin{array}{ccccccc} 1 & -1 & 0 & 0 & \ldots & \ldots & \vdots \\ 0 & 15/16 & -15/16 & 0 \ldots & \ldots & \vdots \\ 0 & 0 & 14/16 & -14/16 & \ldots & \ldots & \vdots \\ \vdots & \ldots & \ldots & 13/16 & \ldots & \ldots & \vdots \\ \vdots & \ldots & \dots & \ldots & \ldots & 1/16 & -1/16 \\ \vdots & \ldots & \dots & \ldots & \ldots & 1 & 15/16 \end{array} \right)\]

This is an 'absorbing Markov chain'. A state in a Markov chain is an absorbing state if it is impossible to leave that state. A Markov chain is absorbing if
1. It has at least one absorbing state, and
2. From every state it is possible to go - possibly in several steps - to an absorbing state.
The absorbing state here is the final state with 16 different toys, and obviously from any state it is possible to reach that happy end state. The expected number of steps is the sum of the diagonal entries of the  
\[(I-T)^{-1}\]
.
\[(I-T)^{-1}=16 \frac{1}{16} \left( \begin{array}{ccccccc} 1/16 & 1/15 & 1/14 & \ldots & \ldots & \ldots & 1 \\ 0 & 1/15 & 1/14 & \ldots & \ldots & 1/2 & 1 \\ 0 & 0 & 1/14 & \ldots & \ldots & 1/2 & 1 \\ \vdots & \ldots & \ldots & \ldots & \ldots & \ldots & \vdots \\ \vdots & \ldots & \ldots & \ldots & \ldots & \ldots & \vdots \\ 0 & 0 & 0 & \ldots & \ldots & 0 & 1 & \end{array} \right)\]

The sum of the diagonal entries is  
\[16(1/16+1/15+1/14+...+1) \simeq 54.09\]

Add comment

Security code
Refresh