Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/batch-file/6.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Math 离散数学递归定义_Math_Recursion_Definition - Fatal编程技术网

Math 离散数学递归定义

Math 离散数学递归定义,math,recursion,definition,Math,Recursion,Definition,所以我们在课堂上研究这个问题,对于f(2),我得到了相同的答案,但是对于f(3),我得到了与教授不同的答案 Basis: f(0) = -1 and f(1) = 2 Recursion: f(n) = f(n-2) - f(n-1) For f(3) I am getting 1 f(3-2) - f(3-1) =f(1) - f(2) =2 - f(2-2) - f(2-1) =2 - -1 - 2 =2+1-2 = 1 但他得到的答案是: 5 这应该是 = 2 - (-1-2) =

所以我们在课堂上研究这个问题,对于f(2),我得到了相同的答案,但是对于f(3),我得到了与教授不同的答案

Basis: f(0) = -1 and f(1) = 2
Recursion: f(n) = f(n-2) - f(n-1)

For f(3) I am getting 1
f(3-2) - f(3-1)
=f(1) - f(2)
=2 - f(2-2) - f(2-1)
=2 - -1 - 2
=2+1-2 = 1
但他得到的答案是:

5
这应该是

= 2 - (-1-2) = 2 + 1 + 2 = 5
因为f(2)是整个f(2-2)-f(2-1)。谢谢
= 2 - (-1-2) = 2 + 1 + 2 = 5