Did I find the right examples for you? yes no

All Samples(18)  |  Call(13)  |  Derive(0)  |  Import(5)
Represents a morphism which is a composition of other morphisms.

Two composite morphisms are equal if the morphisms they were
obtained from (components) are the same and were listed in the
same order.

The arguments to the constructor for this class should be listed
in diagram order: to obtain the composition `g\circ f` from the
instances of :class:`Morphism` ``g`` and ``f`` use
``CompositeMorphism(f, g)``.(more...)

src/s/y/sympy-HEAD/sympy/categories/diagram_drawing.py   sympy(Download)
 
from sympy.core import Basic, FiniteSet, Dict, Symbol
from sympy.categories import (CompositeMorphism, IdentityMorphism,
                              NamedMorphism, Diagram)
from sympy.utilities import default_sort_key

src/s/y/sympy-0.7.5/sympy/categories/diagram_drawing.py   sympy(Download)
 
from sympy.core import Basic, FiniteSet, Dict, Symbol
from sympy.categories import (CompositeMorphism, IdentityMorphism,
                              NamedMorphism, Diagram)
from sympy.utilities import default_sort_key

src/s/y/sympy-HEAD/sympy/categories/tests/test_baseclasses.py   sympy(Download)
from sympy.categories import (Object, Morphism, IdentityMorphism,
                              NamedMorphism, CompositeMorphism,
                              Diagram, Category)
from sympy.categories.baseclasses import Class
from sympy.utilities.pytest import XFAIL, raises
 
    # Test composite morphisms.
    assert f == CompositeMorphism(f)
 
    k = g.compose(f)
    assert k.domain == A
    assert k.codomain == C
    assert k.components == Tuple(f, g)
    assert g * f == k
    assert CompositeMorphism(f, g) == k
    assert CompositeMorphism(f, g) == k
 
    assert CompositeMorphism(g * f) == g * f
 
    # Test the associativity of composition.
    assert h * k == u
    assert p * f == u
    assert CompositeMorphism(f, g, h) == u
 
    # Test flattening.

src/s/y/sympy-0.7.5/sympy/categories/tests/test_baseclasses.py   sympy(Download)
from sympy.categories import (Object, Morphism, IdentityMorphism,
                              NamedMorphism, CompositeMorphism,
                              Diagram, Category)
from sympy.categories.baseclasses import Class
from sympy.utilities.pytest import XFAIL, raises
 
    # Test composite morphisms.
    assert f == CompositeMorphism(f)
 
    k = g.compose(f)
    assert k.domain == A
    assert k.codomain == C
    assert k.components == Tuple(f, g)
    assert g * f == k
    assert CompositeMorphism(f, g) == k
    assert CompositeMorphism(f, g) == k
 
    assert CompositeMorphism(g * f) == g * f
 
    # Test the associativity of composition.
    assert h * k == u
    assert p * f == u
    assert CompositeMorphism(f, g, h) == u
 
    # Test flattening.

src/s/y/sympy-HEAD/sympy/core/tests/test_args.py   sympy(Download)
def test_sympy__categories__baseclasses__CompositeMorphism():
    from sympy.categories import Object, NamedMorphism, CompositeMorphism
    A = Object("A")
    B = Object("B")
    C = Object("C")
    f = NamedMorphism(A, B, "f")
    g = NamedMorphism(B, C, "g")
    assert _test_args(CompositeMorphism(f, g))