I want to compute the collatz sequence $(n,T(n),T^2(n),\dots)$

for $$n= 100\cdot \left \lfloor {\pi \cdot 10^{35}}\right \rfloor$$ with

$$T(n) = \begin{cases} \frac{3n + 1}{2} & \text{ if $n$ odd} \\ \frac{n}{2} & \text{ if $n$ even} \end{cases} $$ This sequence was computed before and is 529 steps long (i.e. $T^{529}(n)=1$).

If I compute it with Matlab, I have the feeling that he rounds up numbers which changes the exact sequence. My computed sequence is only 297 steps long. Is it possible to compute such a trajectory with Matlab?

  • $\begingroup$ I believe Matlab has a computer algebra toolbox based on MuPad (MathWorks bought MuPad in 2008, probably to replace the preceding CAS toolbox which was based on Maple, IIRW). However, Matlab is specialized on numerical analysis, maybe you should use another language (Python, Mathematica...) $\endgroup$ – Jean-Claude Arbaut Mar 28 '16 at 12:14
  • 1
    $\begingroup$ You have also that kind of library: mathworks.com/matlabcentral/fileexchange/… Anyway, don't expect to compute this with "basic" matlab, as it uses only floating point numbers, or maybe finite precision integers. $\endgroup$ – Jean-Claude Arbaut Mar 28 '16 at 12:24
  • $\begingroup$ You don't need to use MuPAD directly. If you have the Symbolic Math toolbox, as most do, see: help vpa $\endgroup$ – horchler Mar 28 '16 at 14:08

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.