[sage-devel] Groebner Basis over Function Fields

2014-09-24 Thread Joao Alberto de Faria
When trying to run the following code:


R.t = FunctionField(QQ)
S.x, y = PolynomialRing(R,2)
I = S.ideal([x^2 - y^2, y-t])
I.groebner_basis()

I receive the following error:
AttributeError: 'str' object has no attribute 'parent' 

After testing the code again with the 'toy:buchberger2 GB algorithm, I 
found that it was able to do it. Looking into the code it fails when 
passing into singular and isn't currently handled by the current error 
exceptions. To me, it seems that all that needs to be done is to add an 
AttributeError to the except list in the multi_polynomial_ideal  grobner 
basis definiton. However, I have very little knowledge as to how Function 
Fields are implemented, so I was just wondering if this would be a reliable 
fix. If not, I was wondering if anyone could help shed some light on what 
can be done regarding this issue.

-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Groebner Basis over Function Fields

2014-09-24 Thread Joao Alberto de Faria
When running the following code, 

R.t=FunctionField(QQ)
S.x,y = PolynomialRing(R,2)
I=S.ideal([x^2-y^2,y-t])
I.groebner_basis()

i am getting the following error: 

AttributeError: 'str' object has no attribute 'parent'

After checking other grobner basis algorithms, it seems to work using the toy 
algorithm. My first inclination is to go into multi_polynomial_ideal and 
add Attribute Error to its list of excepts, however I do not know enough about 
Function Field implementation to do this with sound mind. Would this fix be 
sufficient, or is this a deeper issue?

-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: Groebner Basis over Function Fields

2014-09-24 Thread Simon King
Hi Joao,

On 2014-09-22, Joao Alberto de Faria fariajoa...@gmail.com wrote:
 R.t = FunctionField(QQ)
 S.x, y = PolynomialRing(R,2)
 I = S.ideal([x^2 - y^2, y-t])
 I.groebner_basis()

 I receive the following error:
 AttributeError: 'str' object has no attribute 'parent' 

I can confirm it.

 After testing the code again with the 'toy:buchberger2 GB algorithm, I 
 found that it was able to do it. Looking into the code it fails when 
 passing into singular and isn't currently handled by the current error 
 exceptions. To me, it seems that all that needs to be done is to add an 
 AttributeError to the except list in the multi_polynomial_ideal  grobner 
 basis definiton.

No. I rather think the _element_constructor_ method of function fields
should be able to deal with input that is a string.

I will open a trac ticket for it.

Thank you for the report!
Simon

-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Please review global docstring/test change #16746

2014-09-24 Thread Volker Braun
On Tuesday, September 23, 2014 7:47:39 PM UTC+1, Jeroen Demeyer wrote:

 I really would like somebody else (preferably somebody who knows about 
 IPython and displayhooks) to review that part of the ticket. 


Unless you have somebody specific in mind that is not a very useful 
position.

The goal of review is not to wait until somebody comes along and writes the 
perfect patch. The question that you should ask yourself is: Is it better 
than what we currently have.

-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] problems with hypergeometric and maxima_calculus.hgfpoly

2014-09-24 Thread Dima Pasechnik
there is quite a bit of weirdness mentioned here:

http://ask.sagemath.org/question/24257/a-hypergeometric-series/

e.g.

sage: hypergeometric([-2,-1],[2],-1).n(100)
---
ValueErrorTraceback (most recent call last)
ipython-input-4-0bef797c6f48 in module()
 1 
hypergeometric([-Integer(2),-Integer(1)],[Integer(2)],-Integer(1)).n(Integer(100))

/home/scratch/dimpase/sage/sage6.3/local/lib/python2.7/site-packages/sage/symbolic/expression.so
 
in sage.symbolic.expression.Expression._numerical_approx 
(build/cythonized/sage/symbolic/expression.cpp:26972)()

/home/scratch/dimpase/sage/sage6.3/local/lib/python2.7/site-packages/sage/symbolic/expression.so
 
in sage.symbolic.expression.Expression._convert 
(build/cythonized/sage/symbolic/expression.cpp:7667)()

/home/scratch/dimpase/sage/sage6.3/local/lib/python2.7/site-packages/sage/functions/hypergeometric.pyc
 
in _evalf_(self, a, b, z, parent, algorithm)
294 aa = [rational_param_as_tuple(c) for c in a]
295 bb = [rational_param_as_tuple(c) for c in b]
-- 296 return mpmath_utils.call(hyper, aa, bb, z, parent=parent)
297 
298 def _tderivative_(self, a, b, z, *args, **kwargs):

/home/scratch/dimpase/sage/sage6.3/local/lib/python2.7/site-packages/sage/libs/mpmath/utils.so
 
in sage.libs.mpmath.utils.call 
(build/cythonized/sage/libs/mpmath/utils.c:6309)()

/home/scratch/dimpase/sage/sage6.3/local/lib/python2.7/site-packages/mpmath/functions/hypergeometric.pyc
 
in hyper(ctx, a_s, b_s, z, **kwargs)
223 elif q == 0: return ctx._hyp1f0(a_s[0][0], z)
224 elif p == 2:
-- 225 if   q == 1: return ctx._hyp2f1(a_s, b_s, z, **kwargs)
226 elif q == 2: return ctx._hyp2f2(a_s, b_s, z, **kwargs)
227 elif q == 3: return ctx._hyp2f3(a_s, b_s, z, **kwargs)

/home/scratch/dimpase/sage/sage6.3/local/lib/python2.7/site-packages/mpmath/functions/hypergeometric.pyc
 
in _hyp2f1(ctx, a_s, b_s, z, **kwargs)
442 if absz = 0.8 or (ctx.isint(a) and a = 0 and a = -1000) or \
443   (ctx.isint(b) and b = 0 and b = -1000):
-- 444 return ctx.hypsum(2, 1, (atype, btype, ctype), [a, b, c], 
z, **kwargs)
445 
446 orig = ctx.prec

/home/scratch/dimpase/sage/sage6.3/local/lib/python2.7/site-packages/mpmath/ctx_mp.pyc
 
in hypsum(ctx, p, q, flags, coeffs, z, accurate_small, **kwargs)
686 while 1:
687 if extraprec  maxprec:
-- 688 raise ValueError(ctx._hypsum_msg % (prec, 
prec+extraprec))
689 wp = prec + extraprec
690 if magnitude_check:

ValueError: hypsum() failed to converge to the requested 100 bits of 
accuracy
using a working precision of 7135 bits. Try with a higher maxprec,
maxterms, or set zeroprec.
sage: 

(and if I try .n(1) the error is the same, only the last bit reads as
ValueError: hypsum() failed to converge to the requested 1 bits of 
accuracy
using a working precision of 66315 bits. Try with a higher maxprec,
maxterms, or set zeroprec.)

and

sage: maxima_calculus.hgfpoly([1,2],[2],-1)
---
TypeError Traceback (most recent call last)
ipython-input-6-a307d86456bf in module()
 1 
maxima_calculus.hgfpoly([Integer(1),Integer(2)],[Integer(2)],-Integer(1))

/home/scratch/dimpase/sage/sage6.3/local/lib/python2.7/site-packages/sage/interfaces/interface.pyc
 
in __call__(self, *args, **kwds)
561 
562 def __call__(self, *args, **kwds):
-- 563 return self._parent.function_call(self._name, list(args), 
kwds)
564 
565 def _sage_doc_(self):

/home/scratch/dimpase/sage/sage6.3/local/lib/python2.7/site-packages/sage/interfaces/interface.pyc
 
in function_call(self, function, args, kwds)
487[s.name() for s in args],
488['%s=%s'%(key,value.name()) 
for key, value in kwds.items()])
-- 489 return self.new(s)
490 
491 def _function_call_string(self, function, args, kwds):

/home/scratch/dimpase/sage/sage6.3/local/lib/python2.7/site-packages/sage/interfaces/interface.pyc
 
in new(self, code)
262 
263 def new(self, code):
-- 264 return self(code)
265 
266 
###

/home/scratch/dimpase/sage/sage6.3/local/lib/python2.7/site-packages/sage/interfaces/interface.pyc
 
in __call__(self, x, name)
197 
198 if isinstance(x, basestring):
-- 199 return cls(self, x, name=name)
200 try:
201 return self._coerce_from_special_method(x)

/home/scratch/dimpase/sage/sage6.3/local/lib/python2.7/site-packages/sage/interfaces/interface.pyc
 
in __init__(self, parent, value, is_name, name)
624  

[sage-devel] Re: Groebner Basis over Function Fields

2014-09-24 Thread Simon King
Hi all,

On 2014-09-24, Simon King simon.k...@uni-jena.de wrote:
 No. I rather think the _element_constructor_ method of function fields
 should be able to deal with input that is a string.

 I will open a trac ticket for it.

... which is #17033 and needs review.

Best regards,
Simon

-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Printing deprecated functions in gray ?

2014-09-24 Thread Nathann Cohen
Hello everybody !

Here I was deprecating stuff, and I wondered: could we make it explicit in
the tab-completion that some functions are deprecated ?

In particular, I have to (I am not proud) replace a (now deprecated)
designs.orthogonal_array with a (note the terminal 's')
designs.orthogonal_arrays.

Wouldn't it be cool if typing designs.tab would display the first
deprecated function in light gray, so as to mean it's disappearing ?

I was wondering how to prevent users from reading the (long) documentation
of this function before noticing that it is deprecated when they call it,
only to see how the new one works.

Clearly not critical :-P

Nathann

-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-devel] Printing deprecated functions in gray ?

2014-09-24 Thread William A Stein
On Wed, Sep 24, 2014 at 7:54 AM, Nathann Cohen nathann.co...@gmail.com wrote:
 Hello everybody !

 Here I was deprecating stuff, and I wondered: could we make it explicit in
 the tab-completion that some functions are deprecated ?

 In particular, I have to (I am not proud) replace a (now deprecated)
 designs.orthogonal_array with a (note the terminal 's')
 designs.orthogonal_arrays.

 Wouldn't it be cool if typing designs.tab would display the first
 deprecated function in light gray, so as to mean it's disappearing ?

 I was wondering how to prevent users from reading the (long) documentation
 of this function before noticing that it is deprecated when they call it,
 only to see how the new one works.

Maybe you could write at the TOP of the docstring:

   DEPRECATED

Or even make the deprecation decorator prepend that to the docstring
automatically?


 Clearly not critical :-P




 Nathann

 --
 You received this message because you are subscribed to the Google Groups
 sage-devel group.
 To unsubscribe from this group and stop receiving emails from it, send an
 email to sage-devel+unsubscr...@googlegroups.com.
 To post to this group, send email to sage-devel@googlegroups.com.
 Visit this group at http://groups.google.com/group/sage-devel.
 For more options, visit https://groups.google.com/d/optout.



-- 
William Stein
Professor of Mathematics
University of Washington
http://wstein.org
wst...@uw.edu

-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: Printing deprecated functions in gray ?

2014-09-24 Thread Volker Braun
IMHO it would be best to not have deprecated methods in the tab completion 
to start with.

However, its not trivial to find out that something is deprecated. Of 
course you can easily check for the decorator, but a method could also end 
up throwing a deprecation warning because it calls a deprecated method. Or 
call the deprecation warning in the method body.



On Wednesday, September 24, 2014 3:54:16 PM UTC+1, Nathann Cohen wrote:

 Hello everybody !

 Here I was deprecating stuff, and I wondered: could we make it explicit in 
 the tab-completion that some functions are deprecated ?

 In particular, I have to (I am not proud) replace a (now deprecated) 
 designs.orthogonal_array with a (note the terminal 's') 
 designs.orthogonal_arrays.

 Wouldn't it be cool if typing designs.tab would display the first 
 deprecated function in light gray, so as to mean it's disappearing ?

 I was wondering how to prevent users from reading the (long) documentation 
 of this function before noticing that it is deprecated when they call it, 
 only to see how the new one works.

 Clearly not critical :-P

 Nathann


-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: Groebner Basis over Function Fields

2014-09-24 Thread Joao Alberto de Faria
I've looked over the code, and it seems fine to me, however I am not that 
versed in function fields. I believe that the best person to review 
something like this would be someone who understands the function field 
functionality better than I do. I am more than willing to officially review 
it though.

On Wednesday, September 24, 2014 8:45:28 AM UTC-4, Simon King wrote:

 Hi all, 

 On 2014-09-24, Simon King simon...@uni-jena.de javascript: wrote: 
  No. I rather think the _element_constructor_ method of function fields 
  should be able to deal with input that is a string. 
  
  I will open a trac ticket for it. 

 ... which is #17033 and needs review. 

 Best regards, 
 Simon 



-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Problems with sage build.

2014-09-24 Thread Amit Jamadagni
Hello everyone,
   I have been working on the knot theory module. I have pushed all my 
work onto github. Recently I created a ticket #17030, and have added the 
trac details. Here is what I get when I do a 
git remote -v
origin https://github.com/amitjamadagni/sage (fetch)
origin https://github.com/amitjamadagni/sage (push)
trac git://trac.sagemath.org/sage.git (fetch)
trac g...@trac.sagemath.org:sage.git (push)

Now I used to use the following procedure to push my work onto github. 
Changes --- build sage --- test the results --- commit and then push

After I have added the trac details, when I build sage it takes a lot more 
time when compared to the previous time which I used to do before 
committing the changes onto github. And sage does not build completely 
instead it ends with the following error :

error: command 'gcc' failed with exit status 1
build/cythonized/sage/libs/pari/handle_error.c: In function 
‘__pyx_f_4sage_4libs_4pari_12handle_error__pari_handle_exception’:
build/cythonized/sage/libs/pari/handle_error.c:1046:32: error: ‘e_STACK’ 
undeclared (first use in this function)
build/cythonized/sage/libs/pari/handle_error.c:1046:32: note: each 
undeclared identifier is reported only once for each function it appears in
build/cythonized/sage/libs/pari/handle_error.c:1107:32: error: ‘e_USER’ 
undeclared (first use in this function)

This has happened with when I do the above activity on my local machine as 
well when I tried it on the cloud.

Here are my doubts:
1. How do I go about resolving the above issue.
2. I checkout onto the required branch my doing git trac checkout 17030. Do 
the changes reflect both in the local branch on github as well as the 
current branch?? 

Thanks.

-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: Problems with sage build.

2014-09-24 Thread Travis Scrimshaw
Hey Amit,
   From a quick look at the commit log, I think you've updated Sage, but 
haven't rebuilt the spkgs, of which there are changes in the Sage code 
which require those to be rebuilt. The code on the ticket has nothing to do 
with PARI, so I expect you will experience on develop (note, not 
master) as well. What I'd suggest doing is going into $SAGE_ROOT and 
running make build. If that doesn't work, there's always the nuclear 
option make distclean  make.

Best,
Travis


On Wednesday, September 24, 2014 4:18:49 PM UTC-5, Amit Jamadagni wrote:

 Hello everyone,
I have been working on the knot theory module. I have pushed all my 
 work onto github. Recently I created a ticket #17030, and have added the 
 trac details. Here is what I get when I do a 
 git remote -v
 origin https://github.com/amitjamadagni/sage (fetch)
 origin https://github.com/amitjamadagni/sage (push)
 trac git://trac.sagemath.org/sage.git (fetch)
 trac g...@trac.sagemath.org:sage.git (push)

 Now I used to use the following procedure to push my work onto github. 
 Changes --- build sage --- test the results --- commit and then push

 After I have added the trac details, when I build sage it takes a lot more 
 time when compared to the previous time which I used to do before 
 committing the changes onto github. And sage does not build completely 
 instead it ends with the following error :

 error: command 'gcc' failed with exit status 1
 build/cythonized/sage/libs/pari/handle_error.c: In function 
 ‘__pyx_f_4sage_4libs_4pari_12handle_error__pari_handle_exception’:
 build/cythonized/sage/libs/pari/handle_error.c:1046:32: error: ‘e_STACK’ 
 undeclared (first use in this function)
 build/cythonized/sage/libs/pari/handle_error.c:1046:32: note: each 
 undeclared identifier is reported only once for each function it appears in
 build/cythonized/sage/libs/pari/handle_error.c:1107:32: error: ‘e_USER’ 
 undeclared (first use in this function)

 This has happened with when I do the above activity on my local machine as 
 well when I tried it on the cloud.

 Here are my doubts:
 1. How do I go about resolving the above issue.
 2. I checkout onto the required branch my doing git trac checkout 17030. 
 Do the changes reflect both in the local branch on github as well as the 
 current branch?? 

 Thanks.



-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.


[sage-devel] Re: problems with hypergeometric and maxima_calculus.hgfpoly

2014-09-24 Thread Fredrik Johansson


On Wednesday, September 24, 2014 12:35:50 PM UTC+2, Dima Pasechnik wrote:

 there is quite a bit of weirdness mentioned here:

 http://ask.sagemath.org/question/24257/a-hypergeometric-series/

 e.g.

 sage: hypergeometric([-2,-1],[2],-1).n(100)
 ---


 -

 is any of these known? In the 1st case, looks like numeric evaluation of 
 qFp by mpmath is
 seriously broken...


hyp2f1(-2,-1,2,-1) doesn't converge because the value is zero, and the 
hypergeometric function evaluation code in mpmath always tries to achieve 
full *relative* accuracy. One solution is to do:

 hyp2f1(-2,-1,2,-1,zeroprec=1000)
mpf('0.0')

This is saying that if the result cannot be distinguished from zero when 
using 1000 bits of working precision, it is probably actually zero and not 
just merely something very small (so don't be fussy about it).

In fact, hyp2f1(-2,-1,2,z) is just the polynomial 1+z. mpmath has no way to 
distinguish 1 + (-1) from 1 + (-1 + eps) in which the eps disappears due 
rounding, so it has to assume that something may have disappeared. Indeed:

 mp.dps = 1000
 z = mpf(-1) + mpf(1e-900)
 mp.dps = 15
 hyper([-2,-1],[2],z)  # conservatively throws an error
Traceback (most recent call last):
  ...
ValueError: hypsum() failed to converge to the requested 53 bits of accuracy
using a working precision of 3568 bits. Try with a higher maxprec,
maxterms, or set zeroprec.
 hyper([-2,-1],[2],z,zeroprec=1000) # WRONG!!! (relatively speaking)
mpf('0.0')
 hyper([-2,-1],[2],z,maxprec=1)   # correct
mpf('9.9998e-901')

Exact zero detection could be done at least in trivial cases by identifying 
easy factors such as z-1 or z+1. In general, I think one basically has to 
fall back to using exact rational arithmetic for the evaluation. This would 
be worth implementing in mpmath, because the current behavior is definitely 
annoying.

For Sage, fixing the problem is actually trivial: when the hypergeometric 
function is a polynomial (and at least when the inputs are exact), don't 
call mpmath; just evaluate the polynomial directly and then call .n() on 
the result.

Fredrik

-- 
You received this message because you are subscribed to the Google Groups 
sage-devel group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-devel+unsubscr...@googlegroups.com.
To post to this group, send email to sage-devel@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-devel.
For more options, visit https://groups.google.com/d/optout.