Skip to content

Commit 8c24042

Browse files
committed
physics update
1 parent 01a7adc commit 8c24042

File tree

9 files changed

+1049
-32
lines changed

9 files changed

+1049
-32
lines changed

physics/sem1/lab1/avg-brightness-calculator/experement.ipynb

Lines changed: 100 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@
3636
},
3737
{
3838
"cell_type": "code",
39-
"execution_count": 2,
39+
"execution_count": 1,
4040
"id": "6acd30a5",
4141
"metadata": {},
4242
"outputs": [],
@@ -50,7 +50,7 @@
5050
},
5151
{
5252
"cell_type": "code",
53-
"execution_count": 3,
53+
"execution_count": 10,
5454
"id": "564b8910",
5555
"metadata": {},
5656
"outputs": [],
@@ -709,30 +709,7 @@
709709
},
710710
{
711711
"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,
736713
"id": "647e0661",
737714
"metadata": {},
738715
"outputs": [],
@@ -752,7 +729,7 @@
752729
},
753730
{
754731
"cell_type": "code",
755-
"execution_count": 4,
732+
"execution_count": 12,
756733
"id": "dbea9be6",
757734
"metadata": {},
758735
"outputs": [
@@ -771,7 +748,7 @@
771748
},
772749
{
773750
"cell_type": "code",
774-
"execution_count": 5,
751+
"execution_count": 14,
775752
"id": "553175bd",
776753
"metadata": {},
777754
"outputs": [
@@ -802,18 +779,25 @@
802779
},
803780
{
804781
"cell_type": "code",
805-
"execution_count": 6,
782+
"execution_count": null,
806783
"id": "10681818",
807784
"metadata": {},
808785
"outputs": [
786+
{
787+
"name": "stdout",
788+
"output_type": "stream",
789+
"text": [
790+
"0.08132897477598496\n"
791+
]
792+
},
809793
{
810794
"ename": "ValueError",
811795
"evalue": "could not convert string to float: ''",
812796
"output_type": "error",
813797
"traceback": [
814798
"\u001b[31m---------------------------------------------------------------------------\u001b[39m",
815799
"\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",
817801
"\u001b[31mValueError\u001b[39m: could not convert string to float: ''"
818802
]
819803
}
@@ -825,6 +809,91 @@
825809
" print(f(float(input())))"
826810
]
827811
},
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+
},
828897
{
829898
"cell_type": "code",
830899
"execution_count": 8,
@@ -1040,7 +1109,7 @@
10401109
"name": "python",
10411110
"nbconvert_exporter": "python",
10421111
"pygments_lexer": "ipython3",
1043-
"version": "3.12.4"
1112+
"version": "3.13.7"
10441113
}
10451114
},
10461115
"nbformat": 4,

physics/sem1/lab1/avg-brightness-calculator/report/.~lock.report_f1.odt#

Lines changed: 0 additions & 1 deletion
This file was deleted.
Binary file not shown.
-244 KB
Binary file not shown.
-352 KB
Binary file not shown.

0 commit comments

Comments
 (0)