1 / 31

ฟังก์ชัน (Function)

ฟังก์ชัน (Function). บทนำ. ในแคลคูลัส เราคุ้นเคยกันดีกับฟังก์ชัน f ที่มีค่าเป็นจำนวนจริง ซึ่งกำหนดด้วยตัวแปรอิสระ x  ℝ และมีตัวแปรตาม y = f ( x ), โดยที่ y  ℝ .

hanh
Télécharger la présentation

ฟังก์ชัน (Function)

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. ฟังก์ชัน(Function)

  2. บทนำ • ในแคลคูลัส เราคุ้นเคยกันดีกับฟังก์ชันfที่มีค่าเป็นจำนวนจริง ซึ่งกำหนดด้วยตัวแปรอิสระ xℝและมีตัวแปรตามy=f(x), โดยที่yℝ. • ฟังก์ชันในรูปแบบทั่วไป เป็นการกำหนดสมาชิกของเซตใดๆ ซึ่งเป็นที่รู้กันว่าเป็นการส่งค่าหรือทอดค่า (Mapping) จากเซตหนึ่งไปสู่อีกเซตหนึ่ง

  3. นิยามแบบทั่วไปของฟังก์ชันนิยามแบบทั่วไปของฟังก์ชัน • นิยามสำหรับเซตA, Bใดๆ, สามารถกล่าวได้ว่าฟังก์ชันf จาก (หรือ “mapping”) A ไป B (f:AB) เป็นการกำหนดค่าแบบเจาะจงเมื่อf(x)Bโดยที่xA • Some further generalizations of this idea: • A partial(non-total)function f assigns zero or one elements of B to each element xA. • Functions of n arguments; relations.

  4. A B • • • • y • • • • • x Bipartite Graph Plot ภาพประกอบการแทนฟังก์ชัน ฟังก์ชันสามารถที่จะแทนด้วยรูปภาพในแบบต่างๆ ได้หลายลักษณะดังนี้ f f • • a b A B Like Venn diagrams

  5. ฟังก์ชันกับตรรก • หมายเหตุประพจน์ใดๆ สามารถพิจารณาเป็นฟังก์ชันจาก “สถานการณ์” ที่ทอดค่าไปยังค่าความจริง {T,F} ตรรกใดๆ จะถูกเรียกว่า “situation theory” Ex. p=“ฝนกำลังจะตก”; s=สภาพแวดล้อมในขณะนั้น,ดังนั้นp(s){T,F}. • หมายเหตุตัวดำเนินการใดๆ ของประพจน์สามารถพิจารณาเป็นฟังก์ชันที่ทอดค่าจากคู่อันดับของค่าความจริงไปสู่ค่าความจริง Ex. ((F,T)) = T. →((T,F)) = F.

  6. ฟังก์ชันกับตรรก......(ต่อ)ฟังก์ชันกับตรรก......(ต่อ) • หมายเหตุพรีดิเคตใดๆ เป็นฟังก์ชันของวัตถุต่างๆ ที่ทอดค่าไปยังประพจน์ที่มีค่าความจริง Ex. P :≡ “is 7 feet tall”; P(Mike) = “Mike is 7 feet tall.” = False. • หมายเหตุสายของบิต B ที่มีความยาว nบิตสามารถพิจารณาเป็นฟังก์ชันชนิดหนึ่ง ที่ทอดค่าจากตำแหน่งของบิต {1,…,n} ไปสู่ค่าของบิตในตำแหน่งนั้นๆ{0,1}. Ex. B=101 B(3)=1.

  7. ฟังก์ชันกับเซต • หมายเหตุเซตSใดๆ ที่อยู่ในเซตเอกภพสัมพัทธ์Uสามารถพิจารณาเป็นฟังก์ชันที่ทอดค่าสมาชิกต่างๆในUไปสู่ค่า{T, F}, หรือกล่าวอีกอย่างหนึ่งก็คือสมาชิกแต่ละตัวในUอยู่ในเซตSหรือไม่ ตัวอย่าง:S={3}fS(0)=F, fS(3)=T. • หมายเหตุตัวดำเนินการของเซตใดๆ เช่น,, เป็นฟังก์ชันที่ทอดค่าจากคู่ต่างๆ ของเซตที่ถูกดำเนินการไปสู่เซตใหม่ที่เป็นผลของจากการดำเนินการ ตัวอย่าง:(({1,3},{3,4})) = {3}

  8. ศัพท์เฉพาะที่ใช้ในฟังก์ชันศัพท์เฉพาะที่ใช้ในฟังก์ชัน นิยาม Letf:AB, and f(a)=b (where aA & bB).Then A is the domain of f. B is the codomain of f. b is the image of a under f. a is a pre-image of b under f. In general, b may have more than 1 pre-image. The rangeRBof f is R={b | af(a)=b }. We also saythe signatureof f is A→B.

  9. เรนจ์เปรียบเทียบกับโคโดเมนเรนจ์เปรียบเทียบกับโคโดเมน หมายเหตุ • เรนจ์หรือพิสัยของฟังก์ชันไม่จำเป็นต้องเท่ากับสมาชิกในโคโดเมนทุกตัว • โคโดเมนคือเซตของฟังก์ชันที่ถูกทอดค่าจากสมาชิกแต่ละตัวในโดเมน • เรนจ์เป็นเซตเฉพาะและเป็นเซตย่อยในโคโดเมนที่ถูกทอดค่าจากเซตโดเมน นั่นคือR={b | af(a)=b }

  10. ตัวอย่างของเรนจ์เมื่อเทียบกับโคโดเมนตัวอย่างของเรนจ์เมื่อเทียบกับโคโดเมน ตัวอย่างสมมุติในการกำหนดเกรดให้นักศึกษา: “fเป็นฟังก์ชันที่มีการทอดค่าชื่อของนักศึกษาที่เรียนวิชานี้ โดยเกรดที่จะให้กับนักศึกษาคือ {A,B,C,D,F}” • จากตัวอย่างนี้, เซตของโคโดเมนคือ: __________, และเซตของเรนจ์คือ ________. • ถ้านักศึกษาทุกคนที่เรียนวิชานี้ได้เกรด A หรือไม่ก็ได้เกรด B ดังนั้นเรนจ์ของฟังก์ชันf คือ_________, ส่วนเซตของโคโดเมนคือ. {A,B,C,D,F} unknown! {A,B} still {A,B,C,D,F}!

  11. นิยามโดยทั่วไปของตัวดำเนินการในแง่ของฟังก์ชันนิยามโดยทั่วไปของตัวดำเนินการในแง่ของฟังก์ชัน นิยามตัวดำเนินการn-aryใดๆ ที่กระทำบนเซตSเป็นฟังก์ชันจากเซตอันดับn-tuples ที่เป็นสมาชิกของSไปยังตัวมันเอง Ex.ถ้าS={T,F},  can be seen as a unary operator, and, are binary operators on S. Ex. and  are binary operators on the set of all sets.

  12. การสร้างตัวดำเนินการของฟังก์ชันการสร้างตัวดำเนินการของฟังก์ชัน ถ้า  (“dot”) เป็นตัวดำเนินการใดๆ บนเซตBดังนั้นเราสามารถขยาย  เพื่อใช้แทนตัวดำเนินการของฟังก์ชันf:AB. Ex.ตัวดำเนินการไบนารีใดๆ :BBB, และฟังก์ชันf,g:AB, ที่กำหนดอยู่ในรูป(f  g):AB เพื่อกำหนดเป็นฟังก์ชันที่นิยามโดยaA, (f  g)(a) = f(a)g(a)

  13. ตัวอย่างของตัวดำเนินการฟังก์ชันตัวอย่างของตัวดำเนินการฟังก์ชัน ,× (“plus”,“times”) เป็นตัวดำเนินการไบนารี่บนเซตจำนวนจริงℝ. (Normal addition & multiplication.) ทั้งสองตัวดำเนินทำให้เราสามารถนำฟังก์ชันมารวมและคูณเข้าด้วยกันได้ดังนี้ Def. Let f,g: ℝ ℝ. (f  g): ℝ ℝ,where (f  g)(x) = f(x) g(x) (f × g): ℝ ℝ, where (f × g)(x) = f(x)× g(x)

  14. ตัวดำเนินการฟังก์ชันเชิงประกอบตัวดำเนินการฟังก์ชันเชิงประกอบ นิยามกำหนดให้g:ABและf:BC. ฟังก์ชันเชิงประกอบของ(composition function) f และ g, เขียนแทนด้วยf○g,ซึ่งกำหนดได้โดย (f○g)=f(g(a)) ข้อสังเกต ○ (like Cartesian , but unlike +,,) is non-commuting. (Generally, f○g  g○f.) A g B f C . a . g(a) . f(g(a))

  15. อิมเมจของเซตที่อยู่ภายใต้ฟังก์ชันอิมเมจของเซตที่อยู่ภายใต้ฟังก์ชัน Def. Letf:AB, and SA.The image of S under f is simply the set of all images (under f) of the elements of S.f(S) : {f(s) | sS} : {b |  sS: f(s)=b}. Note the range of f can be defined as simply the image (under f) of f’s domain!

  16. ฟังก์ชันแบบ one-to-one Def.A function is one-to-one (1-1), or injective, or an injection, iff every element of its range has only 1 pre-image. Formally: given f:AB,“f is injective” : xy{f(x) = f(y) x = y}. Only one element of the domain is mapped to any given one element of the range. Domain & range have same cardinality. What about codomain? Memory jogger: Each element of the domain is injected into a different element of the range. Compare “each dose of vaccine is injected into a different patient.”

  17. การทดค่าแบบ one-to-one Bipartite (2-part) graph representations of functions that are (or not) one-to-one: a• •1 • • • • b• •2 • • • c• • • •3 • • d • • • • • •4 • • •5 • Not even a function! Not one-to-one One-to-one

  18. Sufficient Conditions for 1-1ness For functions f over numbers, we say: f is strictly (or monotonically) increasing iff x>y  f(x)>f(y)for all x,y in domain; f is strictly (or monotonically) decreasing iff x>y  f(x)<f(y)for all x,y in domain; If f is either strictly increasing or strictly decreasing, then f is one-to-one. Ex. f(x) = x3 f(x) = 1/x (Converse is not necessarily true)

  19. ฟังก์ชันออนทู (Onto or Surjective) Def.A function f:AB is onto or surjective or a surjection iff its range is equal to its codomain (bB, aA: f(a)=b). Remark. An onto function maps the set Aonto (over, covering) the entirety of the set B, not just over a piece of it. Ex.Let f:ℝ ℝ. f(x) = x3is onto, f(x) =x2isnot onto. (Why?)

  20. การทอดค่าบนฟังก์ชันออนทูการทอดค่าบนฟังก์ชันออนทู Some functions that are, or are not, onto their codomains: • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • • Onto(but not 1-1) Not Onto(or 1-1) Both 1-1and onto 1-1 butnot onto

  21. Bijections • Def.A function f is said to be a bijection, (or a one-to-one correspondence, or reversible, or invertible,) iff it isboth one-to-one and onto. • Def.For bijections f:AB, there exists an inverseof f, writtenf 1:BA, which is the unique function such that • (where IA is the identity function on A)

  22. Inverse functions

  23. The Identity Function • Def.For any domain A, the identity functionI:AA (variously written, IA, 1, 1A) is the unique function such that aA,I(a)=a. • Some identity functions you’ve seen: • ing 0, ·ing by 1, • ing with T, ing with F, • ing with , ing with U. • Remark. The identity function is always both one-to-one and onto (bijective).

  24. • • • • • • • • Identity Function Illustrations The identity function: y y = I(x) = x x Domain and range

  25. กราฟของฟังก์ชัน We can represent a function f:AB as a set of ordered pairs {(a,f(a)) | aA}. Note that a, there is only 1 pair (a,b). Later topic: relations loosen this restriction. For functions over numbers, we can represent an ordered pair (x,y) as a point on a plane. A function is then drawn as a curve (set of points), with only one y for each x.

  26. A Couple of Key Functions In discrete math, we will frequently use the following two functions over real numbers: Def.The floor function ·:ℝ→ℤ, where x (“floor of x”) means the largest (most positive) integer  x. Formally,x :≡ max({iZ|i≤x}). Def.The ceiling function ·:ℝ→ℤ, where x (“ceiling of x”) means the smallest (most negative) integer  x. Formally,x :≡ min({iZ|i≥x})

  27. Visualizing Floor & Ceiling Real numbers “fall to their floor” or “rise to their ceiling.” Note that if xZ,x   x &x   x Note that if xZ, x = x = x. 3 . 1.6=2 2 . 1.6 . 1 1.6=1 0 . 1.4= 1 1 . 1.4 . 2 1.4= 2 . . . 3 3 3=3= 3

  28. Plots with floor/ceiling • Note that for f(x)=x, the graph of f includes the point (a, 0) for all values of a such that a0 and a<1, but not for the value a=1. • We say that the set of points (a,0) that is in f does not include its limit or boundary point (a,1). • Sets that do not include all of their limit points are generally called open sets. • In a plot, we draw a limit point of a curve using an open dot (circle) if the limit point is not on the curve, and with a closed (solid) dot if it is on the curve.

  29. Plots with floor/ceiling: Example Plot of graph of function f(x) = x/3: f(x) Set of points (x, f(x)) +2 3 x +3 2

  30. ทบทวนเรื่องฟังก์ชัน • Function variables f, g, h, … • Notations: f:AB, f(a), f(A). • Terms: image, preimage, domain, codomain, range, one-to-one, onto, strictly (in/de)creasing, bijective, inverse, composition. • Function unary operator f 1, binary operators , , etc., and ○. • The RZ functions x and x.

  31. จงเขียนหรือยกตัวอย่างฟังก์ชันต่อไปนี้จงเขียนหรือยกตัวอย่างฟังก์ชันต่อไปนี้ 1  ฟังก์ชันแบบหนึ่งต่อหนึ่ง(One-to-one) แต่ไม่เป็นฟังก์ชันแบบทั่วถึง(Onto) 2  ฟังก์ชันแบบทั่วถึงแต่ไม่เป็นฟังก์ชันแบบหนึ่งต่อหนึ่ง 3  ฟังก์ชันที่เป็นทั้งแบบทั่วถึงและแบบหนึ่งต่อหนึ่ง 4  ฟังก์ชันเชิงประกอบ(Composite function) เมื่อg = {(1, b), (2, c), (3, a)} โดยที่gเป็นฟังก์ชันจากเซตX = {1, 2, 3} ไปยังเซตA = {a, b, c, d} ส่วนฟังก์ชันf = {(a, x), (b, x), (c, z), (d, w)} โดยที่fเป็นฟังก์ชันจากAไปยังB = {w, x, y, z}ให้หา gf

More Related