BAHATI
ABDULKARIM
A’LEVEL APPLIED MATHEMATICS
FLOW CHARTS
SUITABLE FOR S.5 AND S.6
Flow Charts
The dry run
Contents
Constructing flow charts
Newton Rapson’s method with flow charts
BAHATI ABDULKARIM CONTACT ME ON : 0704739907
FLOW CHARTS
A flow chart is a diagram comprising of systematic steps followed in order to solve a problem.
Shapes used
1. Start/stop
START STOP START STOP
2. Operation assignment
N = N +1 N = N +1 READ: X0 PRINT: X
3. Decision Statement
BAHATI ABDULKARIM CONTACT ME ON : 0704739907
Start
DRY RUN
y=0 This is the method of predicting the outcome of a given flow chart using a table
X=0 Example 1: Perform a dry run and state the purpose of the flowchart
x y
X=x+1
0 1
1 1
Y=yx 2 2
3 6
Is
4 24
n=5? 5 120
6 720
Print: y The purpose of the flow chart is to compute and print 6!
The relationship is y = x!
stop
BAHATI ABDULKARIM
CONTACT ME ON : 0704739907
Start DRY RUN
Example 2: Study the flow chart below and perform a dry run and state the
S=0
purpose of the flowchart
N S
N=1 1 1
3 4
5 9
S=S+N N=N+2 7 16
9 25
11 36
Is NO
13 49
N = 15?
15 64
YES
Print: S The purpose of the flow chart is to compute and print the first
8square numbers
stop
BAHATI ABDULKARIM
CONTACT ME ON : 0704739907
Start DRY RUN
Example 3: Study the flow chart below and perform a dry run and state the
R=1
purpose of the flowchart
N S
0 1
C=0 1 2
2 4
3 8
R = 2R C=C+1
4 16
5 32
Is NO 6 64
C = 8? 7 128
YES 8 256
Print: C, R The purpose of the flow chart is to compute and print 28
stop
BAHATI ABDULKARIM
CONTACT ME ON : 0704739907
Start DRY RUN
Example 4: Study the flow chart below.
n=0 (a) Perform a dry run taking N = 20, X0=4 and
obtain the root correct to 3dp
(b) State the purpose of the flow chart
READ, X0 =1.2
N 𝑿𝒏 𝑿𝒏 + 𝟏 |𝑿𝒏 + 𝟏- 𝑿𝒏|
𝟒𝒙𝟑𝒏 + 𝟖 𝑋𝑛 = 𝑋 𝑛 + 1
𝒙𝒏+𝟏 = 𝟐
𝟔𝒙 + 𝟓
0 4.0 4.5 0.5
1 4.5 4.4722 0.0278
n=n+1
Is |𝑋𝑛 + 1- 𝑋𝑛| ≤ NO 2 4.4722 4.4721 0.0001
0.005?
YES
The square root is 4.472.
Print: 𝑿𝒏 + 𝟏 The purpose of the flow chart is to print the square root of a
number N.
stop
BAHATI ABDULKARIM
CONTACT ME ON : 0704739907
Constructing flow charts
The dry run
Contents
Constructing flow charts
Newton Rapson’s method with flow charts
BAHATI ABDULKARIM CONTACT ME ON : 0704739907
Constructing flow charts Start
Example 1: Draw a flow chart that reads N=1
S=0
and prints the mean of the first ten counting
numbers.
S = S+N
Solution: let S be the sum and m the mean
and N the number of terms m=𝑁
𝑆
N=N+1
Is NO
N = 10?
YES
Print: m
stop
BAHATI ABDULKARIM
CONTACT ME ON : 0704739907
Constructing flow charts
Example 2: A shop offered 25% discount on all items in its store and a
second discount of 5% to any customer who paid by cash.
(i). Construct a flow chart which shows the amount paid for each item.
(ii). Using your flow chart in (i),compute the amount paid for the following items.
Item 𝑷𝒓𝒊𝒄𝒆 𝑴𝒐𝒅𝒆 𝒐𝒇 𝒑𝒂𝒚𝒎𝒆𝒏𝒕
Matress 125,000 Cash
Television set 340,000 Credit
Constructing flow charts Start
Solution:
Read: P
(i). Let p be the price for the item, A the amount
paid for the item and C the credit payment
C = 0.75P
(ii). Amount paid for
television set; Is Payment
NO
Amount paid for the by cash?
matress; A=C
YES
= 0.75P A=C
A = 0.95C A = 0.95C
= 0.95x0.75P = 0.75x340,000
= 0.95x0.75x125000 = 225,000 Print: A
= 89062.5
stop
BAHATI ABDULKARIM CONTACT ME ON : 0704739907
Constructing flow charts Start
Example 1: Draw a flow chart that N=1
computes the cubes of the first twenty
counting numbers.
S= 1
Solution: let S be the sum and N the
number of terms N=N+1
Is NO
N = 20?
YES
Print: S
stop
BAHATI ABDULKARIM
CONTACT ME ON : 0704739907
Newton Rapson’s method with flow charts
The dry run
Contents
Constructing flow charts
Newton Rapson’s method with flow charts
BAHATI ABDULKARIM CONTACT ME ON : 0704739907
Newton Rapson’s method with flow charts
Example 1:
a) Determine the iterative formula for finding the fourth root
of a given number N.
b) Draw a flow chart that reads N and the initial
approximation, x0, computes and prints the fourth root of
N to 3dps.
c) Perfom a dry run for N = 150.10 and x0 = 3.200.
BAHATI ABDULKARIM CONTACT ME ON : 0704739907
Newton Rapson’s method with flow charts
Solution (a) 4𝑥𝑛4 − (𝑥𝑛4 − 𝑁)
4
Let, 𝑥 = 𝑁 𝑥𝑛+1 =
4𝑥𝑛3
⇒ 𝑥4 = 𝑁 3𝑥𝑛4 + 𝑁)
⇒ 𝑥4 − 𝑁 = 0 𝑥𝑛+1 =
4𝑥𝑛3
4
3𝑥𝑛 𝑁
𝑓 𝑥 = 𝑥4 −𝑁 𝑥𝑛+1 = + 3
3
4𝑥𝑛 4𝑥𝑛
𝑓 ′ 𝑥 = 4𝑥 3
3 𝑁
𝑓(𝑥𝑛 ) ∴ 𝑥𝑛+1 = 𝑥𝑛 + 3 , for n = 0,1,2,3,…
from, 𝑥𝑛+1 = 𝑥𝑛 − ′ ,𝑛 = 0,1,2,3, … 4 3𝑥𝑛
𝑓 (𝑥𝑛 )
𝑥𝑛4 − 𝑁
𝑥𝑛+1 = 𝑥𝑛 −
4𝑥𝑛3
CONTACT ME ON : 0704739907
BAHATI ABDULKARIM
Solution: Start
(b) (c) N = 150.10, x0= 3.200
n=0
N 𝑿𝒏 𝑿𝒏 + 𝟏 |𝑿𝒏 + 𝟏- 𝑿𝒏|
READ: N, X0
0 3.200 3.5452 0.3452
1 3.5452 3.5012 0.0440
3 𝑁 𝑿𝒏 = 𝑿𝒏 + 𝟏
𝒙𝒏+𝟏 = 𝑥𝑛 + 3 2 3.5012 3.5002 0.0010
4 3𝑥𝑛
3 3.5002 3.5002 0.0000
NO n=n+1
Is |𝑿𝒏 + 𝟏- 𝑿𝒏|≤0.005
? ∴ The root is 3.500(3d.p).
YES
Print: 𝑿𝒏 + 𝟏
stop BAHATI ABDULKARIM CONTACT ME ON : 0704739907
Newton Rapson’s method with flow charts
Example 2:
a) Derive a formula based on Newton Raphson method for finding
the reciprocal of a number N.
b) Draw a flow chart that reads N and the initial approximation, x0,
computes and prints the number and its reciprocal after 3
iterations or gives the reciprocal correct to 3dps.
7
c) Perfom a dry run for N = and x0 = 0.8.
6
BAHATI ABDULKARIM CONTACT ME ON : 0704739907
Newton Rapson’s method with flow charts
Solution (a) 𝑥𝑛−1 − (𝑁 − 𝑥𝑛−1 )
1 𝑥𝑛+1 =
Let, 𝑥 = 𝑥𝑛−2
𝑁
1 1 2𝑥𝑛−1 − 𝑁)
⇒𝑁= ⇒𝑁− =0 𝑥𝑛+1 =
𝑥 𝑥 𝑥𝑛−2
1
𝑓 𝑥 =𝑁− 𝑥𝑛+1 = (2𝑥𝑛−1 − 𝑁)𝑥𝑛2
𝑥
𝑓 ′ 𝑥 = 𝑥 −2
𝑓(𝑥𝑛 ) 𝑥𝑛+1 = 2𝑥𝑛 − 𝑁𝑥𝑛2
from, 𝑥𝑛+1 = 𝑥𝑛 − ′ ,𝑛 = 0,1,2,3, …
𝑓 (𝑥𝑛 )
𝑥𝑛+1 = 𝑥𝑛 (2 − 𝑁𝑥𝑛 ) for n = 0,1,2,3,…
𝑁 − 𝑥𝑛−1
𝑥𝑛+1 = 𝑥𝑛 −
𝑥𝑛−2
CONTACT ME ON : 0704739907
BAHATI ABDULKARIM
Solution: Start
(b) 7
(c) N = , x0= 0.8
n=0 6
N 𝑿𝒏 𝑿𝒏 + 𝟏 |𝑿𝒏 + 𝟏- 𝑿𝒏|
READ: N, X0
0 0.8 0.853 0.053
𝑿𝒏 = 𝑿𝒏 + 𝟏 1 0.853 0.857 0.004
𝑥𝑛+1 = 𝑥𝑛 (2 − 𝑁𝑥𝑛 )
n=n+1
NO
Is |𝑿𝒏 + 𝟏- 𝑿𝒏|≤0.0005
7
? ∴ For N = 0.86 (2d.p).
Is 6
n=2
YES ?
Print:N, 𝑿𝒏 + 𝟏
stop BAHATI ABDULKARIM CONTACT ME ON : 0704739907
Trial questions:
Examination-type question.
Given below are points of a flow chart not arranged in order.
Start READ:A a) Perform a dry run of your flow
stop 𝑩 Is B
chart by coping and completing
𝑪=
Is
B<0
𝟐 divisible
by 2
the table below.
? A B C
Print: C B=A-5 A A+1
46
a) Rearrange the points and draw a 77
complete logical flow chart. 120
b) State the purpose of the flow chart 177
BAHATI ABDULKARIM CONTACT ME ON : 0704739907
CONTACT
BAHATI ME ON: +256704739907
ABDULKARIM CONTACT ME ON : 0704739907