Giải chi tiết cho tôi từ câu 13 đến câu 17
Creado el: 6 de enero de 2026
Respondido usando GPT-5.2 Thinking por Chat01
Creado el: 6 de enero de 2026
Respondido usando GPT-5.2 Thinking por Chat01
pythonfrom PIL import Image img1 = Image.open('/mnt/data/IMG_0684.png') img2 = Image.open('/mnt/data/IMG_0685.png') img1.size, img2.size ((1242, 2688), (1242, 2688))
pythonimport matplotlib.pyplot as plt, numpy as np plt.figure(figsize=(8,16)) plt.imshow(img1) plt.axis('off') plt.show()
pythonplt.figure(figsize=(8,16)) plt.imshow(img2) plt.axis('off') plt.show()
pythonimport numpy as np, math, statistics # Bài 13 data before = np.array([10,5,20,30,35,45,42,60,25,18], dtype=float) after = np.array([13,7,15,35,35,50,35,65,30,15], dtype=float) d = after - before n13 = len(d) before.mean(), after.mean(), d, d.mean(), d.std(ddof=1) (29.0, 30.0, array([ 3., 2., -5., 5., 0., 5., -7., 5., 5., -3.]), 1.0, 4.546060565661952)
pythonimport scipy.stats as st t_stat = d.mean()/(d.std(ddof=1)/math.sqrt(n13)) p_one = 1-st.t.cdf(t_stat, df=n13-1) # for H1 >0 t_stat, p_one (0.6956083436402525, 0.25211895152209385)
pythonx14 = np.array([27,28,29,30,31,32,34], dtype=float) f14 = np.array([5,15,25,20,20,10,5], dtype=float) n14 = f14.sum() mean14 = np.sum(x14*f14)/n14 # sample variance: sum f*(x-mean)^2 / (n-1) var14 = np.sum(f14*(x14-mean14)**2)/(n14-1) s14 = math.sqrt(var14) n14, mean14, s14 (100.0, 29.9, 1.6483845780556543)
pythont975_99 = st.t.ppf(0.975, df=99) E14_95 = t975_99 * s14 / math.sqrt(n14) CI14 = (mean14 - E14_95, mean14 + E14_95) t975_99, E14_95, CI14 (1.9842169515086827, 0.32707526223835165, (29.572924737761646, 30.22707526223835))
pythonEprime = E14_95/2 n_req = (t975_99*s14/Eprime)**2 # but t changes; using same t is 4*n. here yields 4n. n_req 400.0
pythondef margin(n, s, conf=0.95): t = st.t.ppf((1+conf)/2, df=n-1) return t*s/math.sqrt(n) # find minimal n >=100 for margin <= E14_95/2 target = E14_95/2 n=100 while margin(n,s14,0.95) > target: n+=1 n, margin(n,s14,0.95), target (393, 0.16347574128051004, 0.16353763111917582)
pythont98_99 = st.t.ppf(0.98, df=99) # one-sided 98% U14 = mean14 + t98_99*s14/math.sqrt(n14) t98_99, U14 (2.0811615410059607, 30.243055458863676)
pythonx15=np.array([20,22,24,26,28],dtype=float) f15=np.array([22,16,22,28,12],dtype=float) n15=f15.sum() mean15=np.sum(x15*f15)/n15 n15, mean15 (100.0, 23.84)
pythonimport mpmath as mp def phi(z): return 0.5*(1+math.erf(z/math.sqrt(2))) vals = [2.14,2.49,1.85] conf_two=[2*phi(k)-1 for k in vals] conf_two [0.9676452332556678, 0.9872256904701135, 0.9356864504087725]
pythonphi(2.00), phi(1.96) (0.9772498680518208, 0.9750021048517796)
pythonx17=np.array([700,750,800,850,900,950,1000],dtype=float) f17=np.array([2,3,6,8,7,4,5],dtype=float) n17=f17.sum() mean17=np.sum(x17*f17)/n17 var17=np.sum(f17*(x17-mean17)**2)/(n17-1) s17=math.sqrt(var17) n17, mean17, s17 (35.0, 867.1428571428571, 85.70027896760926)
pythont975_34=st.t.ppf(0.975, df=34) E17_95=t975_34*s17/math.sqrt(n17) t975_34, E17_95 (2.032244509317718, 29.439075834719528)
pythonk = 10*math.sqrt(n17)/s17 k 0.6903221149765009
pythonconf = 2*st.t.cdf(k, df=34)-1 conf 0.5053226053743411
pythonnum14=np.sum(x14*f14) num14 2990.0
pythonsumx2_14=np.sum(f14*x14**2) sumx2_14 89670.0
pythons2_14=(sumx2_14 - n14*mean14**2)/(n14-1) s2_14, var14 (2.717171717171864, 2.717171717171717)
pythonnum15=np.sum(x15*f15) num15 2384.0
pythonsumx17=np.sum(x17*f17) sumx2_17=np.sum(f17*x17**2) sumx17, sumx2_17 (30350.0, 26567500.0)
pythons2_17=(sumx2_17 - n17*mean17**2)/(n17-1) s2_17, var17 (7344.5378151260975, 7344.53781512605)
Dưới đây là lời giải chi tiết Bài 13 → Bài 17 (theo đúng dữ liệu trong ảnh).
Bảng số liệu (nghìn đồng), cùng 1 mặt hàng nên dùng kiểm định t cặp.
Đặt :
Giả thuyết
Thống kê kiểm định
Bậc tự do . Với (1 phía):
Vì (p-value ) ⇒ không bác bỏ .
✅ Kết luận: Với mức ý nghĩa 5%, chưa đủ bằng chứng để nói giá trung bình sau Tết cao hơn trước Tết.
Bảng tần số:
Tổng mẫu:
✅ kWh.
Tính độ lệch chuẩn mẫu từ bảng tần số:
Trong đó:
Vì chưa biết ⇒ dùng phân phối t:
Sai số (nửa độ rộng):
✅ KTC 95%: kWh
✅ Sai số ước lượng: kWh
Sai số tỉ lệ nghịch :
Muốn ⇒ cần
Cần quan sát thêm:
✅ Cần thêm 300 cơ sở (lấy tổng ).
Hiểu là cận trên một phía cho với độ tin cậy 98%:
✅ Với độ tin cậy 98%: kWh.
Bảng:
Vì biết ⇒ dùng Z:
✅ KTC 95%: triệu
✅ Sai số: triệu
Thêm:
✅ Cần thêm 800 hộ.
Độ dài
✅ Lấy (làm tròn lên).
Độ rộng
Độ tin cậy:
✅ Độ tin cậy ≈ 19.74%.
Vì biết và tổng thể chuẩn:
✅ 96.76%
✅ 98.72%
✅ 93.57%
✅ 97.73%
✅ 97.50%
Bảng:
Tính phương sai mẫu:
với
✅ Sai số ước lượng (95%): ≈ 29.44 nghìn đồng
(Do đó KTC 95%: nghìn)
Ta có:
Độ tin cậy:
✅ Độ tin cậy ≈ 50.53%.
Nếu bạn muốn, mình có thể trình bày lại các bài theo đúng “mẫu bài thi” (ghi giả thuyết, công thức, thay số, kết luận) hoặc làm thêm Bài 18–20 luôn.