1 Pages (16 items)
Recursion in SMath - Can we use recursion in SMath? - Messages
Yes, recursion is possible. Although I don't remember how many levels are allowed.
Here is your example in an smath file.
Fibo_recursion_example.sm (3.56 KiB) downloaded 815 time(s).
Here is your example in an smath file.
Fibo_recursion_example.sm (3.56 KiB) downloaded 815 time(s).
1 users liked this post
Valery Ochkov 2023/10/24 16:48:00
WroteYes, recursion is possible. Although I don't remember how many levels are allowed.
Here is your example in an smath file.
Fibo_recursion_example.sm (3.56 KiB) downloaded 815 time(s).
Thanks! But I think it was not from me but from SMath error!
And the second!
Why 0!=1?
See
Factorial.sm (4.45 KiB) downloaded 789 time(s).

Here is the corrected Fibo recursive function...
Fibo_recursion_corrected.sm (4.21 KiB) downloaded 809 time(s).
As for 0!=1 the following page gives two explanations.
https://zero-factorial.com/whatis.html
Fibo_recursion_corrected.sm (4.21 KiB) downloaded 809 time(s).
As for 0!=1 the following page gives two explanations.
https://zero-factorial.com/whatis.html
WroteHere is a more streamlined version...
Thanks!
And what about
https://en.wikipedia.org/wiki/Ackermann_function
This seems to work for the Ackermann function...

Ackermann function.sm (4.49 KiB) downloaded 781 time(s).
Ackermann function.sm (4.49 KiB) downloaded 781 time(s).
1 users liked this post
Valery Ochkov 2023/10/24 22:08:00
WroteYes, recursion is possible. Although I don't remember how many levels are allowed.
Typical, factorial(n) command-line is limited ...factorial(40)
1 users liked this post
Valery Ochkov 2023/10/25 20:46:00
WroteOriginally Posted by: Gerry_Bush [url=/forum/yaf_postsm82817_Recursion-in-SMath.aspx#post82817][/url]Yes, recursion is possible. Although I don't remember how many levels are allowed.
Typical, factorial(n) command-line is limited ...factorial(40)
By same token, Fibonacci(n) command-line upper limit
Fibonacci(1473) ... 1.9069*10^307 ... Windows limit.
1 users liked this post
Valery Ochkov 2023/10/26 00:49:00
2 users liked this post
4 users liked this post
ioan92 2023/10/26 00:28:00, Valery Ochkov 2023/10/25 23:27:00, NDTM Amarasekera 2023/10/25 23:53:00, Oscar Campo 2023/10/26 16:39:00
WroteTypical, factorial(n) command-line is limited ...factorial(40)
The vectorized version n 170 ... 7.2574*10^306
1 users liked this post
Valery Ochkov 2023/10/26 00:49:00
2 users liked this post
Valery, Smath Gamma(x) is known 4 decimals.
Reported years ago, ignored.
Alvaro Gamma(x) 15 decimals
Reported years ago, ignored.
Alvaro Gamma(x) 15 decimals
Wrote... And what about
https://en.wikipedia.org/wiki/Ackermann_function
Ackermann function is not 'primitive recursive', which means that it can't be computed only with for loops. Here an iterative implementation with a stack and no recursion.
Ackermann-Iterative.sm (8.7 KiB) downloaded 790 time(s).

Best regards.
Alvaro.
2 users liked this post
1 Pages (16 items)
- New Posts
- No New Posts





