-
-
Save smichr/777479 to your computer and use it in GitHub Desktop.
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
"""Return a sympy object representing the absolute value of the argument. | |
This is an extension of the built-in function abs() to accept symbolic | |
values. If you pass a SymPy expression to the built-in abs(), it will | |
pass it automatically to Abs(). | |
Examples:: | |
>>> from sympy import Abs, Symbol, S | |
>>> x = Symbol('x', real=True) | |
>>> Abs(-x) | |
Abs(x) | |
>>> Abs(x**2) | |
x**2 | |
>>> Abs(-1) | |
1 | |
>>> type(_) | |
<class 'sympy.core.numbers.One'> | |
The Python built-in will return either an Expr or int depending | |
on the type of argument:: | |
>>> type(abs(1)) # arg is int | |
<type 'int'> | |
>>> abs(-x) # arg is a sympy exprssion | |
Abs(x) | |
""" |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment