Skip to main content
Data Science Wizardry Blog by Attila Vajda

AB focused meditation

\( \TeX \)

the event algebra of focused meditation #

Last night I found that I can use event algebra successfully in mindfulness meditation. The practice is simple, I focus my attention to my breath, call this event A, and when my attention wanders, it is event B. I simply notice that my attention is on event A, or B. This seems to make it much easier to notice where my attention is. It helped me become relaxed and fall asleep, when my mind was in a distressed state.

This realisation was a result of trying to get out of a miserable state of mind. I felt sad about a particular feature of existence, and I thought of a person who (I imagined) was also sad about the same thing, and thought of a few other specific people who were also experiencing the same lethargy.

Drawing of my mind preoccupied, all black rectangle

Then I realised, that it was absurd to think that some specific person would be thinking of the same thing and be miserable, because I was miserable at the moment, because of a specific thing, etc. I noticed that my mind is focused on some particular thing, and my attention is paid to something.

Drawing of black circle, zooming out of immersed state of mind Mind attached to some thing, a line drawn from the black circle to a scribble

If my mind was focused on this particular thing, it might as well be focused on another thing. How the sunshine, for example, was so pleasant in the morning, and how this made the other person happy.

Another line drawn to another point A third line drawn to a heart

My mind could just as well be focused on any old thing, for that matter.

Drawing of person in meditation, NSDR, yoga nidra, mindfulness practice, a heart drawn in their chest

I practiced labeling states of mind similarly before, but this is the first time I could do this so clearly and simply. For example, when my mind would wander, I'd realise it: "Now!", "I'm doing it again.", "Thinking", "Feeling", "Intrusive thought!". Distinguishing the two attention states as A, B; 0, 1; True False; seems to help in noticing where the attention is at. It is also a neutral way of approaching states of mind, so it is in harmony with a non-judgemental attitude towards states of mind.

setting up TeX on this 11ty blog #

I asked on the 11ty Discord for advice, and received friendly help. SVG images of maths notation can be created server side, by the server, and client side, by the client. 11ty resonates with a server side approach, as its philosophy is to create a simple HTML form for the user. This is done by the server, as opposed to by the user's computer. At first I installed a client side version of MathJax, which is probably not the ideal, 11ty way to do things.

Pasting the following incantation into base.njk does the trick, it sets up the display of inline spells:

base.njk

<script>
  MathJax = {
  tex: {	
    inlineMath: [['$', '$'], ['\\(', '\\)']]
  },
  svg: {
    fontCache: 'global'
  }
  };
</script>
<script src="https://polyfill.io/v3/polyfill.min.js?features=es6"></script>
<script id="MathJax-script" async src="https://cdn.jsdelivr.net/npm/mathjax@3/es5/tex-mml-chtml.js"></script>

TeXZilla is a lightweight library specifically for display of TeX and LaTeX. Applying it server side is one right way to solve this problem.

Another way is to use an 11ty plugin for MathJax, which I will try to do, as I like how in the scikit-learn documentation we can right click on charms, and claim their sourcecode. If you right click on this enchantment, you will see what I mean:

$$ \int f(x) dx = F(x) + C $$

Creating Unix style questions of questions in Obsidian #

I find the practice of making small, Unix style notes, of questions I have, very useful. To illustrate it, I thought a permalink icon would be useful on the blog. MathJax documentation headers show a little permalink icon on hover:

Header with permalink icon

I have this question, and instead of discarding it, postponing it, I create a note of it. It is similar to using issues on GitHub. I now have a compact, mvp of a question to develop a solution to.

Question in markdown Other questions

making my first pull request ever #

I am ready to create my first contribution to the realm of Open Source! I found a typo in the MathJax documentation, but I don't know how to make a pull request.

While trying to set up the server side MathJax plugin I found another typo in the JavaScript code, and asked Mixtral computer agent to fix it:

baseURL:                   // URL for use with links to tags (when there is a <base> tag in effect)
       (document.getElementsByTagName('base').length === 0) ?
        '' : String(document.location).replace(/#.*$/, '')),

What is the output of this whimsy code puzzle?

I can now make no less than two meaningful contributions to the world of open source! 💡

Installing server side MathJax plugin for 11ty #

I would like to use the right click option of the MathJax library, but it is not ready for use.

Context menu of MathJax on scikit-learn docs

After researching and trying for a while, I set the client side MathJax, it is working as is.

A cool solution I found is to build a simpler form 11ty blog, and add the minimum MathJax server side requirements. It is very interesting, to learn how 11ty and node work.

Do stochastic events exist? #

Events to express in English words

$$ \large \overline{A} \cdot \overline{B} = \overline{A + B} $$

(A plus B) complementer Venn and truth table

AB means there are products on the red conveyor belt, and there are products on the blue. That is to say, there are products on both. (AB)' means there are no products on either. Their union is when there are products either on both, or on neither! I asked Mixtral computer agent, to write tongue twisters using neither and it generated an infinite loop of twisters:

Mixtral tongue twisters, infinite loop

Truth tables, and Venn diagrams improve my thinking, I really enjoy this process.

die roll problem #

Rolling a die twice, A is when the first roll is even, B is when the second roll is even. C is the product of the outcome of the two rolls is even, D is the product of the outcome of their product is odd. Express C and D events, with A and B.

How to express that the first die roll is even, in different ways?

This is some text in a \[ \small X_1 \equiv 0 \pmod{2} \] parent element.

$X_1 \equiv 0 \pmod{2}$

$X_1 \in {2, 4, 6}$

I find it tricky, to express the product of the outcomes of two die rolls.

This is very nice work.

I struggled to find the expression for the product of the outcome of events.

$A = \{2, 4, 6\}$
$B = \{2, 4, 6\}$
$C = \{(a, b) \mid a \in A, b \in B, ab \text{ is even}\}$
$D = \{(a, b) \mid a \in A, b \in B, ab \text{ is odd}\}$