# multiple screensaver randomized at a time interval

Anyone who worked with linux might be more familiar with XScreensaver. It was only late when I got myself familiar with it. But I was also quite annoyed that I didn’t had this possibility of using multiple screensaver that changes at a fixed time interval, say every 1 minute, alone on the first call of the screensaver by a Windows operating system. I think there is the possibility for a software to change the default screensaver to another random screensaver, but what I wanted was XScreensaver style in windows. I wanted one call of screensaver uninterrupted by the user input to change to another screensaver while the computer is still idle after a specific time interval.. and I wanted randomness as well. I searched high and low and found ScreenMonkey from the WWW. I think it has some .NET dependencies. In any case, I was a bit annoyed that I had to pay for it in order to get rid of the monkey between screensavers. It didn’t bother me that much, but I was still challenged to solve the problem on my own by making my own multiple screensaver randomizer.

After a little work I created multiscr for Windows. I’m sure it is a bit buggy and might not fit to everybody’s liking. After all, I did it only to please myself and not for other peoples consumption. Nevertheless, I’d like to share this, in case someone is interested in using it: Click here to download. A few words of warning though:

• The screensaver does not use Windows Registry to save user’s choice of screensaver. It saves everything in the %SYSTEMROOT% directory (usually in Windows/System32). So this directory should be writable to the program.
• Time interval to switch between screensavers should not be less than 10 seconds
• The program hooks to mouse and keyboard event to stop screensaver when the user makes a mouse or keyboard input (I’m doing everything manually instead of linking directly to Scrnsaver.lib which I personally find quite restrictive. This seems to work quite fine.)
• The program simulates a mouse (1 pixel movement) event to force the stop of the chosen screensaver to switch to another random screensaver after the given time interval.

I can release the code for free access upon request. At the moment I am not doing so because I need to make the extra work of making the code “better readable”, removing/customizing some of my unnecessary internal codes (which isn’t necessary to share for this program), put in a visual studio project file for ease of compiling and putting some kind of text about license or sharing. At the moment, I’m just too lazy esp. if not a lot of people are interested in the code anyway. Send me a line if you are interested.

# Generalizing Galois Theory for Commutative Rings – Part I

I am not sure why this idea has lost popularity after the 60’s. Papers appear about this, but more people seemed to be interested in it half a century ago. I would say, the idea started independently. On one hand we had a group of noncommutative algebraist and homological algebraist working on ideas that was probably once inspired from the category of fields. For instance separable algebras (separable fields) and von Neumann regular rings with its semiheriditary and quasi-inverse property (not far related to fields and product of fields) were, in my opinion, quit popular among noncommutative algebraist and homological algebraist. Then there were a group of people who purposely wanted to see ideas developed for Galois theory extended to rings. We have now definitions for separable ring extensions, splitting ring extensions and even algebraic extensions of rings (which is not the usual algebraic extension we would intuitively define). The last topic (algebraic extension) was studied by Borho, Enochs, Hochster and Raphael.

Having said that, I decided to add myself into the set of cooks (to make a better broth). Recently I proved the following for instance:

Proposition Let $A$ be a Baer ring and $B$ be its total integral closure (this is also called algebraic closure by Robert Raphael) and suppose $f\in A[x]$ is a non-zero monic polynomial over $A$. Consider the set of zeros $S$ of $f$ in $B$. Then $A[S]$ is a finitely generated module over $A$.

The proof is a bit technical and to share it I am going to give a lecture about it and write an article about this (to be continued…).

# Motorola Droid Mainboard

Short Hint: Do not disassemble your smartphone to replace the mother board battery. For a long story read the whole blog. To get to the final point, read the last paragraph of the blog…

Long time ago I bought my motorola droid I, second hand, for around €30. The smartphone has served me well even till now. In fact, it is still my first and only smartphone. Needless to say, slowly it is showing signs of its age. Now when I remove the phone battery from the back, the time is set to 01:00 and the date gets set to 01.01.1970. I figured that such smartphones should have an internal mainboard memory that will keep time setting intact even after removing the removable (or rather, “easily removable”) battery. In fact, it does. So I decided to disassemble my phone and replace this internal battery. If you observe carefully, the video where a person disassembles (I would say, rather unprofessionally) a motorola droid will show the internal battery:

I write “unprofessionally” because there is a video of a disassembly of a Samsung Galaxy that is so detailed and professionally done (with “correct” household equipments and in a correct way) that all other smartphone disassembly videos pales in comparison to this one:

Now, after disassembling. I noticed that I wasted my time doing so. There is indeed a button cell attached to the phone mainboard, I think it fits a CR2430 (almost 3mm in diameter). BUT.. the cell is soldered to the board. So no way of just slipping the battery away from the board. The solders are very fine, I would guess that i need a very fine and stable soldering machine to unsolder it and then solder a new battery. My soldering iron (and my shaky hands) will probably ruin the board. I ruined the battery connection anyway, the steel that was soldered to the battery was cut off when I tried to push the battery out (not realizing fast enough that it was soldered and not just glued). All was not lost, since the smartphone works anyway without the internal cell (which was already dead). I reassembled the phone back and just installed ClockSync from Google-Play to keep my time syncrhonized and exact. If I had a cell and a good soldering iron I could have tried more, but I think (in this situation) it is best to leave the phone until it is no longer usable and buy a new one. This is a good lesson though, since I learned a little bit more about the electronics of a smartphone and I can do better next time I want to disassemble. This is how I learned to construct my own PC and repair laptops in the beginning.

# Generalizing Galois Groups

There were many attempt to generalize the notion of algebraic extension of fields to other (more general) categories. One of my favourite generalization is for the category of reduced commutative rings which was made popular by the likes of Edgar Enochs, Robert Raphael and Mel Hochster. An algebraic extension in this category is just an essential extension that is an integral extension. Why is integral extension alone not enough? One simple reason is because one can never end an integral extension in this category (you can always find a strict integral extension of a reduced commutative unitary ring that is also reduced and commutative). The necessity of essential extension (essential extensions can be defined in a pure category theoretical way) allows a “largest” algebraic closure. In fact, Hochster has shown that any such reduced commutative unitary ring $A$ will have a largest essential and integral extension which is called the total integral closure of the ring. By largest we mean that for any essential and integral extension of $A$ there is an $A$-monomorphism from this extension to the total integral closure.

The total integral closure is also rightfully known as the algebraic closure of the ring. This name is justified considering the following characterization (made by Hochster):

Let $B$ be the total integral closure of $A$ then.
– All monic polynomials of degree $n\in\N$ with coefficients in $A$ are factored into $n$ linear polynomials with coefficients in $B$
– All residue domains with respect to ideals of $B$ are integrally closed in their algebraically closed field of fractions
(specifically all residue fields with respect to maximal ideals are algebraically closed)

This easily leads to the characterization of algebraically closed domains:
A domain is algebraically closed iff it is integrally closed and if its field of fraction is algebraically closed.

More was investigated by Raphael in the 90s who mostly looked at the von Neumann regular rings that are algebraically closed.

The next question one could pose is the following:
The fundamental groups in Galois theory enjoys the benefit of being finite. Can this be true for $A$-monomorphisms between an essential and integral extension of $A$ and its algebraic closure? I will give example for which we get infinitely such $A$-monomorphisms:

Let $A = \Q^\N$, then $\Q$ itself can be canonically be embedded (as a subring) of $A$ (namely taking the sequence for which all elements are equal). Then the polynomial $f:=(x^2-2)(x^2-3)$ is in $A[x]$ (we clearly abused notation here, $2$ (resp. $3$) is just the sequence of repeating $2$ (resp. $3$)). This polynomial has infinitely many zeros in the overring $B:=\Q(\sqrt{2},\sqrt{3})^\N$ of $A$ and clearly $B$ is both essential and integral extension of $A$. There are therefore infinitely many such zeros that can be mapped onto each other (product of the maps obtained from the usual Galois groups).

I do however believe that if we work with only one polynomial say $f\in A[x]$ then extending $A$ within $B$ such that it contains all the zeros of $f$ will give me a finitely generated $A$-module if $A$ is a Baer reduced commutative unitary ring. I will give a more detailed discussion about this in a next blog.

[1] E. Enochs, Totally Integrally Closed Rings. Proc. Amer. Math. Soc. 1968, Vol. 19, No. 3, p. 701-706.
[2] M. Hochster, Totally Integrally Closed Rings and Extremal Spaces. Pac. J. Math. 1969, Vol. 142, p. 767-779.
[3] R.M. Raphael, Algebraic Extensions of Commutative Regular Rings. Canad. J. Math. 1970, Vol. 22, p. 1133-1155.

# The New Way to do Math

I recently realized that I have missed all along an ingenious way to do math. This might sound naive or even stupid, but I really never knew! My way of doing math had never any form of discipline. I always stupidly believed that chaos can always result into pattern. My table is always messy, my notes are always scattered and I jump from sheet to sheet when I scribble my ideas. An absolute heaven for the pure lover of chaos! Well, I discovered a new way to improve my math. And it’s not really to clean the mess I just described.. I have not yet become wise enough to realize that. I realize a form of scheduling when I do math, and surprisingly it is delivering me good results.

So here is my recipe which I think is working very nicely for me: I spend alternating days doing reading and then creating new math or questions from what I read without much relying on anything new. So for instance on a Monday I read a paper I really liked (“like” means three things for me: 1. I like the subject 2. The paper is not more than 15 pages long if the topic is terribly new 3. I do not need more than 5 references to learn new things needed to understand the paper). I cram and prep on this paper as if it was my exam almost the whole day. The next day which is a Tuesday, I don’t read almost anything at all. I begin imagining myself writing a new paper based on questions I ask about the paper I read the previous day. If the paper still remains interesting I continue .. otherwise I just ditch the whole thing all-together.. I keep on pushing myself asking new questions not in the paper or even if it was in the paper, I probably did not completely understand the paper thoroughly. In general, I get a whole new understanding of the whole topic and either I understand the paper much thoroughly or I am in fact even ready to publish an extension to the paper or even a new topic not directly related to the paper.

# Graphing the Time Stamps

Remember here where I wrote about a python script that help me time stamp my activities. Now, I had an activity that I also wanted to graphically plot how much time I spent since I started on it. For this, I thought I make use of matplotlib and graph the progress graphically as a days-vs-(minutes spent/day) graph. I already had the csv file created by my time stamper and I wanted to use that data format to do this. But I wanted to have this more general, i.e. I wanted to just drag an drop any csv file created by the time stamping script and see the graph. To do this (I use windows!) I decided to allow window shell to drag and drop file into python scripts. This is done by adding to the windows registry as seen here:

 Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Python.File\shellex\DropHandler]
@=”{60254CA5-953B-11CF-8C96-00AA00B8708C}”

Now I can drag and drop csv files created by the stamper into this script to see the progress graph. The result would then look like so

Enjoy!

# Collatz conjecture reduced to residue class modulo $2^n$

As promised, I am going to present small part of my mathematical research in my blog and interested people can just download the paper for more detail. Often case, I just write down the abstract that is already part of my paper. I also will write down some history of how things were developed, which is otherwise not written in the paper or article.

I started a few months ago in the summer of 2014. Obviously, the $3n+1$ problem (or the Collatz conjecture) is not a field I have worked with before 2014. I do mostly algebraic geometry and commutative algebra. So I wanted something new. I personally thought that it would be easier to work with binary representations of the Collatz sequence and it turned out that, at least for me, I could understand the sequence better that way. I set myself that goal of looking for something new for at least a year until if things were not anymore promising I would just call an end to this research and start something else. Well at least I think I did find something new. Far from any form of solution to the conjecture or even something that might prove significant for the research community. It’s only significance is probably that it is a very easy to understand characterisation (or suficiency) for the Collatz conjecture to be true. Probably, after this or at least after I get this somehow published, I will not be doing much more and try to look at other things and then maybe every now and then take a glance at the Collatz conjecture again. I always need some change whenever I do something for a long time. If I do get lucky I might see something again, but there are no gaurantees. Well let me show the abstract of the paper:

Here we investigate the odd numbers in Collatz sequences (sequences arising from the $3n+1$ problem). We are especially interested in methods in binary number representations of the numbers in the sequence. In the first section, we show some results for odd Collatz sequences using mostly binary arithmetics. We see how some results become more obvious in binary arithmetic than in usual method of computing the Collatz sequence. In the second section of this paper we deal with some known results and show how we can use binary representation and OCS from the first section to prove some known results. We give a generalization of a result by Andaloro [1] and show a generalized sufficient condition for the Collatz conjecture to be true: If for a fixed natural number $n$, the Collatz conjecture holds for numbers congruent to $1$ modulo $2^n$, then the Collatz conjecture is true.

The paper thus provides a sequence of sufficiency set whose set-theoretic limit is the set $\{1\}$. Similar sequence of sufficiency set has been found before (the natural density approaches $0$ but the set-theoretic limit is not necessary the singleton containing $1$). I tend to think that this one is the simplest one. The paper in preprint form can be found here!

[1] P. Andaloro, On Total Stopping Times under $3x+1$ Iteration, Fibonacci Quarterly 2000, Vol. 38, No. 1, p. 73-78

# The Beginning of a Series of Math Blogs

I feel that I need to add more publicity to my mathematical works. Therefore, I have decided to add more mathematical discussion in my blogs. However, I will try to keep mathematical text in blogs to a minimum. I rather prefer a proper mathematical text in a pdf file than combinations of MathJaX, MathML etc. in a website. Though, I am quite aware that most people who browse would not really take the trouble to download or view a pdf file from the browser if they are not absolutely interested in the mathematical article. So what I will try to do in the future is to write a “preview” or abstract of what my paper or math article is about and maybe even write down the results in a blog and if people get interested they can freely download the full-fledged pdf article. Mathematical discussions in comments is naturally unavoidable, but for these I often just express my math by ascii.. Though sometimes, writing proper math equations and symbols becomes irresistible. And thus I installed the Simple MathJax plugin to help me write short descriptions of my mathematical work in a blog.

# Time Stamping in Python

I have written a script that allows me to time stamp my work during the day. I am sharing it with MIT license  here

I am mostly interested in having my timed activity saved in a csv file that will help me organize my time of the day. The script outputs a csv file with information about the date, time in which work has started, time in which work has ended, time difference of the two and the total time used for the day . So if you timed on for a day and then timed off at another day, then the script will detect it and ask you to give a time when you stopped your work in the day before. It is really merely to record my activity during that day and nothing more.  The script is text-based and if you run it, it will ask if you want to stamp time on or off. If you chose on and then the next time you run it (with the same data file) and ask to time off then it will accordingly do the computation and append the data file. If you chose time on (or time off) two consecutive time, then the script will ask you to first time off (resp. time on) your previous activity.  To run the script, I just place it in my common python library path (I only use Python 2.5 but I guess this would work for any newer version) and then I have a specific script that applied this script as a module in a folder where I have my specific activity. For instance if I have a folder in my PC where I often do my mathematical work, I place a python script with this content in it:

from time_stamp import timestamp
timestamp('./etc/math_timestamp.csv')


where the file ./etc/math_timestamp.csv is the relative filename from the place where the python script is located and where you want your data file (in this case math_timestamp.csv) to be saved. The data file is automatically created if it does not exist (only the directory should exist). Data file should not be tampered with, though it can be opened with any editor that understands csv (or a simple text editor). This allows me to time stamp fragmented  parts of my work while keeping my discipline and track for the amount of work I put for a specific task. For instance, I often would like to do 2 hours of math, 2 hours of chess and a few hours of other work and I use different data files for them (I don’t complete the 2 hours in one go). It definitely has kept me disciplined in the past few months and I have achieved more milestones by it. Simple but effective and yet not so sophisticated like a full fledged UI or something. That’s the way a minimalist like me wants it!

# Mesh to Point Cloud

I am working on a project wherein I need to convert a 3D mesh into a pointcloud. I tried looking at possible freeware that could do it for me, but in the end I decided to write my own program. The reason is simply because I need to automate a few things and it is easier if it is a program I made. I am working on an algorithm on medial axis that will help me on analytic path planning and this is one step towards this.

I will soon publicize the source code of this simple program, but before doing so I will write a bit about the algorithm used. A lot of mesh to point cloud algorithms rely on something sophisticated e.g. sampling based on ray tracing. But I decided to take something natural (which has probably been done before). Since I am mostly working with STL binary mesh format (I also love ply, obj and other 3D formats, but stl was what I was doing most of my work with), I decided to just discreticize the triangles (basically the polygon types in a STL file) and refine them iteratively to reach a certain sampling resolution.

The input for the program is an stl file and the resolution of the pointcloud. Alternatively one can input a second finer resolution. The algorithm works in the following way: First triangle edges are discretize using the finer resolution, say e. Then if one is able to inscribe in the triangle another triangle whose edges are e distance away from the original triangle we get something like the picture below

Interior Triangle e distance away from the exterior triangle

This is done iteratively until the edge of the inner triangle cannot be e distance away from the previous inner triangle (or the outer triangle if still in the first iteration). The edges of all inner triangles are then discreticize using the given resolution. The resulting triangles would then look like this

point-cloud with finer resolution from one triangle

We now have a uniform distribution of points (a very fine point-cloud) in each triangle making up the mesh. The algorithm then uses a one-way trapdoor function using modulo arithmetic on three big primes (see [1]). The algorithm for the one-way trapdoor function produces a spatial hashing function and is described in [2].

The finer point-cloud is randomly shuffled and a first point is chosen from the point cloud generated from the triangles, the image of this point from the trapdoor function is computed and added to a list of scalars and the point is added to a list of points (a new point-cloud) if the image has not yet been added before (we may have two points of the same image if the points belong to the same leaf of an octree described the rougher resoluton). We continue choosing random points and adding it to the lists using the condition on the images until we exhausted all points. The resulting point-cloud from the list is the output of our algorithm.

You can download the program (7-zipped) by clicking here. Files can also be dragged into the window. A window based program starts if no parameter is given, otherwise with the correct parameter you can also run the program using command line. To know the parameter just give any parameter in command line and if the program detects wrong parameter it will display th usage  e.g.:

wmesh2pc help

at command line will display the usage.

[1] A. Menezes, Elliptic Curve Public Key Cryptosystem. Kluwer Academic Publishers, 1993.
[2] M. Teschner, B. Heidleberger, M Müller, D. Pomeranets, M. Gross, Optimized Spatial Hashing for Collision Detection of Deformable Objects. Proc. Vision, Modeling, Visualization VMV’03, Munich, Germany, pp. 47-54, Nov. 19-21, 2003.