Blog - Green scientific programming (Rev #10, changes)

Showing changes from revision #9 to #10:
Added | ~~Removed~~ | ~~Chan~~ged

This page is a blog article in progress, written by David Tanzer. To see discussions of this article while it was being written, visit the Azimuth Forum.

Please remember that blog articles need HTML, not Markdown.

*guest post by David Tanzer*

~~ What~~ As~~ can~~ a~~ programmers~~ programmer,~~ to~~ and~~ do~~ as~~ help~~ a human being, have you ever wondered how you could put your skills towards the~~ planet?~~ helping~~ In~~ of our~~ search~~ distressed~~ for~~ planet?~~ ways~~ Here,~~ to~~ let’s~~ address~~~~ this~~~~ question,~~~~ we~~~~ can~~~~ also~~ consider the~~ similar~~ idea~~ question,~~ of~~ which~~ “green~~ has~~ scientific~~ already~~ programming.”~~ been~~ But~~ posed~~ before~~ by~~ talking~~ John~~ about~~ Baez~~ scientific~~ at~~ programming~~ Azimuth:~~ for~~ What~~ environmental~~ can~~ applications,~~ mathematicians~~ let’s~~ do~~ say~~ to~~ a~~ help~~ few~~ the~~ words~~ planet?~~ about scientific programming itself.

That has led them to the pursuit of what could be identified as green mathematics, which includes topics in network theory that may be central to our understanding of life, the biosphere, and its potential modes of survival.

When I hear about “scientific programming,” a whole raft of associations come to mind, which tend to be somewhat narrowing and stereotypical: Scientific programming has roots in the 1950’s and the development of Fortran, was spoon-fed in its infancy from punched cards and mainframes, makes heavy use of numerical analysis and computation, is core to the NASA software development efforts, has gone through a transformation to the use of the compiled languages C and then C++; is driven towards intensive use of parallel processing hardware; has found applications in the “rocket science departments of financial institutions; pertains to the gathering of massive amounts of sensor data, and to the control of laboratory experiments; is a high-subspecialty, which might not in general make for scintillating conversation of an first date.

Except for the last slur against scientific programming, all of this is true! And I touched up many great aspects of the field in my list. Just for good mention, I’ll add as a sign of goodwill, another item to my list: scientific programming is extensively applied in signal processing applications, and has critical medial applications, such as to the processing [and interpretation] of MRI and echocardiogram data.

Nevertheless, I prefer to interpret it in somewhat more basic terms, as all programming that is associated with the scientific enterprise, including the wealth of technical applications such as the ones I have described, but also, cases where the software does not merely constitute “tools,” but where it serves as a primary medium for conducting experiments [and reasoning]. In particular, this means *simulations* – and modeling – as a means of experiment. Later in this article, I will talk about one such application, in the field of biological modelling, which may be a harbinger for a whole class of studies in scientific programming for environmental applications.

I’ll tell you right up front, that I don’t know enough abut scientific programming, or environmental applications, to lay out any kind of structured agenda for this field of study. What I can offer you is a “meta-idea” for an agenda, which is to ride on the wave that is now underway by some mathematicians who are pursuing environmental applications, and join up with them, to make a synergistic development effort.

One lead here is the work at the Azimuth group, which was founded by quantum-researcher-turned-environmental-mathematician John Baez. In various talks and papers, he as posed the question: What can mathematicians to help the environment [link]? The critical concept that this led him to formulate was the pursuit of *green mathematics*, defined as that mathematics which is critical to our understanding of the biosphere – everything living, along with its environment – and our role within it. His main postulate is that at the core of this mathematics will be the challenges posed by *network theory*, as the biosphere is itself a network of massive complexity. For a synopsis of these theses, see the article that we wrote called Prospects for a Green Mathematics.

While I am preparing the next article, your homework in the meantime will be to read and study the article that I just mentioned. I say this not merely out of vanity, but just as much because it gives an informal technical introduction to what may be a paradigmatic application of green mathematics, that shows a window to an uncharted continent of network-based studies of living nature – this is Qinglan Xia’s network-based model of a growing tree leaf.

In my next article, I will build upon that exposition, and describe that model for what it shows, qualitatively, about the exciting prospects for the field of “green scientific programming,” which lies at the crossroads of a number of studies: natural science, mathematics, programming and computer science.

Have you ever wondered how really good articles, such as this one, get written? Of course, each writer does their own thing, but the Azimuth group, which is an interdisciplinary community of scientists, mathematicians and programmers (and other interested folk), really helps a lot. The blog articles are the *results* of efforts that take place in the context of the *Azimuth Forum*, which is the permanent site where we flesh out ideas for research, blog articles; where we strategize for how to increase the reach of science into the horrible knot which is the environmental crisis; where we talk about how to extend the interface between professional science and the conditions of human nature.

– Here are some categories of the forum

If you are interested in anything you see on the forum, or what it could potentially be – then we are interested in you! Membership is free today, but it may double tomorrow, so don’t wait.

– The only real qualification for membership is a sincere desire to learn and participate

A good example of this kind of mathematics is Qinglan Xia’s network model of a growing plant leaf. It is essentially an network-based algorithm for plant development, which is based on simplified yet plausible physical assumptions. The model also presents evidence for a broader claim, which is that network theory is capable of illuminating the actual workings of nature.

So, here is one answer to what programmers can do to help the planet: help the mathematicians who are pursuing “green mathematics” and its applications!

Let’s start with Xia’s model, to see how programming can fit into the picture. Here, the veins of a leaf are modeled as a network of pipes for transporting fluids to the cells, and a growth mechanism is presented, which explains how the shape of the network determines its pattern of growth at each point in time. When this process is simulated on a computer, nice pictures of leaves are generated, and, with a suitable choice of parameters, they can take on a form similar to leaf types such as Maple and Mulberry.

Here we see a great intersection between fields, including natural science, mathematics, programming, and analysis of algorithms.

Natural science comes into play, in the assessment of how plants may actually develop. This led to a simplified model, which is constructed as an *algorithm* – a hypothesis about one of nature’s algorithms. Now an algorithm is a kind of mathematical process. It is realized, and brought to fruition – giving images of the leaves – by programming. Next, we can form hypotheses about the behavior of this algorithm – for instance, that the leaf will not grow beyond a certain size. This is a testable hypothesis, and the experiments are performed through programming. The analysis of algorithms also comes into play when we ask questions about the model and its computational complexity.

To flesh out the programming, mathematics and algorithm analysis of the matter, let’s describe a hypothetical case study.

To illustrate these ideas, suppose that we have some hypothetical model of plant development, which runs in discrete time, and takes place on a discrete grid. At any point in time, the “plant” consists of some squares in the grid – each occupied square is one cell of the plant. It is initialized to some collection of root cells, and the algorithm – a system of deterministic rules that defines a process – specifies which new cells get added on each iteration. Let’s suppose the root cells must make a connected horizontal segment, which is the base of the plant. We assume that the algorithm is deterministic, so that its complete evolution is a function of the length of the root.

Assume that cells never get deleted. Then either: the leaf stabilizes at a fixpoint, or it grows without bound.

Now we want to analyze the behavior of this algorithm; to form hypotheses about it, and to determine the truth or falsity of these hypotheses, either through reasoning or experiment.

Now an algorithm has an interesting double character: it is both a theoretical object, and a description of the empirical behavior of a machine that “runs” the algorithm. Statements about algorithms therefore have both a theoretical interpretation, and an empirical one. Statements about algorithms, therefore, can be approached both analytically and empirically, both with equal validity and precision. Depending on the case, however, one of these may be more productive of results.

Now any statement about an algorithm is both a purely mathematical statement and an empirical statement about the behavior of a computing machine. So we may be able to tackle questions about the algorithm using theoretical or empirical methods.

Consider for example the claim that for all root lengths, the plant will reach size at least 10 squares. We could solve this problem by analyzing the program, or empirically, using a program that tests the hypothesis for all root lengths less than 10. Each test is performed by running the growth algorithm. After a small number of iterations, it will have either stabilized to a size less than 10, or grown larger than 10 cells.

Now consider the claim that for all root lengths, the plant grows without bound. This is still equivalent to an empirical statement about the behavior of a computing machine, but now the statement is only falsifiable, but not decidable. It *is* an empirical statement, which can be concretized as follows: no matter what the inputs shape is to a machine which performs a single iteration, the output will be a proper superset of the input.

Finally, consider the statement that for all root lengths, the plant grows to a fixpoint. This is neither provable nor disprovable by empirical methods, and so theoretical analysis is the only viable approach.

Another type of analysis concerns the *computational complexity* of the algorithm. This pertains to the amount of resources consumed by the algorithm. For instance, for a given root configuration, consider the size of the leaf – or memory usage – as a function of time. Or consider the function which maps the root length to either infinity, if the plant grows without bound, or to the number of iterations that it takes to reach the terminal configuration. This is a measure of the *time complexity* of the algorithm. Here, we could measure time in terms of the number of steps that it would take for a uniprocessor to reach the terminal configuration, but that would be an unnatural measure. Rather, we are using nature’s computational model, which here consists of an unlimited pool of parallel processes (at the cells). The *space complexity* of the algorithm could be measured by the function which maps the root length to the size of the completed leaf (or infinity).

Note also, as we know from computer science, in general we are interested not in the minute details of these complexity functions, but in their asymptotic behavior – i.e., is the running time linear in the size of the input, or quadratic, or what have you.

So, to recap, we’ve just seen how programming, mathematics, and the analysis of algorithms come into play in this kind of study. But let’s not forget about natural science, which motivated Xia’s model of plant development. Xia’s model includes certain parameters representing the thickness of the veins, and the cost of transporting plant fluids through bends in the veins. The growth model is justified – albeit in an abstract and simplified way – on the basis of physical considerations.

A further enrichment of this picture is obtained by adding stochastic mechanisms – i.e. randomness – to the model, and using *statistics* to characterize the behavior of a plant development algorithm. Randomness gets introduced into a deterministic program whenever it uses random variables. E.g., flip a coin to determine whether or not to append a new cell directly above every cell that is on the “ceiling” of the plant.

In a stochastic model of plant development, we may ask, for example, about the expected height of the completed plant, as a function of the root length. Once again, programming provides a means for experimentally answering such questions. A master program runs many trials of the randomized algorithm, measures the heights of the plants, and computes the average. In fact, as things become more complex (stochastic), analysis becomes harder and harder to perform, and methods of scientific programming come more and more to the foreground as primary techniques.

I hope that this entree’ has given you a sense of some exciting possibilities in the realm of what could be called *green scientific programming.* It is a fertile context, with facets involving natural science, mathematics, programming, and the analysis of algorithms. There is a great opportunity here for collaboration between programmers, mathematicians and scientists. Here, you can learn “on the job” from people in a wide range of fields.

The Azimuth Project is an interdisciplinary community that aims to contribute, among other things, to the development of green mathematics and green scientific programming. If you are interested in exploring any of these ideas further, I encourage you to take a further step, which goes beyond the transient realm of blog discussions. Come join us at the Azimuth Forum, which is the permanent site where we hash out ideas for research, and where we develop and review these blog articles.

category: blog