vectors_in_intervals.utility

Utility functions

Functions

solve_left_for_roots(A, b)

Find a solution for x*A = b that works for matrices with roots.

solve_without_division(A, b)

Solve a linear system of equations without division.

Classes

CombinationsIncluding(mset, k[, elements])

Combinatorial object of all combinations that include given elements

class vectors_in_intervals.utility.CombinationsIncluding(mset, k, elements=None)

Combinatorial object of all combinations that include given elements

EXAMPLES:

We generate all subsets of range(4) with 2 elements that include the element 2:

sage: from vectors_in_intervals.utility import CombinationsIncluding
sage: C = CombinationsIncluding(4, 2, [2])
sage: list(C)
[[0, 2], [1, 2], [2, 3]]
sage: list(reversed(C))
[[2, 3], [1, 2], [0, 2]]
vectors_in_intervals.utility.solve_left_for_roots(A, b)

Find a solution for x*A = b that works for matrices with roots.

INPUT:

  • A – a matrix

  • b – a vector

NOTE:

The built in method ``solve_left`` for matrices fails occasionally.
vectors_in_intervals.utility.solve_without_division(A, b)

Solve a linear system of equations without division.

The system is A x = c b where c is a positive constant. Uses an elementary vector.

EXAMPLES:

sage: from vectors_in_intervals.utility import solve_without_division
sage: A = matrix([[1, 2], [0, 1], [1, -1]])
sage: b = vector([1, 0, 1])
sage: solve_without_division(A, b)
(1, 0)
sage: A = matrix([[1, 4], [0, 2], [1, -2]])
sage: b = vector([6, 2, 0])
sage: solve_without_division(A, b)
(4, 2)
sage: A.solve_right(b)
(2, 1)
sage: A = matrix([[1, 1, 1], [0, 1, 2]])
sage: b = vector([2, 3])
sage: solve_without_division(A, b)
(0, 1, 1)