An introduction to Leibniz

Ayush Anand
4 min readApr 12, 2019

--

This summer I wanted to work on an open source project for Google summer of code. While looking for projects I came upon the Pharo community. The community is very active, ready to help beginners like me throughout the way.

The project that excited me the most was “Authoring and exploring scientific models in Pharo”. In layman terms this would involve me completing the Leibniz package in Pharo. Before we delve more into what the package would do and how I’ll go about it, in this article I’d like to introduce what Leibniz is and how it’ll help the scientific community.

What is Leibniz?

Leibniz is a way to represent scientific models that are both human and machine readable . It is a digital scientific notation which is used to represent scientific models. These might be equations, formulaes and other terms to describe them. Leibniz provides a way to represent these models and simultaneously play around with it. A user can implement or represent different models or equations while testing them at the same time. This is where Leibniz differs from other computer algebra systems like Sympy or Maxima. These softwares can be used to apply the various models but they hide the way the various components of the model work from the user. This creates a gap between the user and the model he/she implements.

Why Leibniz?

One of the major problems in the scientific community is the ability to replicate and reproduce scientific models. As computing power increases the rate at which these models are reproduced increases but this creates a black box kind of a scenario. There has been increasing gap between a scientific model or paper and the program implementing it. Many computational scientists nowadays run various models on softwares without really knowing the procedure.The translation from these models on paper to an efficient implementation of said model is often prone to various errors that escape the oldest form of review in the scientific community — peer review. More about this can be found in an article written by the creator of Leibniz and one of my mentors Dr.Konrad Hinsen here.

Leibniz makes it possible to define scientific models easily understandable by humans so they can better understand what’s happening and review the model. Once that is done the user can run these models and evaluate the terms and values to check if the model works or not.

How it works

The best way to understand Leibniz would be to take an example and how it works. In the further articles I’ll break down the individual terminologies involved.

Leibniz code is embedded into a document by and for the scientific community. A Leibniz document is written using a markup language that is an extension of the Scribble language used for Racket documentation.

Let’s say I decide to represent the methodology of finding the GCD of two numbers. Below is how I’d write it in Scribble and share it with people.

Leibniz Document representing GCD

The Leibniz document processor reads this markup language and generates from it.

  1. A human-readable version in HTML format
  2. A machine-readable version in XML format

The break-up of each of the Scribble commands(Beginning with @) will be explained in the upcoming articles.

The example above shows how algorithms can be shared and implemented in a common notation by people everywhere. Even tested as seen in eval-term. This let’s a novice or an advanced user to get an in depth understanding of said model.

Why port the package to Pharo?

The reason for Leibniz is to reduce the distance between the user and the models. Pharo excels at that as it’s a code base designed by users for the users. The advantage of Pharo is it’s interactive coding environment. Users can go into packages and classes and change the functions. For a scientific model that’s useful as users can even plot graphs of the sorts(categories and sets of values) of models. The built in inspector allows every model to broken down to it’s constituent materials.

The sorts for Add operation(Tree view)

Graphs as shown above make visualization of models way more interactive using the roassal2 package, one of the powerful tools in Pharo. The package isn’t complete with various subpackages incomplete and work left on the ones existing.

That is where I come in. I plan to blog my journey as I complete this project to help the scientific community in my own way. In part two of my article “An introduction to Leibniz” I explain the various components of the Leibniz document and how they work.

--

--