Printing (Docstrings)¶
init_vprinting¶
- 
sympy.physics.vector.printing.init_vprinting(**kwargs)[source]¶
- Initializes time derivative printing for all SymPy objects, i.e. any functions of time will be displayed in a more compact notation. The main benefit of this is for printing of time derivatives; instead of displaying as - Derivative(f(t),t), it will display- f'. This is only actually needed for when derivatives are present and are not in a physics.vector.Vector or physics.vector.Dyadic object. This function is a light wrapper to- init_printing(). Any keyword arguments for it are valid here.- Initializes pretty-printer depending on the environment. - Parameters
- pretty_print : boolean, default=True - If True, use pretty_print to stringify or the provided pretty printer; if False, use sstrrepr to stringify or the provided string printer. - order : string or None, default=’lex’ - There are a few different settings for this parameter: lex (default), which is lexographic order; grlex, which is graded lexographic order; grevlex, which is reversed graded lexographic order; old, which is used for compatibility reasons and for long expressions; None, which sets it to lex. - use_unicode : boolean or None, default=None - If True, use unicode characters; if False, do not use unicode characters; if None, make a guess based on the environment. - use_latex : string, boolean, or None, default=None - If True, use default LaTeX rendering in GUI interfaces (png and mathjax); if False, do not use LaTeX rendering; if None, make a guess based on the environment; if ‘png’, enable latex rendering with an external latex compiler, falling back to matplotlib if external compilation fails; if ‘matplotlib’, enable LaTeX rendering with matplotlib; if ‘mathjax’, enable LaTeX text generation, for example MathJax rendering in IPython notebook or text rendering in LaTeX documents; if ‘svg’, enable LaTeX rendering with an external latex compiler, no fallback - wrap_line : boolean - If True, lines will wrap at the end; if False, they will not wrap but continue as one line. This is only relevant if - pretty_printis True.- num_columns : int or None, default=None - If int, number of columns before wrapping is set to num_columns; if None, number of columns before wrapping is set to terminal width. This is only relevant if - pretty_printis True.- no_global : boolean, default=False - If True, the settings become system wide; if False, use just for this console/session. - ip : An interactive console - This can either be an instance of IPython, or a class that derives from code.InteractiveConsole. - euler : boolean, optional, default=False - Loads the euler package in the LaTeX preamble for handwritten style fonts (http://www.ctan.org/pkg/euler). - forecolor : string or None, optional, default=None - DVI setting for foreground color. None means that either ‘Black’, ‘White’, or ‘Gray’ will be selected based on a guess of the IPython terminal color setting. See notes. - backcolor : string, optional, default=’Transparent’ - DVI setting for background color. See notes. - fontsize : string, optional, default=’10pt’ - A font size to pass to the LaTeX documentclass function in the preamble. Note that the options are limited by the documentclass. Consider using scale instead. - latex_mode : string, optional, default=’plain’ - The mode used in the LaTeX printer. Can be one of: {‘inline’|’plain’|’equation’|’equation*’}. - print_builtin : boolean, optional, default=True - If - Truethen floats and integers will be printed. If- Falsethe printer will only print SymPy types.- str_printer : function, optional, default=None - A custom string printer function. This should mimic sympy.printing.sstrrepr(). - pretty_printer : function, optional, default=None - A custom pretty printer. This should mimic sympy.printing.pretty(). - latex_printer : function, optional, default=None - A custom LaTeX printer. This should mimic sympy.printing.latex(). - scale : float, optional, default=1.0 - Scale the LaTeX output when using the - pngor- svgbackends. Useful for high dpi screens.- settings : - Any additional settings for the - latexand- prettycommands can be used to fine-tune the output.
 - Examples - >>> from sympy import Function, symbols >>> from sympy.physics.vector import init_vprinting >>> t, x = symbols('t, x') >>> omega = Function('omega') >>> omega(x).diff() Derivative(omega(x), x) >>> omega(t).diff() Derivative(omega(t), t) - Now use the string printer: - >>> init_vprinting(pretty_print=False) >>> omega(x).diff() Derivative(omega(x), x) >>> omega(t).diff() omega' 
vprint¶
- 
sympy.physics.vector.printing.vprint(expr, **settings)[source]¶
- Function for printing of expressions generated in the sympy.physics vector package. - Extends SymPy’s StrPrinter, takes the same setting accepted by SymPy’s - sstr(), and is equivalent to- print(sstr(foo)).- Parameters
- expr : valid SymPy object - SymPy expression to print. - settings : args - Same as the settings accepted by SymPy’s sstr(). 
 - Examples - >>> from sympy.physics.vector import vprint, dynamicsymbols >>> u1 = dynamicsymbols('u1') >>> print(u1) u1(t) >>> vprint(u1) u1 
vpprint¶
- 
sympy.physics.vector.printing.vpprint(expr, **settings)[source]¶
- Function for pretty printing of expressions generated in the sympy.physics vector package. - Mainly used for expressions not inside a vector; the output of running scripts and generating equations of motion. Takes the same options as SymPy’s - pretty_print(); see that function for more information.- Parameters
- expr : valid SymPy object - SymPy expression to pretty print - settings : args - Same as those accepted by SymPy’s pretty_print. 
 
vlatex¶
- 
sympy.physics.vector.printing.vlatex(expr, **settings)[source]¶
- Function for printing latex representation of sympy.physics.vector objects. - For latex representation of Vectors, Dyadics, and dynamicsymbols. Takes the same options as SymPy’s - latex(); see that function for more information;- Parameters
- expr : valid SymPy object - SymPy expression to represent in LaTeX form - settings : args - Same as latex() 
 - Examples - >>> from sympy.physics.vector import vlatex, ReferenceFrame, dynamicsymbols >>> N = ReferenceFrame('N') >>> q1, q2 = dynamicsymbols('q1 q2') >>> q1d, q2d = dynamicsymbols('q1 q2', 1) >>> q1dd, q2dd = dynamicsymbols('q1 q2', 2) >>> vlatex(N.x + N.y) '\\mathbf{\\hat{n}_x} + \\mathbf{\\hat{n}_y}' >>> vlatex(q1 + q2) 'q_{1} + q_{2}' >>> vlatex(q1d) '\\dot{q}_{1}' >>> vlatex(q1 * q2d) 'q_{1} \\dot{q}_{2}' >>> vlatex(q1dd * q1 / q1d) '\\frac{q_{1} \\ddot{q}_{1}}{\\dot{q}_{1}}' 
