|
36 | 36 | }, |
37 | 37 | { |
38 | 38 | "cell_type": "code", |
39 | | - "execution_count": 2, |
| 39 | + "execution_count": 1, |
40 | 40 | "id": "6acd30a5", |
41 | 41 | "metadata": {}, |
42 | 42 | "outputs": [], |
|
50 | 50 | }, |
51 | 51 | { |
52 | 52 | "cell_type": "code", |
53 | | - "execution_count": 3, |
| 53 | + "execution_count": 10, |
54 | 54 | "id": "564b8910", |
55 | 55 | "metadata": {}, |
56 | 56 | "outputs": [], |
|
709 | 709 | }, |
710 | 710 | { |
711 | 711 | "cell_type": "code", |
712 | | - "execution_count": 11, |
713 | | - "id": "1b091193", |
714 | | - "metadata": {}, |
715 | | - "outputs": [ |
716 | | - { |
717 | | - "data": { |
718 | | - "text/plain": [ |
719 | | - "50" |
720 | | - ] |
721 | | - }, |
722 | | - "execution_count": 11, |
723 | | - "metadata": {}, |
724 | | - "output_type": "execute_result" |
725 | | - } |
726 | | - ], |
727 | | - "source": [ |
728 | | - "n = 2\n", |
729 | | - "\n", |
730 | | - "len(list(filter(lambda x: 2.89 - 0.38*n <= x <= 2.89 + 0.38*n, data)))" |
731 | | - ] |
732 | | - }, |
733 | | - { |
734 | | - "cell_type": "code", |
735 | | - "execution_count": 207, |
| 712 | + "execution_count": 4, |
736 | 713 | "id": "647e0661", |
737 | 714 | "metadata": {}, |
738 | 715 | "outputs": [], |
|
752 | 729 | }, |
753 | 730 | { |
754 | 731 | "cell_type": "code", |
755 | | - "execution_count": 4, |
| 732 | + "execution_count": 12, |
756 | 733 | "id": "dbea9be6", |
757 | 734 | "metadata": {}, |
758 | 735 | "outputs": [ |
|
771 | 748 | }, |
772 | 749 | { |
773 | 750 | "cell_type": "code", |
774 | | - "execution_count": 5, |
| 751 | + "execution_count": 14, |
775 | 752 | "id": "553175bd", |
776 | 753 | "metadata": {}, |
777 | 754 | "outputs": [ |
|
802 | 779 | }, |
803 | 780 | { |
804 | 781 | "cell_type": "code", |
805 | | - "execution_count": 6, |
| 782 | + "execution_count": null, |
806 | 783 | "id": "10681818", |
807 | 784 | "metadata": {}, |
808 | 785 | "outputs": [ |
| 786 | + { |
| 787 | + "name": "stdout", |
| 788 | + "output_type": "stream", |
| 789 | + "text": [ |
| 790 | + "0.08132897477598496\n" |
| 791 | + ] |
| 792 | + }, |
809 | 793 | { |
810 | 794 | "ename": "ValueError", |
811 | 795 | "evalue": "could not convert string to float: ''", |
812 | 796 | "output_type": "error", |
813 | 797 | "traceback": [ |
814 | 798 | "\u001b[31m---------------------------------------------------------------------------\u001b[39m", |
815 | 799 | "\u001b[31mValueError\u001b[39m Traceback (most recent call last)", |
816 | | - "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[6]\u001b[39m\u001b[32m, line 4\u001b[39m\n\u001b[32m 1\u001b[39m f = \u001b[38;5;28;01mlambda\u001b[39;00m x: max_ro*np.exp(-(x-mean)**\u001b[32m2\u001b[39m/(\u001b[32m2\u001b[39m*dispersion))\n\u001b[32m 3\u001b[39m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[32m----> \u001b[39m\u001b[32m4\u001b[39m \u001b[38;5;28mprint\u001b[39m(f(\u001b[38;5;28;43mfloat\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;28;43minput\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m))\n", |
| 800 | + "\u001b[36mCell\u001b[39m\u001b[36m \u001b[39m\u001b[32mIn[15]\u001b[39m\u001b[32m, line 4\u001b[39m\n\u001b[32m 1\u001b[39m f = \u001b[38;5;28;01mlambda\u001b[39;00m x: max_ro*np.exp(-(x-mean)**\u001b[32m2\u001b[39m/(\u001b[32m2\u001b[39m*dispersion))\n\u001b[32m 3\u001b[39m \u001b[38;5;28;01mwhile\u001b[39;00m \u001b[38;5;28;01mTrue\u001b[39;00m:\n\u001b[32m----> \u001b[39m\u001b[32m4\u001b[39m \u001b[38;5;28mprint\u001b[39m(f(\u001b[38;5;28;43mfloat\u001b[39;49m\u001b[43m(\u001b[49m\u001b[38;5;28;43minput\u001b[39;49m\u001b[43m(\u001b[49m\u001b[43m)\u001b[49m\u001b[43m)\u001b[49m))\n", |
817 | 801 | "\u001b[31mValueError\u001b[39m: could not convert string to float: ''" |
818 | 802 | ] |
819 | 803 | } |
|
825 | 809 | " print(f(float(input())))" |
826 | 810 | ] |
827 | 811 | }, |
| 812 | + { |
| 813 | + "cell_type": "code", |
| 814 | + "execution_count": 24, |
| 815 | + "id": "22e1e1a0", |
| 816 | + "metadata": {}, |
| 817 | + "outputs": [ |
| 818 | + { |
| 819 | + "name": "stdout", |
| 820 | + "output_type": "stream", |
| 821 | + "text": [ |
| 822 | + "1 - from 2.74 to 3.05: 40 0.80\n", |
| 823 | + "2 - from 2.58 to 3.21: 46 0.92\n", |
| 824 | + "3 - from 2.42 to 3.37: 48 0.96\n" |
| 825 | + ] |
| 826 | + } |
| 827 | + ], |
| 828 | + "source": [ |
| 829 | + "for n in [1,2,3]:\n", |
| 830 | + " _ = len(list(filter(lambda x: mean - std*n <= x <= mean + std*n, data)))\n", |
| 831 | + "\n", |
| 832 | + " print(f\"{n} - from {mean - std*n:.2f} to {mean + std*n:.2f}: {_} {_/50:.2f}\")" |
| 833 | + ] |
| 834 | + }, |
| 835 | + { |
| 836 | + "cell_type": "code", |
| 837 | + "execution_count": 28, |
| 838 | + "id": "1f848cc7", |
| 839 | + "metadata": {}, |
| 840 | + "outputs": [ |
| 841 | + { |
| 842 | + "name": "stdout", |
| 843 | + "output_type": "stream", |
| 844 | + "text": [ |
| 845 | + "0.022271515623398092\n", |
| 846 | + "0.04476574640303016\n" |
| 847 | + ] |
| 848 | + } |
| 849 | + ], |
| 850 | + "source": [ |
| 851 | + "mean_std = np.sqrt(1/(50*49)*sum(map(lambda x: (x-mean)**2, data)))\n", |
| 852 | + "\n", |
| 853 | + "print(mean_std)\n", |
| 854 | + "\n", |
| 855 | + "trust_range = 2.01 * mean_std\n", |
| 856 | + "\n", |
| 857 | + "print(trust_range)" |
| 858 | + ] |
| 859 | + }, |
| 860 | + { |
| 861 | + "cell_type": "code", |
| 862 | + "execution_count": 30, |
| 863 | + "id": "b6fe708c", |
| 864 | + "metadata": {}, |
| 865 | + "outputs": [ |
| 866 | + { |
| 867 | + "name": "stdout", |
| 868 | + "output_type": "stream", |
| 869 | + "text": [ |
| 870 | + "0.04525943543024871\n" |
| 871 | + ] |
| 872 | + } |
| 873 | + ], |
| 874 | + "source": [ |
| 875 | + "ttl_pogreshnost = np.sqrt(trust_range**2 + (2/3*0.01)**2)\n", |
| 876 | + "print(ttl_pogreshnost)" |
| 877 | + ] |
| 878 | + }, |
| 879 | + { |
| 880 | + "cell_type": "code", |
| 881 | + "execution_count": 35, |
| 882 | + "id": "c06117ce", |
| 883 | + "metadata": {}, |
| 884 | + "outputs": [ |
| 885 | + { |
| 886 | + "name": "stdout", |
| 887 | + "output_type": "stream", |
| 888 | + "text": [ |
| 889 | + "1.56%\n" |
| 890 | + ] |
| 891 | + } |
| 892 | + ], |
| 893 | + "source": [ |
| 894 | + "print(f\"{ttl_pogreshnost/mean*100:.2f}%\")" |
| 895 | + ] |
| 896 | + }, |
828 | 897 | { |
829 | 898 | "cell_type": "code", |
830 | 899 | "execution_count": 8, |
|
1040 | 1109 | "name": "python", |
1041 | 1110 | "nbconvert_exporter": "python", |
1042 | 1111 | "pygments_lexer": "ipython3", |
1043 | | - "version": "3.12.4" |
| 1112 | + "version": "3.13.7" |
1044 | 1113 | } |
1045 | 1114 | }, |
1046 | 1115 | "nbformat": 4, |
|
0 commit comments