Initial data commit
This commit is contained in:
parent
72d218235f
commit
f23f22d71c
199087 changed files with 3378941 additions and 0 deletions
23
Task/Mutual-recursion/Maxima/mutual-recursion.maxima
Normal file
23
Task/Mutual-recursion/Maxima/mutual-recursion.maxima
Normal file
|
|
@ -0,0 +1,23 @@
|
|||
f[0]: 1$
|
||||
m[0]: 0$
|
||||
f[n] := n - m[f[n - 1]]$
|
||||
m[n] := n - f[m[n - 1]]$
|
||||
|
||||
makelist(f[i], i, 0, 10);
|
||||
[1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 6]
|
||||
|
||||
makelist(m[i], i, 0, 10);
|
||||
[0, 0, 1, 2, 2, 3, 4, 4, 5, 6, 6]
|
||||
|
||||
remarray(m, f)$
|
||||
|
||||
f(n) := if n = 0 then 1 else n - m(f(n - 1))$
|
||||
m(n) := if n = 0 then 0 else n - f(m(n - 1))$
|
||||
|
||||
makelist(f(i), i, 0, 10);
|
||||
[1, 1, 2, 2, 3, 3, 4, 5, 5, 6, 6]
|
||||
|
||||
makelist(m(i), i, 0, 10);
|
||||
[0, 0, 1, 2, 2, 3, 4, 4, 5, 6, 6]
|
||||
|
||||
remfunction(f, m)$
|
||||
Loading…
Add table
Add a link
Reference in a new issue