{"nbformat":4,"nbformat_minor":0,"metadata":{"colab":{"provenance":[],"authorship_tag":"ABX9TyNsBYhsB+UsGtOLx0I6Yc5z"},"kernelspec":{"name":"python3","display_name":"Python 3"},"language_info":{"name":"python"}},"cells":[{"cell_type":"code","source":["import scipy.stats as stats\n","import numpy as np"],"metadata":{"id":"R_frNMDmQHL4","executionInfo":{"status":"ok","timestamp":1717748261292,"user_tz":-330,"elapsed":1101,"user":{"displayName":"Amit Sachan","userId":"17076119069500437280"}}},"execution_count":1,"outputs":[]},{"cell_type":"code","execution_count":2,"metadata":{"id":"-fflcTBnP9ky","executionInfo":{"status":"ok","timestamp":1717748261293,"user_tz":-330,"elapsed":14,"user":{"displayName":"Amit Sachan","userId":"17076119069500437280"}}},"outputs":[],"source":["p=6/8\n","q=1-p\n","n=5"]},{"cell_type":"code","source":["#P(x>2)= 1-(P(0)+P(1)+P(2))\n","ansa = 1-stats.binom.cdf(2,n,p)\n","ansa"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"qiqcZAWnQNM4","executionInfo":{"status":"ok","timestamp":1717748261293,"user_tz":-330,"elapsed":14,"user":{"displayName":"Amit Sachan","userId":"17076119069500437280"}},"outputId":"422b4ff1-c31f-481b-8e40-e54c9bf6607d"},"execution_count":3,"outputs":[{"output_type":"execute_result","data":{"text/plain":["0.896484375"]},"metadata":{},"execution_count":3}]},{"cell_type":"code","source":["#P(x>=3)= 1-(P(0)+P(1)+P(2)+P(3)) it for misses use q\n","ansb = 1-stats.binom.cdf(3,n,q)\n","ansb"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"ZSkIgWMeQNKS","executionInfo":{"status":"ok","timestamp":1717748261293,"user_tz":-330,"elapsed":11,"user":{"displayName":"Amit Sachan","userId":"17076119069500437280"}},"outputId":"27c435b5-e8f2-46d1-a3ac-5e51fd83af6a"},"execution_count":4,"outputs":[{"output_type":"execute_result","data":{"text/plain":["0.015625"]},"metadata":{},"execution_count":4}]},{"cell_type":"code","source":["#P(x=4)= P(4)\n","ansc=stats.binom.pmf(4,n,p)\n","ansc"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"noAvoU2JQNHp","executionInfo":{"status":"ok","timestamp":1717748261293,"user_tz":-330,"elapsed":8,"user":{"displayName":"Amit Sachan","userId":"17076119069500437280"}},"outputId":"389edc67-46d1-42b3-8bf8-c93f472b7c0b"},"execution_count":5,"outputs":[{"output_type":"execute_result","data":{"text/plain":["0.39550781250000006"]},"metadata":{},"execution_count":5}]},{"cell_type":"code","source":["#  expected number of hits = Mean\n","m, v, s, k = stats.binom.stats(n, p, moments='mvsk')\n","print(\"mean             \",m)"],"metadata":{"colab":{"base_uri":"https://localhost:8080/"},"id":"m7bwsymtQNEy","executionInfo":{"status":"ok","timestamp":1717748261293,"user_tz":-330,"elapsed":5,"user":{"displayName":"Amit Sachan","userId":"17076119069500437280"}},"outputId":"6a8eb61b-2067-4d0a-abd5-93a1daa99742"},"execution_count":6,"outputs":[{"output_type":"stream","name":"stdout","text":["mean              3.75\n"]}]},{"cell_type":"code","source":[],"metadata":{"id":"pN5EsBtgQNBj","executionInfo":{"status":"ok","timestamp":1717748261293,"user_tz":-330,"elapsed":3,"user":{"displayName":"Amit Sachan","userId":"17076119069500437280"}}},"execution_count":6,"outputs":[]}]}