Commit b5a5dfeb authored by Kittipong Maneewong's avatar Kittipong Maneewong

ส่งงาน week09

parent 61887d7c
...@@ -17,3 +17,19 @@ def fsinx_1(): ...@@ -17,3 +17,19 @@ def fsinx_1():
fsinx(1,0.001) fsinx(1,0.001)
fsinx_1() fsinx_1()
#output 0.7272689097917728 #output 0.7272689097917728
#จงเขียนฟังก์ชันเพื่อแสดงตารางค่าความสัมพันธ์ระหว่าง h กับ ค่า First CDA ของฟังก์ชันต่างๆในข้อ 1. เมื่อกำหนด x=1 และ h=[0.64,0.32,0.16,0.08,0.04,0.02,0.01,0.005,0.0025,0.00125]
def fx(x,h):
return [((sin(x+h[i])*e**(-cos(x+h[i])))-((sin(x-h[i])*e**(-cos(x-h[i])))))/(2*h[i]) for i in range(0,10)]
h=[0.64,0.32,0.16,0.08,0.04,0.02,0.01,0.005,0.0025,0.00125]
fx(1,h)
#output [0.7272315407770419,
# 0.7294856916511139,
# 0.7279664514641956,
# 0.7274522897769059,
# 0.7273152972988396,
# 0.7272805201077245,
# 0.7272717927303579,
# 0.7272696088183261,
# 0.7272690627111111,
# 0.7272689261761833]
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment