- Unicode characters for engineers in Python
- Useful unicode symbols in engineering
- Greek lower case letters
- Greek upper case letters
- Related Posts:
- Recent Posts
- Greek Alphabet in a Jupyter Notebook
- Tab completion in a Jupyter notebook
- Greek Alphabet Cheat Sheet
- beniwohli / greek_alphabet.py
- Saved searches
- Use saved searches to filter your results more quickly
- License
- EZSNoVa/greek-alphabet
- Name already in use
- Sign In Required
- Launching GitHub Desktop
- Launching GitHub Desktop
- Launching Xcode
- Launching Visual Studio Code
- Latest commit
- Git stats
- Files
- README.md
- About
Unicode characters for engineers in Python
Unicode characters are very useful for engineers. A couple commonly used symbols in engineers include Omega and Delta. We can print these in python using unicode characters. From the Python interpreter we can type:
>>> print('Omega: \u03A9') Omega: Ω >>> print('Delta: \u0394') Delta: Δ >>> print('sigma: \u03C3') sigma: σ >>> print('mu: \u03BC') mu: μ >>> print('epsilon: \u03B5') epsilon: ε >>> print('degree: \u00B0') degree: ° >>> print('6i\u0302 + 4j\u0302-2k\u0302') 6î + 4ĵ-2k̂
All of these are unicode characters. Python has support for unicode characters built in. You can check if your system supports it by importing the sys module and calling the sys.getdefaultencoding() function
>>> import sys >>> sys.getdefaulencoding() 'utf-8'
If you see utf-8 , then your system supports unicode characters. To print any character in the Python interpreter, use a \u to denote a unicode character and then follow with the character code. For instance, the code for β is 03B2, so to print β the command is print(‘\u03B2’) .
There are a couple of special characters that will combine symbols. A useful one in engineering is the hat ^ symbol. This is typically used to denote unit vectors. We can add a hat ^ (also called a circumflex) by putting the unicode escape after the letter you want to add a hat to. For example to add a hat to i the command is print(‘i\u0302’) .
Below is a list of symbols and greek letters and the corresponding unicode escape to produce the character in python.
Useful unicode symbols in engineering
unicode | character | description |
---|---|---|
\u0394 | Δ | GREEK CAPITAL LETTER DELTA |
\u03A9 | Ω | GREEK CAPITAL LETTER OMEGA |
\u03C0 | π | GREEK SMALL LETTER PI |
\u03F4 | ϴ | GREEK CAPITAL THETA SYMBOL |
\u03BB | λ | GREEK SMALL LETTER LAMDA |
\u03B8 | θ | GREEK SMALL LETTER THETA |
\u03B1 | ° | DEGREE SYMBOL |
i\u0302 | î | i HAT |
j\u0302 | ĵ | j HAT |
k\u0302 | k̂ | k HAT |
u\u0302 | û | u HAT |
Greek lower case letters
unicode | character | description |
---|---|---|
\u03B1 | α | GREEK SMALL LETTER ALPHA |
\u03B2 | β | GREEK SMALL LETTER BETA |
\u03B3 | γ | GREEK SMALL LETTER GAMMA |
\u03B4 | δ | GREEK SMALL LETTER DELTA |
\u03B5 | ε | GREEK SMALL LETTER EPSILON |
\u03B6 | ζ | GREEK SMALL LETTER ZETA |
\u03B7 | η | GREEK SMALL LETTER ETA |
\u03B8 | θ | GREEK SMALL LETTER THETA |
\u03B9 | ι | GREEK SMALL LETTER IOTA |
\u03BA | κ | GREEK SMALL LETTER KAPPA |
\u03BB | λ | GREEK SMALL LETTER LAMDA |
\u03BC | μ | GREEK SMALL LETTER MU |
\u03BD | ν | GREEK SMALL LETTER NU |
\u03BE | ξ | GREEK SMALL LETTER XI |
\u03BF | ο | GREEK SMALL LETTER OMICRON |
\u03C0 | π | GREEK SMALL LETTER PI |
\u03C1 | ρ | GREEK SMALL LETTER RHO |
\u03C2 | ς | GREEK SMALL LETTER FINAL SIGMA |
\u03C3 | σ | GREEK SMALL LETTER SIGMA |
\u03C4 | τ | GREEK SMALL LETTER TAU |
\u03C5 | υ | GREEK SMALL LETTER UPSILON |
\u03C6 | φ | GREEK SMALL LETTER PHI |
\u03C7 | χ | GREEK SMALL LETTER CHI |
\u03C8 | ψ | GREEK SMALL LETTER PSI |
\u03C9 | ω | GREEK SMALL LETTER OMEGA |
Greek upper case letters
unicode | character | description |
---|---|---|
\u0391 | Α | GREEK CAPITAL LETTER ALPHA |
\u0392 | Β | GREEK CAPITAL LETTER BETA |
\u0393 | Γ | GREEK CAPITAL LETTER GAMMA |
\u0394 | Δ | GREEK CAPITAL LETTER DELTA |
\u0395 | Ε | GREEK CAPITAL LETTER EPSILON |
\u0396 | Ζ | GREEK CAPITAL LETTER ZETA |
\u0397 | Η | GREEK CAPITAL LETTER ETA |
\u0398 | Θ | GREEK CAPITAL LETTER THETA |
\u0399 | Ι | GREEK CAPITAL LETTER IOTA |
\u039A | Κ | GREEK CAPITAL LETTER KAPPA |
\u039B | Λ | GREEK CAPITAL LETTER LAMDA |
\u039C | Μ | GREEK CAPITAL LETTER MU |
\u039D | Ν | GREEK CAPITAL LETTER NU |
\u039E | Ξ | GREEK CAPITAL LETTER XI |
\u039F | Ο | GREEK CAPITAL LETTER OMICRON |
\u03A0 | Π | GREEK CAPITAL LETTER PI |
\u03A1 | Ρ | GREEK CAPITAL LETTER RHO |
\u03A3 | Σ | GREEK CAPITAL LETTER SIGMA |
\u03A4 | Τ | GREEK CAPITAL LETTER TAU |
\u03A5 | Υ | GREEK CAPITAL LETTER UPSILON |
\u03A6 | Φ | GREEK CAPITAL LETTER PHI |
\u03A7 | Χ | GREEK CAPITAL LETTER CHI |
\u03A8 | Ψ | GREEK CAPITAL LETTER PSI |
\u03A9 | Ω | GREEK CAPITAL LETTER OMEGA |
\u03F4 | ϴ | GREEK CAPITAL THETA SYMBOL |
Related Posts:
About Peter Kazarinoff
I teach engineering at a community college in the Pacific Northwest. I am interested in programming and how to help students. Here I mostly blog about Python, and how programing can be incorporated into engineering education.
Recent Posts
Greek Alphabet in a Jupyter Notebook
I often want to use characters from the Greek Alphabet in a Jupyter Notebook, and I’m hoping you do too if you’ve stumbled upon this post.
I often find myself wanting to use a Greek Alphabet character when I’m putting together an article or within a Jupyter notebook. But as I don’t use them too often at the moment I often forget how to.
As a result, I will spend several minutes digging around on the internet for how a particular character is typed in a Jupyter notebook. So, I decided today that I was going to write this down here so I could reference this next time, and hopefully it helps others as well.
Tab completion in a Jupyter notebook
In case you didn’t know Jupyter notebooks have special tab completions for a whole lot of special characters. To use them you simply type \Alpha then hit tab and there you have an \alpha character.
This is pretty simple, and not only does it work in markdown cells but it also works within code cells as well.
The complete Greek alphabet can be seen here, along with a little history about it.
Greek Alphabet Cheat Sheet
\Alpha Α \Beta Β \Gamma Γ \Delta Δ \Epsilon Ε \Zeta Ζ \Eta Η \Theta Θ \Iota Ι \Kappa Κ \Lambda Λ \Xi Ξ \Pi Π \Rho Ρ \Sigma Σ \Tau Τ \Upsilon Υ \Phi Φ \Chi Χ \Psi Ψ \Omega Ω \alpha α \beta β \gamma γ \delta δ \zeta ζ \eta η \theta θ \iota ι \kappa κ \lambda λ \mu μ \nu ν \xi ξ \pi π \rho ρ \varsigma ς \sigma σ \tau τ \upsilon υ \varphi φ \chi χ \psi ψ \omega ω \vartheta ϑ \phi ϕ \varpi ϖ \Stigma Ϛ \Digamma Ϝ \digamma ϝ \Koppa Ϟ \Sampi Ϡ \varkappa ϰ \varrho ϱ \textTheta ϴ \epsilon ϵ
There are currently 1283 latex symbols that are usable in a Jupyter notebook, I don’t think I will ever get around to using them all but in the event I want find a specific one I now have a source of truth.
Hopefully this post comes in handy to others that are looking to use the Greek Alphabet in a Jupyter Notebook. I often need to use this alphabet when I’m trying to writing machine learning content and I want to use the the actual mathematical equation.
For some examples take a look at my Perceptron or Nearest Neighbors posts with more to come soon!
beniwohli / greek_alphabet.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters. Learn more about bidirectional Unicode characters
greek_alphabet = |
u’ \u0391 ‘ : ‘Alpha’ , |
u’ \u0392 ‘ : ‘Beta’ , |
u’ \u0393 ‘ : ‘Gamma’ , |
u’ \u0394 ‘ : ‘Delta’ , |
u’ \u0395 ‘ : ‘Epsilon’ , |
u’ \u0396 ‘ : ‘Zeta’ , |
u’ \u0397 ‘ : ‘Eta’ , |
u’ \u0398 ‘ : ‘Theta’ , |
u’ \u0399 ‘ : ‘Iota’ , |
u’ \u039A ‘ : ‘Kappa’ , |
u’ \u039B ‘ : ‘Lamda’ , |
u’ \u039C ‘ : ‘Mu’ , |
u’ \u039D ‘ : ‘Nu’ , |
u’ \u039E ‘ : ‘Xi’ , |
u’ \u039F ‘ : ‘Omicron’ , |
u’ \u03A0 ‘ : ‘Pi’ , |
u’ \u03A1 ‘ : ‘Rho’ , |
u’ \u03A3 ‘ : ‘Sigma’ , |
u’ \u03A4 ‘ : ‘Tau’ , |
u’ \u03A5 ‘ : ‘Upsilon’ , |
u’ \u03A6 ‘ : ‘Phi’ , |
u’ \u03A7 ‘ : ‘Chi’ , |
u’ \u03A8 ‘ : ‘Psi’ , |
u’ \u03A9 ‘ : ‘Omega’ , |
u’ \u03B1 ‘ : ‘alpha’ , |
u’ \u03B2 ‘ : ‘beta’ , |
u’ \u03B3 ‘ : ‘gamma’ , |
u’ \u03B4 ‘ : ‘delta’ , |
u’ \u03B5 ‘ : ‘epsilon’ , |
u’ \u03B6 ‘ : ‘zeta’ , |
u’ \u03B7 ‘ : ‘eta’ , |
u’ \u03B8 ‘ : ‘theta’ , |
u’ \u03B9 ‘ : ‘iota’ , |
u’ \u03BA ‘ : ‘kappa’ , |
u’ \u03BB ‘ : ‘lamda’ , |
u’ \u03BC ‘ : ‘mu’ , |
u’ \u03BD ‘ : ‘nu’ , |
u’ \u03BE ‘ : ‘xi’ , |
u’ \u03BF ‘ : ‘omicron’ , |
u’ \u03C0 ‘ : ‘pi’ , |
u’ \u03C1 ‘ : ‘rho’ , |
u’ \u03C3 ‘ : ‘sigma’ , |
u’ \u03C4 ‘ : ‘tau’ , |
u’ \u03C5 ‘ : ‘upsilon’ , |
u’ \u03C6 ‘ : ‘phi’ , |
u’ \u03C7 ‘ : ‘chi’ , |
u’ \u03C8 ‘ : ‘psi’ , |
u’ \u03C9 ‘ : ‘omega’ , |
> |
Saved searches
Use saved searches to filter your results more quickly
You signed in with another tab or window. Reload to refresh your session. You signed out in another tab or window. Reload to refresh your session. You switched accounts on another tab or window. Reload to refresh your session.
Python module that provides the Greek Alphabet
License
EZSNoVa/greek-alphabet
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
Sign In Required
Please sign in to use Codespaces.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching GitHub Desktop
If nothing happens, download GitHub Desktop and try again.
Launching Xcode
If nothing happens, download Xcode and try again.
Launching Visual Studio Code
Your codespace will open once ready.
There was a problem preparing your codespace, please try again.
Latest commit
Git stats
Files
Failed to load latest commit information.
README.md
A Python module for working with the Greek alphabet.
pip install greek_alphabet
from greek_alphabet import Alphabet
Getting a list of all Greek alphabet characters
alphabet_list = Alphabet.get_list()
Getting a dictionary of all Greek alphabet characters
alphabet_dict = greek_alphabet.Alphabet.get_dict()
The get_dict() method takes two optional parameters:
- key : a function that takes an AlphabetChar object and returns a string to use as the dictionary key. By default, the Greek name of the character is used.
- value : a function that takes an AlphabetChar object and returns the value to use in the dictionary. By default, the AlphabetChar object is used.
Converting between upper and lower case
# Convert a lower case letter to upper case upper_case_char = greek_alphabet.Alphabet.upper('a') # Convert an upper case letter to lower case lower_case_char = greek_alphabet.Alphabet.lower('Γ')
The AlphabetChar class represents a single character of the Greek alphabet. It has the following attributes:
- char : the character itself
- capitalized : the capitalized version of the character
- name : the name of the character in Greek
- lower : the lower case equivalent of the character
This module is released under the MIT License. See LICENSE for more information.
About
Python module that provides the Greek Alphabet