2608 | | return -print_order_compare((<Expression>right)._gobj,left._gobj) |
2609 | | |
2610 | | cpdef int _cmp_add(left, CommutativeRingElement right) except -2: |
2611 | | return print_order(left._gobj,(<Expression>right)._gobj) |
2612 | | |
2613 | | cpdef int _cmp_mul(left, CommutativeRingElement right) except -2: |
2614 | | return print_order_mul(left._gobj,(<Expression>right)._gobj) |
| 2608 | """ |
| 2609 | Compare ``left`` and ``right``. |
| 2610 | |
| 2611 | INPUT: |
| 2612 | |
| 2613 | - ``right`` -- A :class:`Expression` instance. |
| 2614 | |
| 2615 | OUTPUT: |
| 2616 | |
| 2617 | Boolean. |
| 2618 | |
| 2619 | EXAMPLES:: |
| 2620 | |
| 2621 | sage: a = sqrt(3) |
| 2622 | sage: b = x^2+1 |
| 2623 | sage: a.__cmp__(b) # indirect doctest |
| 2624 | -1 |
| 2625 | """ |
| 2626 | return print_order_compare(left._gobj, (<Expression>right)._gobj) |
| 2627 | |
| 2628 | cpdef int _cmp_add(Expression left, Expression right) except -2: |
| 2629 | """ |
| 2630 | Compare ``left`` and ``right`` in the print order. |
| 2631 | |
| 2632 | INPUT: |
| 2633 | |
| 2634 | - ``right`` -- A :class:`Expression` instance. |
| 2635 | |
| 2636 | OUTPUT: |
| 2637 | |
| 2638 | Boolean. |
| 2639 | |
| 2640 | EXAMPLES:: |
| 2641 | |
| 2642 | sage: a = sqrt(3) |
| 2643 | sage: b = x^2+1 |
| 2644 | sage: a._cmp_add(b) |
| 2645 | -1 |
| 2646 | sage: b._cmp_add(a) |
| 2647 | 1 |
| 2648 | sage: b._cmp_add(1) |
| 2649 | Traceback (most recent call last): |
| 2650 | ... |
| 2651 | TypeError: Argument 'right' has incorrect type (expected |
| 2652 | sage.symbolic.expression.Expression, got sage.rings.integer.Integer) |
| 2653 | """ |
| 2654 | return print_order_compare(left._gobj, right._gobj) |
| 2655 | |
| 2656 | cpdef int _cmp_mul(Expression left, Expression right) except -2: |
| 2657 | """ |
| 2658 | Compare ``left`` and ``right`` in the print order for products. |
| 2659 | |
| 2660 | INPUT: |
| 2661 | |
| 2662 | - ``right`` -- A :class:`Expression` instance. |
| 2663 | |
| 2664 | OUTPUT: |
| 2665 | |
| 2666 | Boolean. |
| 2667 | |
| 2668 | EXAMPLES:: |
| 2669 | |
| 2670 | sage: a = sqrt(3) |
| 2671 | sage: b = x^2+1 |
| 2672 | sage: a._cmp_mul(b) |
| 2673 | -1 |
| 2674 | sage: b._cmp_mul(a) |
| 2675 | 1 |
| 2676 | sage: b._cmp_mul(1) |
| 2677 | Traceback (most recent call last): |
| 2678 | ... |
| 2679 | TypeError: Argument 'right' has incorrect type (expected |
| 2680 | sage.symbolic.expression.Expression, got sage.rings.integer.Integer) |
| 2681 | """ |
| 2682 | return print_order_compare_mul(left._gobj, right._gobj) |