[FIXED] Python: How do I write a dot over letters/variables, signifying the time derivative in physics?

Issue

I am looking for a way to place a bold dot above letters/variables to signify the time derivative. Ideally for both Python itself, but mainly for matplotlib axes.

I would expect something similar like:

print(u'1\u0305')

Although this is a very basic question, I cannot find anything, especially, because the term "dot notation" in Python is something completely different.

Thank you in advance.


Solution

The value (unicode code point) for a dot above letters (combining dot above) is '\u0307', so combining it with any letter will give you that letter but with a dot above.

dot = '\u0307'
print('n' + dot)  # ṅ
print('a' + dot)  # ȧ
print('v' + dot)  # v̇

An arrow right above is often used if you want these to refer to a vector.

arrow = '\u20D7'
print('n' + arrow)  # n⃗
print('a' + arrow)  # a⃗
print('v' + arrow)  # v⃗

Alternatively, you could use a combining macron.

macron = '\u0304'
print('n' + macron)  # n̄
print('a' + macron)  # ā
print('v' + macron)  # v̄


Answered By - Ted Klein Bergman
Answer Checked By - Senaida (Python.Easybugfix Volunteer)

Related Posts

Post a Comment