Monday, January 24, 2022

 I have recently uploaded 2 python modules to pypi:

  1. OEISsequences: Python functions to generate The On-Line Encyclopedia of Integer Sequences (OEIS) sequences. Available at: OEISsequences · PyPI. Functions are available to compute the n-th term of a sequence or generate subsequence terms (and sometimes both) depending on what is more efficient.

  2. algebraic-connectivity-directed: Python functions to compute various notions of algebraic connectivity of directed graphs. Available at: algebraic-connectivity-directed · PyPI. I defined an extension of Fiedler's seminal algebraic connectivity concept (1973) to directed graphs in a 2005 Linear and Multilinear Algebra paper and have refined the concept in subsequent papers over the years to better capture the connectivity of directed graphs especially when they are "far" from being undirected. More information on these various notions of algebraic connectivity of directed graphs can be found in the following references:

    1. C. W. Wu, "Synchronization in coupled arrays of chaotic oscillators with nonreciprocal coupling", IEEE Transactions on Circuits and Systems-I, vol. 50, no. 2, pp. 294-297, 2003.

    2. C. W. Wu, "Algebraic connecivity of directed graphs", Linear and Multilinear Algebra, vol. 53, no. 3, pp. 203-223, 2005.

    3. C. W. Wu, "On Rayleigh-Ritz ratios of a generalized Laplacian matrix of directed graphs", Linear Algebra and its applications, vol. 402, pp. 207-227, 2005.

    4. C. W. Wu, "Synchronization in networks of nonlinear dynamical systems coupled via a directed graph", Nonlinearity, vol. 18, pp. 1057-1064, 2005.

    5. C. W. Wu, "Synchronization in Complex Networks of Nonlinear Dynamical Systems", World Scientific, 2007.

    6. C. W. Wu, "Synchronization in dynamical systems coupled via multiple directed networks," IEEE Transactions on Circuits and Systems-II: Express Briefs, vol. 68, no. 5, pp. 1660-1664, 2021.



Sunday, December 26, 2021

OEIS Explorer

I created a visualization tool for The On-Line Encyclopedia of Integer Sequences (OEIS) using Streamlit. It has an interface to gplearn to use symbolic regression to get the equation describing the sequence. It is still very rudimentary, but was able to find the correct equation for simple sequences like the oblong numbers (https://oeis.org/A002378) and fourth powers (https://oeis.org/A000583)

The tool is accessible via this link.



Sunday, November 7, 2021

Chaotic Attractor Explorer with Streamlit (ChAES)

Following up on the following post, I have added a Streamlit web application to visualize various chaotic attractors (link).

It is still a very rudimentary app. I hope to be able to add more features in the future.

Sunday, January 3, 2021

Googol, Google and Isaac Asimov

I have been a huge fan of Isaac Asimov's fiction since I was a youngster. I have read all his Robot series and Foundation series books and many of his short stories. I was fortunate enough to hear him speak at our university when I was an undergraduate student. In one of his (many) non-fiction books he wrote that 

"For instance, in a book entitled Mathematics and the Imagination (published in 1940) the authors, Edward Kasner and James Newman, introduced a number called the `googol,' which is good and large and which was promptly taken up by writers of books and articles on popular mathematics. Personally, I think it is an awful name, but the young child of one of the authors invented it, and what could a proud father do? Thus, we are afflicted forever with that baby-talk number."

Asimov passed away in 1992, 6 years before Google was founded and before the internet is woven into the fabric of our lives, ranging from communication to entertainment to commerce. As is well known, Google chose the name as a play-on-words of the word googol. I wonder what Asimov would have thought of the fact that a word derived from the "baby-talk" word is the name of one of the largest technology companies on the planet and is also used to denote the act of finding out information via the vast information source that is the World Wide Web, technological developments that I am sure he would have love to see.


Saturday, December 26, 2020

Harmonic mean of integers

The harmonic mean of a set of $n$ numbers $x_i$ is defined as $\frac{n}{\sum_{i=1}^n x_i^{-1}}$. While investigating the number of subsets of $\{1,...,n\}$ such that the harmonic mean is an integer (OEIS sequence A339453), I formulated and proved the following result, which states that for $n >1$ positive integers whose maximum is a prime power that is attained by a single element, their harmonic mean is not an integer:

Theorem: Let $x_i$ be a finite set of positive integers such that $x_j = \max_i x_i = p^k$ for some prime $p$ and positive integer $k$ and all other numbers $x_i$ are strictly less than $p^k$, then the harmonic mean of $\{x_i\}$ is not an integer.

Proof: Let $M$ be the least common multiple of $\{x_i\}$. Assume that $x_i$ are sorted in nondecreasing order. Thus $x_n = p^k$ and $x_i < p^k$ for all $i<n$ . Then $M = Wp^k$ where $p$ does not divide $W$. Let $Q_i = M/x_i$ and $Q = \sum_i Q_i$. This implies that $Q_n = W$ and $p$ divides $Q_i$ for $i <n$.

The harmonic mean $H$ can then be written as $nM/Q$. Since $p$ does not divide $W$, this implies that $p$ does not divide $Q$. Suppose $H$ is an integer. Then this implies that $Q$ divides $nM/p^k = nW$.

As $x_i < x_n$ for $i < n$, this implies that $Q_i > W$ for $i < n$, i.e. $Q > nW$, and this contradicts the fact that $Q$ divides $nW$ and thus $H$ is not an integer.

Monday, December 14, 2020

Visualizing chaotic attractors via 3D-printed models

 It has been 30 years since I first studied chaotic circuits and dynamical systems. At that time, we visualize the beautiful 3-D (and higher dimensional) chaotic attractors using a Silicon Graphics workstation. I was delighted to read in the December 2020 issue of the Notices of the AMS the article "Modeling Dynamical Systems for 3D Printing" by Stephen K. Lucas, Evelyn Sander and Laura Taalman. The ubiquity of inexpensive 3D printers makes it much easier to create 3D models of chaotic attractors. The authors provided excellent Mathematica and Matlab programs that make it easy to create STL files that can be sent to 3D printers to print these models. With python being able to be run on platforms ranging from PC to smartphones to Raspberry Pi's, I thought it would be nice to have a Python version of these programs. I ported the Matlab program to Python and utilized Python's object oriented features to make it easy to use them for other chaotic dynamical systems. 

The Python port is available here: https://github.com/postvakje/3d-printing-of-chaotic-attractor

The file dynamical_systems.py can be edited to add additional dynamical systems by providing the parameters, initial and ending simulation time, initial conditions and system equations. 

The data files that are output can be used with an script on OpenSCAD to create STL files.




Tuesday, November 24, 2020

The special place of the decimal number system

Modern society has been using the decimal number system for a long time, i.e. a number $n$ is expressed in base $10$ as $n = \sum_i b_i10^i$ where $0\leq b_i < 10$ are integers denoting the decimal digits of $n$.

Although there have been other cultures and civilizations who have used other number systems, most notably the Roman numerals and the Mayan base-20 number system, it was believed the decimal system was used by many due to us having 10 fingers. From a mathematical point of view, the base of the number system is arbitrary. For digital computers, using base 2 is more appropriate as it is easier to build components representing and processing 2-valued logic, or equivalently the binary digit, or the bit. It is interesting to note that one of the first (I said one of the first as there is a dispute whether the ABC computer is the first digital computer) digital computer, ENIAC, uses a decimal system and requires 10 vacuum tubes to represent a single decimal digit, each tube representing each of the numerals 0, 1, ..., 9.

Thus it came as a surprise to me that there is something inherently special about the decimal system. In 1964 Gustav Lochs proved the following theorem.

Lochs' theorem (1964): Let $m$ be the number of terms of a continued fraction expansion needed to determine the first $n$ decimal digits of a real number $x$. Then for almost all $x$, $\lim_{n\rightarrow \infty} \frac{m}{n} = \frac{ln(10)ln(64)}{\pi^2} \approx 0.970$.

What this tells us is that each coefficient of the continued fraction expansion contain slightly more information than each decimal digit. Had we use a base-11 numbering system, it would have been the opposite, each base-11 digit would contain more information than each additional continued fraction coefficient.


 


Monday, October 19, 2020

A 2D walk generated by primes

Consider starting at (0,0) on the plane and as we enumerate the primes p, except for 2 and 5, we take a step in the E, N, W, S direction depending on whether the last decimal digit of p is 1, 3, 7, 9 respectively.

The resulting 2D walk looks quite interesting. The first 200,000 steps looks like this:


The Python code used to generate this plot can be found here.
Using a different correspondence of last digit to directions, we get different, but qualitatively similar plots.
For instance (1->W, 3->E, 7->S, 9->N) gives us:
Overall, they seem more clustered and dense that a 2D random walk.

Wednesday, July 22, 2020

Happy casual π day!

Today is also known as π approximation day. Today is July 22, which is written as 22/7 in many countries.

22/7 is a rational number with repeating digits in decimal 3.14285714285714... and is one of the earliest approximation (besides the number 3) to π = 3.141592653589...  and has been used since antiquity. 22/7 approximates π to 2 decimal digits. 22/7 is also the second convergent in the simple continued fraction expansion of π. The convergents in this continued fraction are the best rational approximation of π, in the sense that if n/d with n and d coprime is a convergent, then no other rational number m/c with c ≤ d is closer to π.  It is interesting to note some other convergents have also been used as approximation to π. For instance the fourth convergent 355/113 = 3.141592920... matches up with π to 6 decimal places and was discovered by astronomer Zu Chongzhi (祖沖之) in the fifth century A.D.

I talked about these 2 approximations in my blog post from Pi Day 2017. For countries where the date format is YY/MM, we have to wait 2 years before we have a casual π or π approximation month during July 2022!

Monday, July 20, 2020

80's, 90's and today

I have been listening to a music channel called "80's, 90's and today" and it occurs to me that while there is only 1 decade between 80's and 90's, there are now 3 decades between 90's and today. When I was growing up, music from the 60's are considered oldies, perhaps the oldies today should include 80's and 90's music. Maybe the music channel should change its title, unless the implication is that "today" consists of music of the last 2+ decades (the 00's, the 10's and the start of the 20's) rather than grouped by a single decade, as was done before.