Question: how to find answer by using previous answer

 i’ve run the coding. The result is almost my expectation. However, why is the previous value not be substituted into the next one? As example, f4 should be submitted into f5 to evaluate its value

restart:

m := [80, 79, 83, 92, 74, 80, 87, 77, 103, 84, 87, 77, 88, 86, 83, 80, 79, 80, 93, 68, 106, 76, 103]

[80, 79, 83, 92, 74, 80, 87, 77, 103, 84, 87, 77, 88, 86, 83, 80, 79, 80, 93, 68, 106, 76, 103]

(1)

 

F := k -> `if`(
                k::even,
                2/3*m[k] + 2/3*f[k-1] - 1/3*f[k-2],
                2/11*f[k-3] - 9/11*f[k-2] + 12/11*f[k-1] + 6/11*m[k]
                ):


f[2] := m[2];
f[3] := m[3];
for i from 4 to 23 do
  F(i):
end do;

79

 

83

 

271/3

 

-145/11+(12/11)*f[4]

 

160/3+(2/3)*f[5]-(1/3)*f[4]

 

(2/11)*f[4]-(9/11)*f[5]+(12/11)*f[6]+522/11

 

154/3+(2/3)*f[7]-(1/3)*f[6]

 

(2/11)*f[6]-(9/11)*f[7]+(12/11)*f[8]+618/11

 

56+(2/3)*f[9]-(1/3)*f[8]

 

(2/11)*f[8]-(9/11)*f[9]+(12/11)*f[10]+522/11

 

154/3+(2/3)*f[11]-(1/3)*f[10]

 

(2/11)*f[10]-(9/11)*f[11]+(12/11)*f[12]+48

 

172/3+(2/3)*f[13]-(1/3)*f[12]

 

(2/11)*f[12]-(9/11)*f[13]+(12/11)*f[14]+498/11

 

160/3+(2/3)*f[15]-(1/3)*f[14]

 

(2/11)*f[14]-(9/11)*f[15]+(12/11)*f[16]+474/11

 

160/3+(2/3)*f[17]-(1/3)*f[16]

 

(2/11)*f[16]-(9/11)*f[17]+(12/11)*f[18]+558/11

 

136/3+(2/3)*f[19]-(1/3)*f[18]

 

(2/11)*f[18]-(9/11)*f[19]+(12/11)*f[20]+636/11

 

152/3+(2/3)*f[21]-(1/3)*f[20]

 

(2/11)*f[20]-(9/11)*f[21]+(12/11)*f[22]+618/11

(2)

 

Download bbdf.mw

Please Wait...