Hi. Is that the reason for the following behaevior:

sage: var('a,b')
sage: print repr(simplify(function('(a)^(a+b)')))
sage: print repr(simplify(function('a%(a+b)')))
sage: #print repr(simplify(function('(a)%(a+b)')))             gives
enless loop !!!
a^(b + a)
a(b + a)                             !!! Suddenly % gone

Roland

On 7 sep, 12:33, "John Cremona" <[EMAIL PROTECTED]> wrote:
> The symbolic ring is not the most obvious place to do arithmetic
> operations such as reducing one thing modulo another: that's a job for
> a polynomial ring:
>
> sage: R.<x,y>=QQ[]
> sage: x%y
> x
> sage: y%x
> y
> sage: def proc(a,b): return a%b
> ....:
> sage: proc(x,y)
> x
> sage: proc(y,x)
> y
>
> John
>
> 2008/9/7 Rolandb <[EMAIL PROTECTED]>:
>
>
>
> > Hi. I want to use x%y for two variables x,y. This doesn't work as the
> > following example shows:
>
> > sage: var('x,y')
> > sage: def proc(a,b): return a%b
> > sage: print proc(6,3)
> > sage: print proc(x,y)
>
> > 0
> > Traceback (most recent call last):
> >  File "<stdin>", line 1, in <module>
> >  File "/home/notebook/sage_notebook/worksheets/admin/38/code/13.py",
> > line 9, in <module>
> >    exec compile(ur'print proc(x,y)' + '\n', '', 'single')
> >  File "/usr/local/sage/local/lib/python2.5/site-packages/sympy/
> > plotting/", line 1, in <module>
>
> >  File "/home/notebook/sage_notebook/worksheets/admin/38/code/13.py",
> > line 7, in proc
> >    def proc(a,b): return a%b
> > TypeError: unsupported operand type(s) for %: 'SymbolicVariable' and
> > 'SymbolicVariable'
>
> > What to do? Roland
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sage-support
URLs: http://www.sagemath.org
-~----------~----~----~----~------~----~------~--~---

Reply via email to