DEC64 Is the Wave of the Past

Own C.J.S. Hayward's complete works in paper!

Arbitrary precision arithmetic libraries are old hat. But this is different.

View project on GitHub.

This is a proof of concept, and only a proof of concept, for an approach that will allow exact precision arithmetic for any computable number. Want the square root of three to three decimal places? Realize later-on that the user wants twenty decimal places instead, or that the number of decimal places is dynamic? No need to refactor the original calculation; just ask the stored square root of three for twenty, or a user-supplied number, of decimal places. Have algorithms to calculate e and π? Add e and π together, and don't worry until later about how many decimal places you want for e + π. Numbers are stored with exact precision and decimal approximations are print-on-demand.

The approach is outlined in the original email:

I was thinking about a way to try to have integer-clean arithmetic on algebraic numbers, and a brief Google search for "integer-clean arithmetic algebraic numbers" did not turn up obvious software tools for integer-clean handling of algebraic numbers.

However, I think I may have found a way to use objects to circumvent the corruption that comes from naive use of floating point numbers, where the corruption can increase exponentially.

Let's say that every number is an object that is either:

  • Something that primitively can return an arbitrarily specified number of digits' accuracy, which includes π and e, eventually, but what I originally have in mind is just integers, which will just return more zeroes after the decimal point if you keep asking for more digits of accuracy. —OR—
  • An object storing a first number, a second number, and an operation between them (addition, multiplication, and exponentiation, and their inverses).

Let us furthermore suppose that each number object has a method to evaluate its contents to a specified accuracy.

Numbers in class should be calculable by querying both numbers with enough additional places of accuracy that, when the operation is performed on them, the error is orders of magnitude smaller than the requested accuracy. (Note that this leaves the door open to some question of rounding error; but if a certain number of digits' accuracy has rounding error that overlaps the rounding for the requested accuracy, more digits might be requested. Rounding error may be a fly in the ointment, although it would seem that an epsilon-delta style argument would establish that there are no corner cases that cannot be met by specifying enough digits.)

So if I request (31 / 10 + the square root of 2), accurate to three decimal places, and we say that we are giving two digits of padding, that resolves first to 31.00000 / 10.00000, round to 3.10000, and the second resolves to 2.00000 ^ .500000, which resolves to 1.41421. I add them, getting 3.51421, which I round to three decimal places, getting 3.514. And nothing in this calculation has been integer clean arithmetic in the usual sense, but the number has been evaluated accurately to three places, and it could just as well have been evaluated accurately to twenty places.

Now this abandons one feature that comes with specification floating-point arithmetic, namely that any number takes O(1) memory. This seems like numbers would have something more like O(n log n) memory, maybe more but seems subquadratic at least. And on a machine with 16 gigs of RAM, there may be some calculations where you want and can afford the memory consumption for these objects. For that matter, 16 megs of RAM might still be enough that you don't absolutely need O(1) floating point numbers.

I think I'll see about a Python package tomorrow.

Thoughts?

P.S. to [Name]: I'm interviewing with Google.

The proof of concept is only intended as a proof of concept, not a production release and not necessarily something that will handle every corner case. However, it is intended to clearly outline how one would go about such things and what the concept is that's being proven.

This is implemented in Python that is written to be executable pseudo-code, (perhaps apart from the laborious parser that takes integer, float, string, and Decimal values and converts them to Numbers built from integers). The code is meant to be not-clever, and serve programmers in other languages as pseudocode that demonstrates how one might go about implementing this approach to arithmetic and number in the language of one's choice.

Download Proof of Concept in Python.

View Source for Proof of Concept in Python.

The proof of concept, and this page, are licensed to you under your choice of the terms of the MIT and GPLv2 licenses.

This page is link-ware. If you like it, please consider a link to CJSHayward.com.

I Miss Aqua: A Retro-Themed Maverick

Revisited Years Later

This project is one that barely worked, for a time. There was a time when it provided an Aqua-themed virtual machine with a live web browser. Since then updates have undone most Aqua theming. More problematically, the one (then) current browser I could find that would work under Maverick Meerkat was a developer's build of Firefox, which didn't have to pull in the web of newer dependencies that practically anything else would, and that newer browser became astonishingly unstable, much worse than Internet Exploder 6. The main reason I am keeping it around, besides the fact that I can't foresee all of my visitors' needs, is that it provides the least geeky way to access the programming project I cut my teeth on programming, an arcane game called The Minstrel's Song.

Since then I have purchased one of (then) ten copies of Snow Leopard Server available on Amazon, the one OSX version where you are allowed to run on a virtual machine, and it has the Aqua look and feel. I've actually had to use some of the same skills; an older Chrome installs but will not update, and I had to do some juggling to get LibreOffice 4.3.3 installed. All the same, it's nice to have that option now open. (And use the installed Terminal.app without Sierra's epic instability in the built-in command line.)

I've been trying to find a way to get Aqua back on my Mac, and getting Aqua to display under any OS has been a trackless waste. But I've been able to stitch something together (nothing new) to offer a Linux old enough to display old Aqua themes and "look and feel" appropriately, while running a modern version of Firefox. And now it's here.

Some people regard the Aqua theme as done and gone, and passé. It's out of the Mac mainstream at any rate, and has been for the past couple of releases of Mac OSX.

But with a little help from VMware and a little open sourced Linux theming magic, it's possible to get Aqua back:

This configurable and nostalgic blast from the past, made available through customizable themable Linux, provides a small treat for people who liked the good old days of Mac Aqua. And it is available on all of Windows, Linux, and Mac: search for the free VMware Player, VMware Workstation, or VMware Fusion from the VMware site.

Download the "I Miss Aqua" virtual machine and network appliance now!

Apps and Mobile Websites for the Orthodox Christian Smartphone and Tablet: Best iPhone, iPad, Droid, Samsung, Android, Kindle, and Blackberry Mobile Websites and Apps

Own C.J.S. Hayward's complete works in paper!

Apps that are directly useful for ascesis

There are not many apps formally labeled as Orthodox Christian, but there are some apps and mobile websites that can be used in the pursuit of the spiritual discipline of ascesis. Among these apps are:

Ancient Faith Radio
The value of this app goes more or less without saying, but there is one caveat.

I visited a monastery whose rules included not playing recorded music, and I saw outside the nave an old man, with headphones on, listening to Byzantine chant, moving to its beat and off in his own world.

It struck me, if anything, as an act beneath the dignity of an old man. Being off in your own world is not good for anyone, but there are some things tolerated in youth that are just sad in a mature adult. And as best I can surmise the rule was not a rule against certain types of prohibited music (though acid rock would be a worse violation), but using technology to be off in your own world in the first place. And it is because of this that I rarely listen to recorded liturgical music: it is easily available, but there is something about it that is simply wrong. (And this is not just a matter of how digital music sounds to someone with perfect pitch.)

I know of nothing better in terms of Orthodox Internet radio than Ancient Faith Radio, and really have very little if anything to say how Ancient Faith Radio could better do the job of a radio station (or, as the case may be, two stations providing access to lectures, sacred liturgical chant, and access to past broadcasts). But I have some reservations about why Orthodox need to be doing the job of a radio station—as, for that matter, I have a cautious view of my own website. The ironically titled The Luddite's Guide to Technology lays out the attitude where a radio station with crisply rendered sacred song available on one's iPhone or Android should be used that much.

CJSHayward.com/psalms/?mode=mobile (bookmark for iPhone, iPad, Droid, Samsung, Android, Kindle, and Blackberry; tablet users may prefer CJSHayward.com/psalms/)
The Psalter is the greatest prayerbook of the Orthodox Church. This page selects a Psalm at random, until you click a link and it provides another Psalm at random. They seem to be helpful, chiefly because the Psalter is helpful.

The Kindle app for iPhone, iPod Touch, Droid, Samsung, Android, and Blackberry (not to mention PC's)
I wouldn't want to denigrate paperback books, but you can buy some of the greatest classics on Kindle: the Orthodox Study Bible (an edition I discussed in my Orthodox bookshelf), the Philokalia, and My Orthodox Prayer Book. Plenty of lesser works are available too: see my own Kindle offerings at CJSHayward.com.

Wants and Needs
Having this app is a want and not a need, but there are legitimate wants.

This is a simple but very well-executed app to help appreciate what are our wants, what are our needs, and what we have to be grateful for.

Apps that are generally useful

G.K. Chesterton said, "There is more simplicity in the man who eats caviar on impulse than the man who eats grape-nuts on principle." And there is more Orthodoxy in just using an iPhone as a tool for being human than going to the app store and looking for apps endorsed as religious.

Do a Google search for best iPhone apps, for instance, and you will find a wealth of app recommendations. And many of these can work as a support for an Orthodox life of ascesis: Orthodoxy did not invent the pot, the belt, or the hammer, and yet all of these can have a place. Not, perhaps, the same place as a book of prayers, but a legitimate place. Secular tools and activities are holy when they are used by a life out of ascesis. And there are some excellent apps; among them I would name PocketMoney, a personal finance tool;mSecure, a password manager; Things, a to-do list; GPS MotionX Drive, a navigation tool; Flashlight, which lets you use the LED as a flashlight; and the main Google app, a search app optimized for the web by the company that defined search. All of these have their place.

But there are many apps on those lists that are unhelpful. Games and entertainment apps are meant to kill time, which is to say that they are meant to provide a convenient alternative to the spiritual discipline that tolds monks, "Your cell [room] will teach you everything you need to know." And I suggest asking, in considering an app, "Does this support ascesis?" A to-do list helps with nuts and bolts of a disciplined life. An app to show a stream of new and different restaurants feeds gluttony. It is fine for Orthodox Christians to use apps that are not branded as Orthodox or ascetical, but the question "Does this support ascetical living?" (which is in no way a smartphone-centric question, but a basic question of Orthodox life, to be settled with one's priest or spiritual father perhaps), applies here.

A closing note: When do you call 9-1-1 (or 9-9-9)?

There is a good case to be made that the most important number for you to be able to call on any phone is 9-1-1. However, this does not mean that your first stop in dealing with boredom is to call 9-1-1 to just chat with someone. It may be the most important number for you to be able to call—and the only number that may save your life—but using 9-1-1 rightly means using it rarely.

I would not speak with quite equal force about smartphones, but I would say that if you really want to know how to use your smartphone in a way that supports Orthodox spiritual discipline, the biggest answer is not to use one more app or one more mobile website. It is to use your phone less, to visit people face to face instead of talking and texting, and to use apps a little more like you use 9-1-1: to get a specific task accomplished.

And this is without looking at the problem of an intravenous drip of noise. The iPhone and Android's marketing proposition is to deliver noise as an anaesthetic to boredom. And Orthodox use of the iPhone is not to deliver noise: all of us, with or without iPhones or Android devices, are to cultivate the ascesis of silence, and not make ourselves dependent on noise. And it is all too easy with these smartphones; they are designed so that it is too easy.

The Fathers did not say "You cannot kill time without injuring eternity," but on this point they could have. Killing time is the opposite of the ascesis of being present, of being attentive of the here and now that God has given us, and not the here and now that we wish to be in or the here and now we hope to get to. Contentment and gratitude are for here now, not what we imagine as better conditions. We are well advised to live astemeniously, and that is where the best use of iPhone and Android smartphones and tablets comes from.

Smartphones have many legitimate uses, but don't look to them for, in modern terms, a mood management tool.

Ajax without JavaScript or Client-Side Scripting

The Ajax application included in this page implements a legitimate, if not particularly useful or even usable, "proof of concept" with partial page updates based on server communication. It accepts a string, and then lets you click on one of a few buttons to see that string styled the way the button is styled, appending a link from the server. But it demonstrates one interesting feature:

It works just the same if you turn off JavaScript and any other client-side scripting completely.

How does it work?

Ajax partial page updates don't need to manipulate a monolithic page's DOM; the reason browser back buttons work in Gmail is an invisible, seamless use of iframes that create browser history. And not only can you do partial page updates via iframes without DOM manipulation, you can do it without client side scripting.

The source code to the server is available here, but it is simple, stateless, and doesn't really hold any secrets; it could be fairly well reconstructed simply by observing what is going on in the demo app above. The basic insight is that a webpage that talks to a server and makes partial updates can be made by the usual Ajax tools, but at least a basic proof of concept can be made with old HTML features like frames and iframes, links and targets, forms, and meta refresh.

This Ajaxian use of old web technologies may or may not produce graceful alternatives to standard Ajax techniques, either alone or in a "progressive enhancement"/"graceful degradation" strategy, but it may allow graceful degradation to be just a little more graceful, and JAWS might at least know when something on the sceen has changed. But here is a proof of concept that it is possible to implement a webapp with partial page updates and server communications that works in a browser that has JavaScript and any other client-side scripting turned off.