Question: how to do loop with 2 formula


there’s few redundant values. I just want the positive values. How it can be done?

restart

NULL

n := [80, 79, 83, 84, 83, 83, 81, 85, 86, 86, 83, 82, 83, 84, 81, 80, 83, 79, 82, 81, 85]

[80, 79, 83, 84, 83, 83, 81, 85, 86, 86, 83, 82, 83, 84, 81, 80, 83, 79, 82, 81, 85]

(1)

``

nops(n)

21

(2)

for i from 3 to 17 do f[i] := n[i-2]-3*n[i-1]+3*n[i]; i = i+1; f[i+1] := n[i-2]+4*n[i-1]-6*n[i]+n[i+1] end do

92

 

3 = 4

 

-18

 

82

 

4 = 5

 

-10

 

80

 

5 = 6

 

4

 

84

 

6 = 7

 

-1

 

77

 

7 = 8

 

14

 

95

 

8 = 9

 

-17

 

84

 

9 = 10

 

-9

 

85

 

10 = 11

 

-4

 

77

 

11 = 12

 

14

 

83

 

12 = 13

 

9

 

86

 

13 = 14

 

-3

 

85

 

14 = 15

 

-9

 

74

 

15 = 16

 

13

 

81

 

16 = 17

 

11

 

90

 

17 = 18

 

-18

(3)

``

NULL


 

Download fyp_2.mw

Please Wait...