Ticket #4036: trac_4036axiom_interface.patch
File trac_4036axiom_interface.patch, 2.7 KB (added by , 12 years ago) 


sage/interfaces/axiom.py
# HG changeset patch # User Adam Webb <adamwebb_rrs@yahoo.com> # Date 1250521229 7200 # Node ID 918a07e5222cc0e6e5b7edf1ef5246360b54149c # Parent 498a833ef69689f771dcd66d177173bde413f2fb trac 4036 minor improvements to axiom interface diff r 498a833ef696 r 918a07e5222c sage/interfaces/axiom.py
a b 827 827 sage: _.parent() #optional  axiom 828 828 Real Double Field 829 829 830 sage: fricas(2.0).as_type('DoubleFloat').sage() #optional  fricas 831 2.0 832 sage: _.parent() #optional  fricas 833 Real Double Field 834 830 835 831 836 sage: axiom(2.1234)._sage_() #optional  axiom 832 837 2.12340000000000 … … 844 849 sage: _.parent() #optional  axiom 845 850 Real Field with 53 bits of precision 846 851 847 852 848 853 We can also convert Axiom's polynomials to Sage polynomials. 849 854 sage: a = axiom(x^2 + 1) #optional  axiom 850 855 sage: a.type() #optional  axiom … … 858 863 sage: _.parent() #optional  axiom 859 864 Multivariate Polynomial Ring in y, x over Rational Field 860 865 866 This also works for FriCAS. 867 sage: fricas(2.1234)._sage_() #optional  fricas 868 2.12340000000000 869 sage: _.parent() #optional  fricas 870 Real Field with 53 bits of precision 871 sage: a = RealField(100)(pi) 872 sage: fricas(a)._sage_() #optional  fricas 873 3.1415926535897932384626433833 874 sage: _.parent() #optional  fricas 875 Real Field with 100 bits of precision 876 sage: fricas(a)._sage_() == a #optional  fricas 877 True 878 sage: fricas(2.0)._sage_() #optional  fricas 879 2.00000000000000 880 sage: _.parent() #optional  axiom 881 Real Field with 53 bits of precision 882 883 884 We can also convert FriCAS's polynomials to Sage polynomials. 885 sage: a = fricas(x^2 + 1) #optional  fricas 886 sage: a.type() #optional  fricas 887 Polynomial(Integer) 888 sage: a.sage() #optional  fricas 889 x^2 + 1 890 sage: _.parent() #optional  fricas 891 Univariate Polynomial Ring in x over Integer Ring 892 sage: fricas('x^2 + y^2 + 1/2').sage() #optional  fricas 893 y^2 + x^2 + 1/2 894 sage: _.parent() #optional  fricas 895 Multivariate Polynomial Ring in y, x over Rational Field 896 861 897 862 898 """ 863 899 P = self._check_valid()