#7194: extended singular functions interface, needs work
-----------------------------------+----------------------------------------
   Reporter:  PolyBoRi             |       Owner:  malb                
       Type:  enhancement          |      Status:  new                 
   Priority:  major                |   Milestone:  sage-4.1.3          
  Component:  commutative algebra  |    Keywords:  singular            
Work_issues:                       |      Author:  Michael Brickenstein
   Reviewer:                       |      Merged:                      
-----------------------------------+----------------------------------------

Comment(by PolyBoRi):

 Hi!
 A small demonstration of the copy and paste feature:

 Singular:
 {{{
 proc content(f)
 "USAGE:   content(f); f polynomial/vector
 RETURN:  number, the content (greatest common factor of coefficients)
          of the polynomial/vector f
 SEE ALSO: cleardenom
 EXAMPLE: example content; shows an example
 "
 {
   if (f==0) { return(number(1)); }
   return(leadcoef(f)/leadcoef(cleardenom(f)));
 }
 example
 { "EXAMPLE:"; echo = 2;
    ring r=0,(x,y,z),(c,lp);
    content(3x2+18xy-27xyz);
    vector v=[3x2+18xy-27xyz,15x2+12y4,3];
    content(v);
 }
 }}}

 Sage:
 {{{
 #!python

 from sage.libs.singular.function import singular_function, lib
 leadcoef =  singular_function("leadcoef")
 cleardenom = singular_function("cleardenom")

 def content(f):
     """
     Examples:
     sage: P.<x,y,z>=PolynomialRing(QQ)
     sage: content(3*x**2+18*x*y-27*x*y*z)
     -3
     """
     if f==0:
         return 1
     return leadcoef(f)/leadcoef(cleardenom(f))

 }}}

-- 
Ticket URL: <http://trac.sagemath.org/sage_trac/ticket/7194#comment:2>
Sage <http://www.sagemath.org>
Sage: Creating a Viable Open Source Alternative to Magma, Maple, Mathematica, 
and MATLAB

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"sage-trac" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/sage-trac?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to