Tze Heng's Miscs

This is a website where things that don't quite fit in either my main or blog site reside.

Sage codes for blog.ttheng.com

Dynamical Systems: Course Works

These are some interactive Sage code blocks for one of the articles in my blog site, titled Dynamical Systems: Course Works, which serve as a demonstration of code implementations that are part of the workings of some exercises of a course about dynamical systems.

Due to the technical limitations of the Docusaurus framework that makes embedding interactive Sage code blocks there fairly involved, I have decided to put the code blocks here instead, as this site is built using raw HTML and CSS, which is more straightforward to work with.

Chapter 1, Question 1

Note: The following code blocks are linked, so previous code blocks need to be executed to ensure that the following ones run properly.

Chapter 1, Question 2

Note: Please run the first code block (that defines compose_iter_2) beforehand so that this code block can execute properly.

The context of this code block is to implement Heron's method of computing square roots, by starting from a pair of positive integers \((1,z)\), then iteratively replacing the first and second coordinate by their arithmetic and harmonic means respectively. After a sufficient number of iterations, one can then see that the pair of numbers tends to \((\sqrt{z},\sqrt{z})\), yielding better approximations of the square root.

Chapter 1, Question 3

The following code snippet demonstrates a specific case of the periodicity of the last digits (before the decimal point) of \(x_n\), where \(x_n=n^2p/q\) and \((p,q)=(8,3)\) (which are coprime).

Here's another 'email to me' button!

'cause why not?

Email me!