Sparse vectors over the symbolic ring

Implements vectors over the symbolic ring.

AUTHORS:

  • Robert Bradshaw (2011-05-25): Added more element-wise simplification methods

  • Joris Vankerschaver (2011-05-15): Initial version

  • Dima Pasechnik (2023-06-04): cloning from the dense case

EXAMPLES:

sage: x, y = var('x, y')
sage: u = vector([sin(x)^2 + cos(x)^2, log(2*y) + log(3*y)], sparse=True); u
(cos(x)^2 + sin(x)^2, log(3*y) + log(2*y))
sage: type(u)
<class 'sage.modules.free_module.FreeModule_ambient_field_with_category.element_class'>
sage: u.simplify_full()
(1, log(3*y) + log(2*y))
>>> from sage.all import *
>>> x, y = var('x, y')
>>> u = vector([sin(x)**Integer(2) + cos(x)**Integer(2), log(Integer(2)*y) + log(Integer(3)*y)], sparse=True); u
(cos(x)^2 + sin(x)^2, log(3*y) + log(2*y))
>>> type(u)
<class 'sage.modules.free_module.FreeModule_ambient_field_with_category.element_class'>
>>> u.simplify_full()
(1, log(3*y) + log(2*y))
class sage.modules.vector_symbolic_sparse.Vector_symbolic_sparse[source]

Bases: FreeModuleElement_generic_sparse

canonicalize_radical(*args, **kwds)[source]

alias of apply().

simplify(*args, **kwds)[source]

alias of apply().

simplify_factorial(*args, **kwds)[source]

alias of apply().

simplify_full(*args, **kwds)[source]

alias of apply().

simplify_log(*args, **kwds)[source]

alias of apply().

simplify_rational(*args, **kwds)[source]

alias of apply().

simplify_trig(*args, **kwds)[source]

alias of apply().

trig_expand(*args, **kwds)[source]

alias of apply().

trig_reduce(*args, **kwds)[source]

alias of apply().

sage.modules.vector_symbolic_sparse.apply_map(phi)[source]

Return a function that applies phi to its argument.

EXAMPLES:

sage: from sage.modules.vector_symbolic_sparse import apply_map
sage: v = vector([1,2,3], sparse=True)
sage: f = apply_map(lambda x: x+1)
sage: f(v)
(2, 3, 4)
>>> from sage.all import *
>>> from sage.modules.vector_symbolic_sparse import apply_map
>>> v = vector([Integer(1),Integer(2),Integer(3)], sparse=True)
>>> f = apply_map(lambda x: x+Integer(1))
>>> f(v)
(2, 3, 4)