Commit c6415093 authored by Kittipong Maneewong's avatar Kittipong Maneewong

ส่งงาน week09

parent fba1e0f8
#1.1
from math import e
f1x = (e**(1.001)-e*0.999)/0.002
def f1x(x,h):
return (e**(x+h)-e**(x-h))/(2*h)
f1x(1,0.001)
#output 2.718282281505946
#1.2
from math import sin,cos,e
def fsinx(x,h):
return ((sin(x+h)*e**(-cos(x+h)))-((sin(x-h)*e**(-cos(x-h)))))/(2*h)
def fsinx_1():
return ((sin(1+0.001)*e**(-cos(1+0.001)))-((sin(1-0.001)*e**(-cos(1-0.001)))))/(2*0.001)
fsinx(1,0.001)
fsinx_1()
#output 0.7272689097917728
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