Title: Theory / Important / CS / Programming / Python / SciPy / SymPy
Tags: hasNotNewEffectReturnsMeaning FromInstruction computer_to_instruction some_instruction algorithmWithCardNameButNoFieldName2 fromAlgorithm

Name: A symbol
Definition: A basic element of SymPy, composed of a string of characters
Page: http://docs.sympy.org/latest/tutorial/gotchas.html

Page: http://docs.sympy.org/latest/tutorial/gotchas.html
Implementation: simplify(expr_1-expr_2)==0
Effect: Test whether expr_1 is equal to expr_2
Variables: expr_i: expressions
Language: Python
Context: scipy

Instruction: symbols("x_1_ ..._ x_n")
Page: http://docs.sympy.org/latest/tutorial/gotchas.html
Language: Python
Context: SciPy
Returns: A set of variables whose symbol's are x_i
Variables: x_1,... ,x_n some symbol

Instruction: expr.subs(bar,foo)
Page: http://docs.sympy.org/latest/tutorial/gotchas.html
Effect: Replace bar by foo in expr
Language: Python
Variables: expr: an expression

Instruction: simplify(expr)
Page: http://docs.sympy.org/latest/tutorial/gotchas.html
Language: Python
Returns: An equivalent simpler form to expr
Variables: expr: an expression

Instruction: Rational(a,b)
Page: http://docs.sympy.org/latest/tutorial/gotchas.html
Effect: The rational a/b
Language: Python

Instruction: e1 == e2
Page: https://docs.sympy.org/latest/tutorial/gotchas.html
Language: python
Context: sympy
Returns: Whether e1 syntactically equals e2
Variables: e1, e2: Sympy expression

Instruction: Eq(e1, e2)
Page: https://docs.sympy.org/latest/tutorial/gotchas.html
Language: python
Context: sympy
Returns: The symbolic equality of e1 and e2
Variables: e1, e2: Sympy expression

Page: https://docs.sympy.org/latest/tutorial/gotchas.html
Implementation: simplify(e1 - e2) == 0
Variables: e1, e2: Sympy expression
Language: python
Returns: e1 == e2
Context: sympy
Assuming: e1, e2 simple enough for `simplify` to work

Instruction: Integer(n)
Page: https://docs.sympy.org/latest/tutorial/gotchas.html
Language: python
Context: sympy
Returns: Symbolic representation of the integer n
Variables: n: int

Instruction: Rational(n, m)
Page: https://docs.sympy.org/latest/tutorial/gotchas.html
Language: python
Context: sympy
Returns: The symbolic rational with numerator n and denominator m
Variables: n, m: int

Instruction: expr.subs(sub_expr, sub_expr')
Page: https://docs.sympy.org/latest/tutorial/basic_operations.html
Language: python
Context: sympy
Returns: expr, where each occurence of sub_expr is replaced by sub_expr'
Variables: expr, sub_expr, sub_expr': Sympy Expression,

Question: Are sympy expression mutable?
Answer: No
Page: https://docs.sympy.org/latest/tutorial/basic_operations.html
Context: sympy

Instruction: expr.subs([(sub_expr_0, sub_expr_*'), ..., (sub_expr_n, sub_expr_n')])
Page: https://docs.sympy.org/latest/tutorial/basic_operations.html
Language: python
Context: sympy
Returns: expr, where each occurence of sub_expr_i is replaced by sub_expr_i'
Variables: expr, (sub_expr_i, sub_expr')_i: Sympy Expression,

Instruction: simpify(string)
Page: https://docs.sympy.org/latest/tutorial/basic_operations.html
Language: python
Context: sympy
Returns: The symbolic expression represented by string

Instruction: expr.evalf()
Page: https://docs.sympy.org/latest/tutorial/basic_operations.html
Language: python
Context: sympy
Returns: A float approximating expr
Variables: expr: a symbolic expression

Instruction: expr.evalf(n)
Page: https://docs.sympy.org/latest/tutorial/basic_operations.html
Language: python
Context: sympy
Returns: A float with n digit approximating expr's value
Variables: expr: a symbolic expression

Instruction: expr.evalf(subs={var_1: value_1, ..., var_n: value_n})
Page: https://docs.sympy.org/latest/tutorial/basic_operations.html
Language: python
Context: sympy
Returns: A float approximating expr where var_i has value val_i
Variables: expr: a symbolic expression

Instruction: expr.evalf(args, chop=True)
Page: https://docs.sympy.org/latest/tutorial/basic_operations.html
Language: python
Context: sympy
Returns: Same as expr.evalf(args), and cut of what seems like to be a rounding error due to float
Variables: expr: a symbolic expression

Instruction: lambdify(x, expr, library)
Page: https://docs.sympy.org/latest/tutorial/basic_operations.html
Language: python
Context: sympy
Returns: A function expr(x) using library
Variables: expr: a symbolic expression
Extra: libraryName may be numpy, math, or a dictionnary from function name to implementation

Instruction: init_session()
Page: https://docs.sympy.org/latest/tutorial/printing.html
Effect: Ensure to use the best pretty printer available
Language: python
Context: sympy

Instruction: str(expr)
Page: https://docs.sympy.org/latest/tutorial/printing.html
Language: python
Context: sympy
Returns: A python expression returning expr
Variables: expr : a symbolic expression

Instruction: srepr(expr)
Page: https://docs.sympy.org/latest/tutorial/printing.html
Language: python
Context: sympy
Returns: A string describing the internal representation of this expression
Variables: expr : a symbolic expression
Extra: e.g. sqrt becomes "power 1/2"

Instruction: pprint(expr, use_unicode=True)
Page: https://docs.sympy.org/latest/tutorial/printing.html
Language: python
Context: sympy
Returns: A unicode representation of the current expression, as nice as possible
Variables: expr : a symbolic expression

Instruction: pprint(expr, use_unicode=False)
Page: https://docs.sympy.org/latest/tutorial/printing.html
Language: python
Context: sympy
Returns: An ascii image representing current expression
Variables: expr : a symbolic expression

Instruction: latex(expr)
Page: https://docs.sympy.org/latest/tutorial/printing.html
Language: python
Context: sympy
Returns: Latex expression representing current expression
Variables: expr : a symbolic expression

Instruction: mathml(expr)
Page: https://docs.sympy.org/latest/tutorial/printing.html
Language: python
Context: sympy
Returns: A mathml string representing current expression
Variables: expr : a symbolic expression

Instruction: dotprint(expr)
Page: https://docs.sympy.org/latest/tutorial/printing.html
Language: python
Context: sympy
Returns: A graphviz value representing current expression
Variables: expr : a symbolic expression

Instruction: expand(polynomial)
Page: https://docs.sympy.org/latest/tutorial/simplification.html
Language: python
Context: sympy
Returns: A sum of monomial equal to polynomial
Variables: polynomial

Instruction: factor(polynomial)
Page: https://docs.sympy.org/latest/tutorial/simplification.html
Language: python
Context: sympy
Returns: An irreducible factorization over the rational numbers
Variables: polynomial

Instruction: factor_list(multivariable_polynomial)
Page: https://docs.sympy.org/latest/tutorial/simplification.html
Language: python
Context: sympy
Returns: Pair with leading coefficient and irreducible factorization over rationals
Variables: multivariable_polynomial

Instruction: collect(multivariable_polynomial, x)
Page: https://docs.sympy.org/latest/tutorial/simplification.html
Language: python
Context: sympy
Returns: expr as a polynomial in x
Variables: multivariable_polynomial

Instruction: cancel(rational_polynomial)
Page: https://docs.sympy.org/latest/tutorial/simplification.html
Language: python
Context: sympy
Returns: expression equal to rational_polynomial as a leading_coefficient * numerator / denominator
Variables: rational_polynomial

Instruction: apart(rational_polynomial)
Page: https://docs.sympy.org/latest/tutorial/simplification.html
Language: python
Context: sympy
Returns: A partial fraction decomposition equal to rational_polynomial
Variables: rational_polynomial

Instruction: trigsymp(trigonometric_polynomial)
Page: https://docs.sympy.org/latest/tutorial/simplification.html
Language: python
Context: sympy
Returns: A simplification of trigonometric_polynomial related to its trigonometric part
Variables: rational_polynomial

Instruction: expand_trig(trigonometric_polynomial)
Page: https://docs.sympy.org/latest/tutorial/simplification.html
Language: python
Context: sympy
Returns: A trigonometric expression with simpler term in the variables
Variables: rational_polynomial

Question: What is the default type of sympy symbol
Answer: complex number
Page: https://docs.sympy.org/latest/tutorial/simplification.html
Variables: rational_polynomial
Context: sympy

Question: todo
Answer: simplification starting at powsimp
Page: https://docs.sympy.org/latest/tutorial/simplification.html
Variables: rational_polynomial
Context: sympy

Instruction: diff/Derivative(expr, var[, n], *args)
Page: https://docs.sympy.org/latest/tutorial/calculus.html
Language: python
Context: sympy
Returns: diff/Derivative(diff/Derivative(expr, var[, n]), *args)
Variables: expr a symbolic expression
var a variable
n: int

Instruction: diff(expr, var)
expr.diff(var)
Page: https://docs.sympy.org/latest/tutorial/calculus.html
Language: python
Context: sympy
Returns: Differentiating expr along var
Variables: expr a symbolic expression
var a variable

Instruction: diff/Derivative(expr, var, n)
Page: https://docs.sympy.org/latest/tutorial/calculus.html
Language: python
Context: sympy
Returns: diff/Derivative(diff/Derivative(expr, var), n-1)
Variables: expr a symbolic expression
var a variable
n: int

Instruction: Derivating(expr, var)
Page: https://docs.sympy.org/latest/tutorial/calculus.html
Language: python
Context: sympy
Returns: The symbolic derivative of expr by var
Variables: expr a symbolic expression
var a variable

Instruction: Expr.doit()
Page: https://docs.sympy.org/latest/tutorial/calculus.html
Language: python
Context: sympy
Returns: The result of the expression
Variables: Expr an expression representing a computation that can be done

Instruction: integrate(expr, var)
Page: https://docs.sympy.org/latest/tutorial/calculus.html
Language: python
Context: sympy
Returns: The indefinite integrate of expr according to var
Variables: expr a symbolic expression
var a variable

Instruction: integrate(expr, (var, low, high))
Page: https://docs.sympy.org/latest/tutorial/calculus.html
Language: python
Context: sympy
Returns: The integrate of expr according to var between low and high
Variables: expr a symbolic expression
var a variable

Instruction: oo
Page: https://docs.sympy.org/latest/tutorial/calculus.html
Language: python
Context: sympy
Returns: infinite

Instruction: integrate(expr, arg_1, ..., arg_n)
Page: https://docs.sympy.org/latest/tutorial/calculus.html
Language: python
Context: sympy
Returns: integrate(...(integrate(expr, arg1), ...), arg_n)
Variables: expr a symbolic expression
var a variable

Instruction: Integral(expr, arg)
Page: https://docs.sympy.org/latest/tutorial/calculus.html
Language: python
Context: sympy
Returns: The symbolic expression representing `integrate(expr, arg)`
Variables: expr a symbolic expression

Instruction: Limit(args)
Page: https://docs.sympy.org/latest/tutorial/calculus.html
Language: python
Context: sympy
Returns: The symbolic expression representing limit(args)
Variables: expr a symbolic expression

Instruction: limit(expr, var, value)
Page: https://docs.sympy.org/latest/tutorial/calculus.html
Language: python
Context: sympy
Returns: The limit of expr when var tends to value
Variables: expr a symbolic expression

Instruction: limit(expr, var, value, '+')
Page: https://docs.sympy.org/latest/tutorial/calculus.html
Language: python
Context: sympy
Returns: The limit of expr when var tends to value from above
Variables: expr a symbolic expression

Instruction: limit(expr, var, value, '-')
Page: https://docs.sympy.org/latest/tutorial/calculus.html
Language: python
Context: sympy
Returns: The limit of expr when var tends to value from below
Variables: expr a symbolic expression

Instruction: expr.series(var, x0=0, n=6)
Page: https://docs.sympy.org/latest/tutorial/calculus.html
Language: python
Context: sympy
Returns: The asymptotic series expensions of expr around x0 up to n terms
Variables: expr a symbolic expression

Instruction: expr.removeO()
Page: https://docs.sympy.org/latest/tutorial/calculus.html
Language: python
Context: sympy
Returns: The expression without its O() part
Variables: expr a symbolic expression

Instruction: differentiate_finite(expr)
Page: https://docs.sympy.org/latest/tutorial/calculus.html
Language: python
Context: sympy
Returns: Approximation of expr's derivative using finite difference and step 1
Variables: expr a symbolic expression

Instruction: differentiate_finite(expr, h)
Page: https://docs.sympy.org/latest/tutorial/calculus.html
Language: python
Context: sympy
Returns: Approximation of expr's derivative using finite difference and step h
Variables: expr a symbolic expression

Instruction: todo: as_finite_difference([-3*h,-h,2*h]) and finite_diff_weights
Page: https://docs.sympy.org/latest/tutorial/calculus.html
Language: python
Context: sympy
Variables: expr a symbolic expression

Instruction: Eq(expr)
Page: https://docs.sympy.org/latest/tutorial/solvers.html
Language: python
Context: sympy
Returns: Eq(expr, 0)
Variables: expr a symbolic expression

Instruction: solveset(expr, var)
Page: https://docs.sympy.org/latest/tutorial/solvers.html
Language: python
Context: sympy
Returns: solveset(Eq(expr), var)
Variables: expr a symbolic expression

Instruction: solveset(eq, var, domain=S.Complexes)
Page: https://docs.sympy.org/latest/tutorial/solvers.html
Language: python
Context: sympy
Returns: The set of solution in domain of eq for var.
Variables: eq an equation
var a variable

Instruction: linsolve([linear_eq_1, ..., linear_eq_n], (var_1, ..., var_m))
Page: https://docs.sympy.org/latest/tutorial/solvers.html
Language: python
Context: sympy
Returns: The set of solutions to (linear_eq_i = 0)_i

Instruction: Todo
Page: https://docs.sympy.org/latest/tutorial/solvers.html
Effect: linsolve for matrix
Language: python
Context: sympy

Instruction: nonlinsolve([eq_1, ..., eq_n], (var_1, ..., var_m))
Page: https://docs.sympy.org/latest/tutorial/solvers.html
Language: python
Context: sympy
Returns: The set of solutions to (eq_i = 0)_i

Instruction: roots(polynome, var)
Page: https://docs.sympy.org/latest/tutorial/solvers.html
Language: python
Context: sympy
Returns: Dictionnary mapping roots of polynome to its multiplicity

Instruction: dsolve(eq, f(x))
Page: https://docs.sympy.org/latest/tutorial/solvers.html
Language: python
Context: sympy
Returns: Set of solutions of the differential equation eq in f(x)

Instruction: Matrix([v_1, ..., v_n])
Page: https://docs.sympy.org/latest/tutorial/matrices.html
Language: python
Context: sympy
Returns: The matrix whose lines are v_1, ..., v_n
Variables: v_1, ..., v_n, values or list of values

Instruction: ImmutableMatrix(arg)
Page: https://docs.sympy.org/latest/tutorial/matrices.html
Language: python
Context: sympy
Returns: same as Matrix(arg) but immutable
Variables: v_1, ..., v_n, values or list of values

Instruction: shape(matrix)
Page: https://docs.sympy.org/latest/tutorial/matrices.html
Language: python
Context: sympy
Returns: (number_of_line, number_of_column) of the matrix
Variables: Matrix

Instruction: matrix.col_del(i)
Page: https://docs.sympy.org/latest/tutorial/matrices.html
Effect: Delete the i-th column of the matrix
Language: python
Context: sympy
Variables: Matrix

Instruction: matrix.row_del(i)
Page: https://docs.sympy.org/latest/tutorial/matrices.html
Effect: Delete the i-th row of the matrix
Language: python
Context: sympy
Variables: Matrix

Instruction: matrix.row_insert(i, matrix')
Page: https://docs.sympy.org/latest/tutorial/matrices.html
Effect: Insert matrix at i-th row
Language: python
Context: sympy
Variables: Matrix

Instruction: matrix.column_insert(i, matrix')
Page: https://docs.sympy.org/latest/tutorial/matrices.html
Effect: Insert matrix at i-th column
Language: python
Context: sympy
Variables: Matrix

Instruction: matrix.T
Page: https://docs.sympy.org/latest/tutorial/matrices.html
Language: python
Context: sympy
Returns: The transpose of matrix
Variables: Matrix

Instruction: eye(n)
Page: https://docs.sympy.org/latest/tutorial/matrices.html
Language: python
Context: sympy
Returns: The identity matrix of size n
Variables: Matrix

Instruction: zeros(nb_line, nb_col)
Page: https://docs.sympy.org/latest/tutorial/matrices.html
Language: python
Context: sympy
Returns: The 0 matrix with nb_line and nb_col
Variables: Matrix

Instruction: ones(nb_line, nb_col)
Page: https://docs.sympy.org/latest/tutorial/matrices.html
Language: python
Context: sympy
Returns: The 1 matrix with nb_line and nb_col
Variables: Matrix

Instruction: diag(matrix_1, ..., matrix_n)
Page: https://docs.sympy.org/latest/tutorial/matrices.html
Language: python
Context: sympy
Returns: A matrix with diagonaly matrix_1, ..., matrix_n, and zero everywhere else
Variables: Matrix

Instruction: matrix.det()
Page: https://docs.sympy.org/latest/tutorial/matrices.html
Language: python
Context: sympy
Returns: The determinant of matrix
Variables: Matrix

Instruction: matrix.rref()
Page: https://docs.sympy.org/latest/tutorial/matrices.html
Language: python
Context: sympy
Returns: Matrix, but in reduced row echelon, and the tuple of indices of the pivot columns
Variables: Matrix

Instruction: matrix.nullspace()
Page: https://docs.sympy.org/latest/tutorial/matrices.html
Language: python
Context: sympy
Returns: A list of column vectors that span the nullpsace of matrix
Variables: Matrix

Instruction: matrix.colmunspace()
Page: https://docs.sympy.org/latest/tutorial/matrices.html
Language: python
Context: sympy
Returns: A list of column vectors that span the columnspace of matrix
Variables: Matrix

Instruction: matrix.eigenvals()
Page: https://docs.sympy.org/latest/tutorial/matrices.html
Language: python
Context: sympy
Returns: A dictionnary from eigenvalues of matrix to their multiplicity
Variables: Matrix

Instruction: matrix.eigenvects()
Page: https://docs.sympy.org/latest/tutorial/matrices.html
Language: python
Context: sympy
Returns: A list of tuples (eigenvalue, algebraic_multiplicity, [eigenvectors])
Variables: Matrix

Instruction: matrix.diagonalize()
Page: https://docs.sympy.org/latest/tutorial/matrices.html
Language: python
Context: sympy
Returns: A pair P, D, such that matrix = PDP^-1
Variables: Matrix

Instruction: matrix.charpoly()
Page: https://docs.sympy.org/latest/tutorial/matrices.html
Language: python
Context: sympy
Returns: The characteristic polynomial of matrix
Variables: Matrix

Instruction: Symbol(x)
Page: https://docs.sympy.org/latest/tutorial/matrices.html
Language: python
Context: sympy
Returns: The symbol x
Variables: Matrix

Instruction: expr.func
Page: https://docs.sympy.org/latest/tutorial/manipulation.html
Language: python
Context: sympy
Returns: The symbol at the head of the expr
Variables: expr

Instruction: expr.args
Page: https://docs.sympy.org/latest/tutorial/manipulation.html
Language: python
Context: sympy
Returns: The symbols to which expr.func are applied to
Variables: expr

Question: Key invariant of expressions in scipy
Answer: Either expr.args == () or expr == expr.func(*expr.args)
Page: https://docs.sympy.org/latest/tutorial/manipulation.html
Chapter: The symbols to which expr.func are applied to
Variables: expr
Context: sympy

Instruction: evaluate=False
Page: https://docs.sympy.org/latest/tutorial/manipulation.html
Effect: Don't apply any simplification to the expression generated
Language: python
Context: scipy, function call arguments
Name: Key invariant of expressions in scipy

Instruction: Unevaluated(expr)
Page: https://docs.sympy.org/latest/tutorial/manipulation.html
Language: python
Context: scipy, function call arguments
Returns: Same as expr but will never be used in any simplification
Name: Key invariant of expressions in scipy