Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

sage recursive functions programming

Hi everyone, can anybody please help me with this please? I am still relatively new to sage programming.

I have two states here a and b, and function f to compute binary strings.

If f is at state a, then f(1) = 0, also return to state a, while f(0)=1, but goes to next state b.

b is the identity state, when f is at b, b(0)=0, and stays at state b, while b(1)=1, but goes back to state a.

for example: suppose start from state a, then we have f(100) = a(100) = 0a(00) = 01b(0) = 010 similarly, suppose we start from state b, then we have f(100) = b(100) = 1a(00) = 11b(0) = 110

Therefore, any binary strings can be calculated by the function and output another binary strings.

Can anybody please help me on how to program this in sage please? Thanks a lot.