An idiosyncrasy, in how Maxima evaluates parameters.

One of the facts which I had written about Maxima in an earlier posting was, that it seems to have a number of functions, the purpose of which in English seemed to be, ‘Take a parameter or expression as input, but give me the value of this parameter.’ And what I had actually written was, that this availability of more than one similar function, could confuse me at one point in time, into not actually knowing what one specific function does. Yet, reflecting on the question outside the exercise that I was doing, brought back the gist of what that function really does. In the previous context, it was the function ‘ev()’.

A context which some other people have noticed instead, is that they’d like to use the Maxima ‘tex()’ function, in order to convert some expression into LaTeX, for another application to typeset, but in some cases the other users wanted to use previous lines of input directly, rather than to use previous lines of output. And what they found was, that the LaTeX version of what they had input, was a ‘verbatim’ block, different according to LaTeX, from what needs to be typeset as Math.

Both issues arise somewhere, because Maxima itself has been programmed in the language LISP. And, most of the time, LISP just seems to produce correct results, according to the way some people tend to interpret the meaning of the LISP function call. But in certain cases, people who either program in, or use LISP, need to form a mental, step-by-step picture of what the LISP interpreter actually does. LISP evaluates both atoms and lists, the latter of which could represent Mathematical expressions, but the former of which represent variables, in situations where their values are being referred to, and not the atom itself. At any point in the computation, LISP will actually evaluate an atom or a list, according to the same semantics. Given an atom, its value is returned, which could be another atom as easily as a list. And, given a list, to return its value means, to execute that list once.

The modern way to refer to what I’ve called an Atom here, is as a “Symbol”, which is really the name of a (LISP) Variable, that also has a value, at a given instant in time.

The way LISP generally defines lists, each of their elements may either be an atom or another list, ‘nested’ within its parent list. In LISP, lists are slightly more common, the first element of which is an atom, just because in such a case, this first element states which function is to be called on the remaining elements. But, in LISP, data is also represented as either a list or an atom, and then, in the case of a list, there is no specific need for the first element to be an atom, or one that represents a defined LISP function. (:1)

Obviously, most other Computing languages, including the one which Maxima interprets, states the function-name first, followed by one set of parentheses, around any argument-list, or around a parameter-list, in the case where the function is being defined. Infix operators are usually also represented internally, as predicates, in whatever data-format those can be represented. One major exception to this takes the form of ‘stack-based languages’, such as ‘FORTH’, and another exception exists in Assembler.

Aside: ‘Prolog’ represents both data and programming as an n-graph, meaning that in this language, each node of a tree may have an arbitrary number of branches, including zero, but additionally, an atomic predicate, stating whichever relationship between the other branches is to be satisfied.

The total number of times LISP evaluates a parameter is tightly defined, so that, if an atom represents a variable, which in turn has a list as its value, that item will result, but not be executed, unless the command is given explicitly, to evaluate the result of the previous evaluation. In LISP, the function which gives such an explicit command, is called ‘EVAL’, and the way to give that instruction, in any context where the variable ‘X’ is instantiated, is like so:

(EVAL X)

Because of the way LISP generally evaluates lists, since ‘X’ does not have a tick – a single quote – in front of it, ‘X’ was already evaluated once, before being passed to ‘EVAL’. And then, ‘EVAL’ evaluates whatever value ‘X’ had, a second time. Even according to Human thought, the fact that ‘X’ represented a value, can seem to disappear, so that Humans will also think, ‘Whatever is being referred to as X, evaluate that.’

Well, the way this works can be revealed, in certain uses of Maxima, such as, if the ‘tex()’ function is being called on an input identifier, when most of the time, it was meant to be used either, on an expression that has been parsed into a LISP structure, or, on a variable, which already evaluated to such an expression, before ‘tex()’ went to work on it.

Yet, because some people want to obtain the LaTeX representation of text, which they previously input, from Maxima, the following text-log displays where an extra step needs to be inserted, in order to accomplish this:

(Updated 7/14/2020, 22h15… )

Continue reading An idiosyncrasy, in how Maxima evaluates parameters.

Inkscape Extension ‘svg2tikz’ revisited.

In this earlier posting, I had written about the low-performing 3rd-party Inkscape Extension known as ‘svg2tikz’. Nevertheless, this extension may prove useful to some users, who wish to import an arbitrary document-type into Inkscape – preferably vector-based – and who wish to convert that into LaTeX in some way. And it seems that, even though this project was abandoned some time ago, work has slowly begun to resume on its source-code. And so, I should also fine-tune some of the earlier commentary I had made about this extension.

First off, there is an important detail about how to compile and install this extension, which its devs fail to point out anywhere. It needs to be built and installed, using Python 3, while many Linux computers still default to Python 2.7. Therefore, the commands to build and install it are:

 


$ python3 setup.py build
$ su
(...)
# python3 setup.py install

 

If one neglects this detail, then Unicode support is left out, and usually, SVG Files etc., will contain some Unicode characters. Further, as the Github comment states, while the importing of raster-based images is now supported, their import as Base-64 encoded, inline data is not. Therefore, within Inkscape, for example if a PDF File is being imported, the option needs to be unchecked, to ‘Embed’ graphics. And when Saving a Copy to TiKz Format, the option should also be unchecked, to ‘Indent Groups’.

But this last detail leads me to an important, additional observation. I have always known that the export of Text with the Figure has been dodgy. But lately, either because I’ve become more observant, or, because the behaviour of the latest version of the extension has improved, I’ve noticed what, exactly, goes wrong with Exporting Text along with the Figure.

(Updated 2/11/2020, 1h05 … )

Continue reading Inkscape Extension ‘svg2tikz’ revisited.

A simplified way to insert TikZ graphics into actual documents.

One of the observations I seem to be making is, that the technology-intensive part of the world is still using such tools as LaTeX, to typeset documents and vector-based graphics, such as Mathematical equations which I’ve included in previous parts of this blog, even though we know that GUI-based applications have existed for some time, that also typeset and do graphics…

I like ‘LaTeX’, even though I never learned the full syntax. LaTeX defines the document in a type of textual syntax. And there is even a system of TeX macros, which defines a sub-language called “TikZ”, that defines entire figures, sketches and plots, using a textual syntax.

Edit: Alternatively, there is a sub-language called “PSTricks”, which offers yet another way to do the same thing

And so a question which strikes me as important is, how to use these languages, even though I don’t know the syntax. And the answer is, ‘I use a GUI.’ That GUI mainly consists of the application ‘LyX’.

(Updated 3/07/2019, 17h55 … )

Continue reading A simplified way to insert TikZ graphics into actual documents.

Trying to bridge the gap to mobile-friendly reading of typeset equations, using EPUB3?

One of the sad facts about this blog is, that it’s not very mobile-friendly. The actual WordPress Theme that I use is very mobile-friendly, but I have the habit of inserting links into postings, that open typeset Math, in the form of PDF Files. And the real problem with those PDF Files is, the fact that when people try to view them on, say, smart-phones, the Letter-Sized page format forces them to pinch-zoom the document, and then to drag it around on their phone, not getting a good view of the overall document.

And so eventually I’m going to have to look for a better solution. One solution that works, is just to output a garbled PDF-File. But something better is in order.

A solution that works in principle, is to export my LaTeX -typeset Math to EPUB3-format, with MathML. But, the other EPUB and/or MOBI formats just don’t work. But the main downside after all that work for me is, the fact that although there are many ebook-readers for Android, there are only very few that can do everything which EPUB3 is supposed to be able to do, including MathML. Instead, the format is better-suited for distributing prose.

One ebook-reader that does support EPUB3 fully, is called “Infinity Reader“. But if I did publish my Math using EPUB3 format, then I’d be doing the uncomfortable deed, of practically requiring that my readers install this ebook-reader on their smart-phones, for which they’d next need to pay a small in-app purchase, just to get rid of the ads. I’d be betraying all those people who, like me, prefer open-source software. For many years, some version of ‘FBReader’ has remained sufficient for most users.

Thus, if readers get to read This Typeset Math, just because they installed that one ebook-reader, then the experience could end up becoming very disappointing for them. And, I don’t get any kick-back from ImeonSoft, for having encouraged this.

I suppose that this cloud has a silver lining. There does exist a Desktop-based / Laptop-based ebook-reader, which is capable of displaying all these EPUB3 ebooks, and which is as free as one could wish for: The Calibre Ebook Manager. When users install this either under Linux or under Windows, they will also be able to view the sample document I created and linked to above.

(Updated 1/6/2019, 6h00 … )

Continue reading Trying to bridge the gap to mobile-friendly reading of typeset equations, using EPUB3?