20
PROBLEM-SOLVING KANOKWATT SHIANGJEN COMPUTER SCIENCE SCHOOL OF INFORMATION AND COMMUNICATION TECHNOLOGY UNIVERSITY OF PHAYAO

Introduction to Problem-Solving · •Combination (การจัดหมู่) เป็นการจัดกลุ่มแบบไม่คำนึงถึงลำดับเช่น

  • Upload
    others

  • View
    0

  • Download
    0

Embed Size (px)

Citation preview

Page 1: Introduction to Problem-Solving · •Combination (การจัดหมู่) เป็นการจัดกลุ่มแบบไม่คำนึงถึงลำดับเช่น

PROBLEM-SOLVING

KANOKWATT SHIANGJENCOMPUTER SCIENCE

SCHOOL OF INFORMATION AND COMMUNICATION TECHNOLOGY

UNIVERSITY OF PHAYAO

Page 2: Introduction to Problem-Solving · •Combination (การจัดหมู่) เป็นการจัดกลุ่มแบบไม่คำนึงถึงลำดับเช่น

Contents

• Probability (ความนาจะเปน)

• Sample Spaces (ปรภมตวอยาง)

• Independent Events (เหตการณอสระ)

• Dependent Events (เหตการณไมอสระ)

• Conditional Probability (ความนาจะเปนแบบมเงอนไข)

2

Page 3: Introduction to Problem-Solving · •Combination (การจัดหมู่) เป็นการจัดกลุ่มแบบไม่คำนึงถึงลำดับเช่น

Probability (ความนาจะเปน)

• Estimate of the likelihood that event will occur เปนการประมาณจ านวนเหตการณใดเหตการณหนง วามโอกาสเกดขนเทาใด?

3

Source: https://www.authenticfx.com/probability-in-trading-forex.html

Source: https://www.microsoft.com/en-us/store/p/roll-the-dice/9wzdncrdcf4t

Source: https://mmp-stock.deviantart.com/art/FREE-STOCK-Playing-Cards-3-38090494

Page 4: Introduction to Problem-Solving · •Combination (การจัดหมู่) เป็นการจัดกลุ่มแบบไม่คำนึงถึงลำดับเช่น

Flip the Coin

4

P (Head) = 1/2

P (Tail) = 1/2

P (Head and Head) = (1/2) * (1/2)

P (Tail and Tail) = (1/2) * (1/2)

Source: https://www.authenticfx.com/probability-in-trading-forex.html

Page 5: Introduction to Problem-Solving · •Combination (การจัดหมู่) เป็นการจัดกลุ่มแบบไม่คำนึงถึงลำดับเช่น

Roll the Dice

5

P (One) = 1/6

P (Two) = 1/6

P (Six) = 1/6

...

Source: http://www.clipartpanda.com/clipart_images/clip-art-3-dice-dice-sides-47105723

P (One and One) = (1/6) * (1/6)

P (One and Two) = (1/6) * (1/6)...

P (Six and Six) = (1/6) * (1/6)

Source: http://www.freeiconspng.com/img/27643

P (One and One and One) = (?) * (?) * (?)

P (One and One and Two) = (?) * (?) * (?)

P (Six and Six and Six) = (1/6) * (1/6) * (1/6)

Source: https://www.microsoft.com/en-us/store/p/roll-the-dice/9wzdncrdcf4t

...

Page 6: Introduction to Problem-Solving · •Combination (การจัดหมู่) เป็นการจัดกลุ่มแบบไม่คำนึงถึงลำดับเช่น

Pick the Card

6Source: http://www.kimballmedia.com/Portfolio/PickAcard.htm Source: http://clipart-library.com/clipart/zcX5BGgbi.htm

P (Politician) = 3/6

P ( King of Club) = 1/52

P ( King of Club and King of Heart) = ? * ?

P ( King of Club and King of Heart) = (1/52) * (1/51)

Page 7: Introduction to Problem-Solving · •Combination (การจัดหมู่) เป็นการจัดกลุ่มแบบไม่คำนึงถึงลำดับเช่น

Vocabulary

O(x1,...,xn) = c1x1 + ... + cnxn

Subject to the condition:

a11x1 + a12x2 + ... + a1nxn {<=, = , >= } b1

a21x1 + a22x2 + ... + a2nxn {<=, = , >= } b2

...

am1x1 + am2x2 + ... + amnxn {<=, = , >= } bm

• xi are called the Decision variables

• O is the Objective function

• The conditions are called Constraints

7

Page 8: Introduction to Problem-Solving · •Combination (การจัดหมู่) เป็นการจัดกลุ่มแบบไม่คำนึงถึงลำดับเช่น

Vocabulary• Solution is any specification of values for the Decision variable

• Feasible solution is the one in which all the Constraints are satisfied

• Infeasible solution is the one or more of the Constraints unsatisfied

• Optimal solution is a feasible solution that minimizes / maximize the Objective function

• Solution (Search) Space is the set of all possible outcomes of the experiment

8

Page 9: Introduction to Problem-Solving · •Combination (การจัดหมู่) เป็นการจัดกลุ่มแบบไม่คำนึงถึงลำดับเช่น

Sample Spaces (ปรภมตวอยาง)

• The set of all possible outcomes of the experiment เปนเซตของความเปนไปไดท งหมดของผลลพธทจะไดจากการทดลอง

• Discrete Sample Space (ปรภมตวอยางแบบไมตอเนอง) เชน การโยนเหรยญ การโยนลกเตา เปนตน

• Continuous Sample Space (ปรภมตวอยางแบบตอเนอง) เชน อตราการเพมขนของมวลกระดกภายใน 1 เดอน เมอทานแคลเซยม 10000 มลลกรมทกวน หรอ การตดเชอกทมความยาว 1 เมตร เปน 2 สวน

9

Page 10: Introduction to Problem-Solving · •Combination (การจัดหมู่) เป็นการจัดกลุ่มแบบไม่คำนึงถึงลำดับเช่น

Events (เหตการณ)

• The subset of Sample Space เปนซบเซตของปรภมตวอยาง ประกอบดวย

• Simple Event (เหตการณเดยว) เปนการค านวณเหตการณทมค าตอบเดยว โดยค านวณจากความนาจะเปนของเหตการณ / ความนาจะเปนของเหตการณทงหมด เชน ความนาจะเปนของการโยนลกเตา 1 ลกใหได 6 แตม คอ 1 / 6

• Compound Event (เหตการณประกอบ) เปนการค านวณเหตการณทมค าตอบจากการประกอบกนของเหตการณ เชน ความนาจะเปนของการโยนลกเตา 2 ลกใหมคาผลรวมเปน 10 คอ 3 / 36

• Complementary Event (คอมพลเมนตของเหตการณ) เชน คอมพลเมนตของการโยนลกเตา 1 ลกใหได 6 แตม คอ 5 / 6

10

Page 11: Introduction to Problem-Solving · •Combination (การจัดหมู่) เป็นการจัดกลุ่มแบบไม่คำนึงถึงลำดับเช่น

Counting Sample Points (การนบจดตวอยาง)

• Multiplication Rule (กฎการคณ) เปนการค านวณหา Sample Space โดยพจารณาทางเลอกถดไป จากการทางเลอกกอนหนา

• Permutation (การจดล าดบ) เปนการจดเรยงแบบทตองค ำนงถงล ำดบเชน การหยบไพแบบสมจากส ารบ เพอเรยงล าดบจากนอยไปมาก

• Combination (การจดหม) เปนการจดกลมแบบไมค ำนงถงล ำดบ เชน

การหยบลกอมสแดง และ สเหลองอยางละ 2 ลกมาใสขวดโหล

11

Page 12: Introduction to Problem-Solving · •Combination (การจัดหมู่) เป็นการจัดกลุ่มแบบไม่คำนึงถึงลำดับเช่น

Multiplication Rule (กฎการคณ)

12

การโยนเหรยญ 3 ครง

S

H T

H T

H T

H T

H T H T H T

(2)

(2)

(2)

Sample Space ของการโยนเหรยญ 3 ครง = 2 * 2 * 2 = 8

Page 13: Introduction to Problem-Solving · •Combination (การจัดหมู่) เป็นการจัดกลุ่มแบบไม่คำนึงถึงลำดับเช่น

Multiplication Rule (กฎการคณ)

13Source: http://www.lazada.co.th/catalog/ Source: http://fullwaveshop.lnwshop.com

(4) (3)

Sample Space ของแตงตว = 4 * 3 = 12

Page 14: Introduction to Problem-Solving · •Combination (การจัดหมู่) เป็นการจัดกลุ่มแบบไม่คำนึงถึงลำดับเช่น

Multiplication Rule (กฎการคณ)

14Source: http://www.lazada.co.th/catalog/

Source: http://fullwaveshop.lnwshop.com

(4) (3)

Sample Space ของแตงตว = 4 * 3 * 6 = 72

(6)

Source: https://www.amazon.com/Girls-Tea-Party-Hat-Assortment/dp/B00ELXFSQI

Page 15: Introduction to Problem-Solving · •Combination (การจัดหมู่) เป็นการจัดกลุ่มแบบไม่คำนึงถึงลำดับเช่น

Permutation (การจดล าดบ)

15Source: http://clipart-library.com/clipart/zcX5BGgbi.htm

ใหหยบไพจากกองแบบสม แลวเรยงล าดบดงตวอยาง

Source: https://www.aliexpress.com/popular/gimmick-card-decks.html

Page 16: Introduction to Problem-Solving · •Combination (การจัดหมู่) เป็นการจัดกลุ่มแบบไม่คำนึงถึงลำดับเช่น

Permutation Formulation

• Sample Space ของการจดล าดบทตองของวตถทงหมด(n) ชนเทากบ n!

• Sample Space ของการจดล าดบทใชวตถบางสวน (r) จาก (n) ชนเทากบ

16

𝑛𝑃𝑟 =𝑛!

𝑛 − 𝑟 !

Page 17: Introduction to Problem-Solving · •Combination (การจัดหมู่) เป็นการจัดกลุ่มแบบไม่คำนึงถึงลำดับเช่น

Permutation of the Cards

• Sample Space ของการเรยงล าดบไพจากแตมนอยไปมาก จะมขนาด เทากบ

• 52 * 51 * 50 * 49 * ... * 3 * 2 * 1 = 52! (ไพทกใบถกเลอก)

• Sample Space ของการหยบไพ 2 ใบ จากกองโดยล าดบในการหยบมความหมายแตกตางกน จะมขนาดเทากบ (ไพไมไดถกเลอกทกใบ)

• 52 * 51 = 2,652

17

Page 18: Introduction to Problem-Solving · •Combination (การจัดหมู่) เป็นการจัดกลุ่มแบบไม่คำนึงถึงลำดับเช่น

Combination (การจดหม)

18Source: http://www.candyconceptsinc.com/4-Piece-Round-Glass-Canister-Set-wLids_p_4883.html

𝑛𝐶𝑟 =𝑛!

𝑛 − 𝑟 ! 𝑟!

Page 19: Introduction to Problem-Solving · •Combination (การจัดหมู่) เป็นการจัดกลุ่มแบบไม่คำนึงถึงลำดับเช่น

Combination

• ท าการหยบรายชอนสต 3 คน (ระบชอแตไมระบล ำดบ) จากทงหมด 10 คน

จากกลอง

19

10𝐶3 =10!

10 −3 !3!=

10∗9∗8∗7!

7! 3!=

10 ∗ 9 ∗ 8

3 ∗ 2 ∗ 1= 120

Source: http://laoblogger.com/raffle-box-clipart.html

Page 20: Introduction to Problem-Solving · •Combination (การจัดหมู่) เป็นการจัดกลุ่มแบบไม่คำนึงถึงลำดับเช่น

Q & A

20