I am trying to achieve a symbol for the Greek letter nu followed by a prime superscript. This can be achieved easily using LaTeX:
$\nu'$
I tried many variants in SymPy, none of which gave me the right symbol:
nuprime = symbols('{\nu}\'')
nuprime = symbols('{nu}{\'}')
nuprime = symbols('nu\'')
nuprime = symbols('$nu\'$')
To mention a few. How do I get the symbol I am looking for on SymPy?
EDIT
I am using jupyter qtconsole
with latex printing. I wish to create the nu prime symbol in this environment.
You can do this using the word prime
in the symbol definition (in the string, not the variable name). Using Python 2 in Jupyter Notebook,
from sympy import init_printing,latex,symbols
import numpy as np
init_printing()
nuprime = symbols('nuprime')
display(nuprime)
print(latex(nuprime))
displays
If your want it bold, you can display this by also including the word bold in the symbol definition
nuprime = symbols("nuprimebold")
And if you need a subscript, you can use an underscore to indicate the beginning of the subscript
nuprime_subscript = symbols("nuprime_subscript")
These postfixes can be combined as needed.
Other accents can also be used. The ones I am aware of in addition to prime
are hat
, check
, tilde
, acute
, grave
, dot
, ddot
, breve
, bar
, and vec
, but I can't find an official source for this, so this may not be comprehensive. Here is the definition, display, and latex print for Jupyter Notebook with these accents.
nuhat,nucheck,nutilde,nuacute,nugrave,nudot,nuddot,nubreve,nubar,nuvec = symbols("nuhat,nucheck,nutilde,nuacute,nugrave,nudot,nuddot,nubreve,nubar,nuvec")
This technique can be used to modify the display and latex output for any uppercase or lowercase letter of the English or Greek alphabet.
I am not exactly sure in what context you want the symbol to be represented as ν', but for SymPy’s standard display the following works fine:
nuprime = sympy.symbols("ν'")
This makes use of the following:
I have had some success with the following, though I am not completely sure that I am exactly replicating your circumstances: 1) I opened Jupyter QtConsole 2) I inputted the following code:
import sympy as sp
sp.init_printing(use_latex=True)
nuprime = sp.symbols("\\nu'")
nuprime
This produced the symbol I think you're looking for, at least on my QtConsole.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With