[sage-devel] Solved Re: ECL out of memory error

2022-01-13 Thread Jonathan Thornburg
In 
I wrote:
> A Sage program of mine recently aborted with an error traceback
> (given in full below) ending with
> 
> > TypeError: ECL says: Memory limit reached. Please jump to an outer pointer, 
> > quit
> >  program and enlarge the
> > memory limits before executing the program again.
> 
> How is the ECL memory limit configured?  (From looking around with 'ps'
> and 'top' while Sage is running, I don't think I'm hitting any OS-level
> process-size limit.)
[[...]]

For the archives: On further investigation it's clear I was wrong.
I was indeed hitting an OS-level process-size limit, and increasing
that limit resolved my problems.  I'm sorry for the false problem
report.

--
-- "Jonathan Thornburg [remove color- to reply]" 
   on the west coast of Canada, eh?
   "There was of course no way of knowing whether you were being watched
at any given moment.  How often, or on what system, the Thought Police
plugged in on any individual wire was guesswork.  It was even conceivable
that they watched everybody all the time."  -- George Orwell, "1984"

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/YeDfL6vuBtLXSzjV%40gold.bkis-orchard.net.


[sage-devel] Unreachable-code warnings in GiNaC / sagelib / sage-9.5.rc1

2022-01-13 Thread Thierry Thomas
Hello,

Trying to upgrade Sage to 9.5 on FreeBSD, I'm encountering an infinite
loop in doc-inventory--reference-manifolds.

When investigating for this problem (not yet solved), I noticed several
warnings in sagelib / ginac when compiled with clang:

sage/symbolic/ginac/cmatcher.cpp:548:17: warning: code will never be executed 
[-Wunreachable-code]
ret_val = false;
^
sage/symbolic/ginac/cmatcher.cpp:761:17: warning: code will never be executed 
[-Wunreachable-code]
ret_val = false;
^

sage/symbolic/ginac/numeric.cpp:981:9: warning: code will never be executed 
[-Wunreachable-code]
setflag(status_flags::evaluated | status_flags::expanded);
^~~
sage/symbolic/ginac/numeric.cpp:4368:34: warning: code will never be executed 
[-Wunreachable-code]
throw std::runtime_error("iquo: bad input");
 ^
sage/symbolic/ginac/numeric.cpp:4406:34: warning: code will never be executed 
[-Wunreachable-code]
throw std::runtime_error("iquo2: bad input");
 ^~

These lines could simply be removed, unless some other behaviour was
intended?

Regards.
-- 
Th. Thomas.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/YeCfqNq%2BzUbGbma/%40graf.pompo.net.


[sage-devel] Deprecation from #28481 resulting in inconsistency?

2022-01-13 Thread friedri...@gmail.com
While working on #25633 I stumbled over the below behaviour:
Here, the vector_space method behaves differently, depending on wether 
called from an object which is a vector space itself or a finite field.

sage: (GF(2)^2).vector_space()
Vector space of dimension 2 over Finite Field of size 2
sage: GF(2^2).vector_space()
/home/asante/werkstatt/sage/local/var/lib/sage/venv-python3.8/lib/python3.8/site-packages/sage/categories/fields.py:533:
 
DeprecationWarning: The default value for map will be changing to True.  To 
keep the current behavior, explicitly pass map=False.
See https://trac.sagemath.org/28481 for details.
  return self.free_module(*args, **kwds)
Vector space of dimension 2 over Finite Field of size 2

sage: (GF(2)^2).vector_space(map=False)
---
TypeError Traceback (most recent call last)
 in 
> 1 (GF(Integer(2))**Integer(2)).vector_space(map=False)

TypeError: vector_space() got an unexpected keyword argument 'map'
sage: GF(2^2).vector_space(map=False)
Vector space of dimension 2 over Finite Field of size 2

Is this on purpose? If so, what is a good way to determine if a function 
gets as input a vector or a field element?

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/9ffe6e49-b854-4afc-b9ae-49768b7ba293n%40googlegroups.com.


Re: [sage-devel] not easily reproducible QQbar bug

2022-01-13 Thread Vincent Delecroix

I am not able to reproduce. I ran 1000 times the same code snippet
you provided on all the sage that I have around me. Do you have the
bug in a fresh session  or after some hours of other unrelated
computations? In the first case, you can try to reproduce with

1. In an instance where you have the bug (at the start of a
   fresh session), get the initial random seed with initial_seed()

2. Start a fresh session, set the initial seed with
   set_random_seed(value_from_point_1_above) and rerun
   the code snippet

Best
Vincent

Le 13/01/2022 à 15:16, 'Martin R' via sage-devel a écrit :

ubuntu 21.04
'SageMath version 9.5.beta7, Release Date: 2021-11-18'

On Thursday, 13 January 2022 at 15:09:57 UTC+1 vdelecroix wrote:


Could you be more specific : Which sage version ? which setup ?

Vincent

Le 13/01/2022 à 15:05, 'Martin R' via sage-devel a écrit :

I have some very strange behaviour of a substitution, which I don't know
how to reproduce, but it happens from time to time, and is REALLY
disturbing. I don't even know what to write into a ticket, so I'm asking
here first. The definition of CSP is at the end of the mail.

sage: R. = ZZ[]
sage: p = q^21 + q^20 + q^19 + q^18 + q^17 + q^16 + q^15 + q^14 + q^13 +
q^12 + q^11 + 2*q^10 + 2*q^9 + 2*q^8 + 2*q^7 + 2*q^6 + 2*q^5 + 2*q^4 +
2*q^3 + 2*q^2 + 3*q + 4
sage: p == CSP(22)
True
sage: CSP(22).subs({q:QQbar.zeta(2)})
-28
sage: CSP(22).subs({q:QQbar.zeta(2)})
2
sage: CSP(22).parent()
Univariate Polynomial Ring in q over Integer Ring

Sometimes I also get a complex number.

Martin

###
def cycle_power(g, e):
"""
Return k such that g^k = e
"""
if e.is_one():
return 0
k = 1
p = g
while True:
if e == p:
return k
p *= g
k += 1

@cached_function
def CSP(n):
C = groups.permutation.Cyclic(n)
g = C.gen()
R. = ZZ[]
return sum(q^min(cycle_power(g, e) for e in coset) for H in
C.subgroups() for coset in C.cosets(H))







--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/57c62fad-c645-9883-50c5-3605cb557b5a%40gmail.com.


Re: [sage-devel] not easily reproducible QQbar bug

2022-01-13 Thread 'Martin R' via sage-devel
I agree to all of your 3 points :-)

On Thursday, 13 January 2022 at 15:34:02 UTC+1 john.c...@gmail.com wrote:

> On Thu, 13 Jan 2022 at 14:05, 'Martin R' via sage-devel
>  wrote:
> >
> > I have some very strange behaviour of a substitution, which I don't know 
> how to reproduce, but it happens from time to time, and is REALLY 
> disturbing. I don't even know what to write into a ticket, so I'm asking 
> here first. The definition of CSP is at the end of the mail.
> >
> > sage: R. = ZZ[]
> > sage: p = q^21 + q^20 + q^19 + q^18 + q^17 + q^16 + q^15 + q^14 + q^13 + 
> q^12 + q^11 + 2*q^10 + 2*q^9 + 2*q^8 + 2*q^7 + 2*q^6 + 2*q^5 + 2*q^4 + 
> 2*q^3 + 2*q^2 + 3*q + 4
> > sage: p == CSP(22)
> > True
> > sage: CSP(22).subs({q:QQbar.zeta(2)})
> > -28
> > sage: CSP(22).subs({q:QQbar.zeta(2)})
> > 2
> > sage: CSP(22).parent()
> > Univariate Polynomial Ring in q over Integer Ring
> >
> > Sometimes I also get a complex number.
> >
> > Martin
> >
> > ###
> > def cycle_power(g, e):
> > """
> > Return k such that g^k = e
> > """
> > if e.is_one():
> > return 0
> > k = 1
> > p = g
> > while True:
> > if e == p:
> > return k
> > p *= g
> > k += 1
> >
>
> 1. You could be using discrete_log() or one of its variants instead of
> your cycle_power() function.
>
> 2. In CSP() would it not be faster to work out for each power h=g^k,
> how many times h will arise and hence the coefficient of q^k? The
> pattern in your example is fairly simple to see.
>
> I know that neither of these points answers your actual question...
>
> John
>
> > @cached_function
> > def CSP(n):
> > C = groups.permutation.Cyclic(n)
> > g = C.gen()
> > R. = ZZ[]
> > return sum(q^min(cycle_power(g, e) for e in coset) for H in 
> C.subgroups() for coset in C.cosets(H))
> >
> > --
> > 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+...@googlegroups.com.
> > To view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-devel/a013e022-a007-4748-9a67-ae1e45f3e825n%40googlegroups.com
> .
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/737a4ead-3067-4387-a489-60b025e37ed3n%40googlegroups.com.


Re: [sage-devel] not easily reproducible QQbar bug

2022-01-13 Thread John Cremona
On Thu, 13 Jan 2022 at 14:05, 'Martin R' via sage-devel
 wrote:
>
> I have some very strange behaviour of a substitution, which I don't know how 
> to reproduce, but it happens from time to time, and is REALLY disturbing.  I 
> don't even know what to write into a ticket, so I'm asking here first.  The 
> definition of CSP is at the end of the mail.
>
> sage: R. = ZZ[]
> sage: p = q^21 + q^20 + q^19 + q^18 + q^17 + q^16 + q^15 + q^14 + q^13 + q^12 
> + q^11 + 2*q^10 + 2*q^9 + 2*q^8 + 2*q^7 + 2*q^6 + 2*q^5 + 2*q^4 + 2*q^3 + 
> 2*q^2 + 3*q + 4
> sage: p == CSP(22)
> True
> sage: CSP(22).subs({q:QQbar.zeta(2)})
> -28
> sage: CSP(22).subs({q:QQbar.zeta(2)})
> 2
> sage: CSP(22).parent()
> Univariate Polynomial Ring in q over Integer Ring
>
> Sometimes I also get a complex number.
>
> Martin
>
> ###
> def cycle_power(g, e):
> """
> Return k such that g^k = e
> """
> if e.is_one():
> return 0
> k = 1
> p = g
> while True:
> if e == p:
> return k
> p *= g
> k += 1
>

1. You could be using discrete_log() or one of its variants instead of
your cycle_power() function.

2. In CSP() would it not be faster to work out for each power h=g^k,
how many times h will arise and hence the coefficient of q^k?  The
pattern in your example is fairly simple to see.

I know that neither of these points answers your actual question...

John

> @cached_function
> def CSP(n):
> C = groups.permutation.Cyclic(n)
> g = C.gen()
> R. = ZZ[]
> return sum(q^min(cycle_power(g, e) for e in coset) for H in C.subgroups() 
> for coset in C.cosets(H))
>
> --
> 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 view this discussion on the web visit 
> https://groups.google.com/d/msgid/sage-devel/a013e022-a007-4748-9a67-ae1e45f3e825n%40googlegroups.com.

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/CAD0p0K6wEu9pL%2BeOU8FG3PyP7Twgarq-6w-NPNoNZDdMJOmpSw%40mail.gmail.com.


Re: [sage-devel] not easily reproducible QQbar bug

2022-01-13 Thread 'Martin R' via sage-devel
ubuntu 21.04
'SageMath version 9.5.beta7, Release Date: 2021-11-18'

On Thursday, 13 January 2022 at 15:09:57 UTC+1 vdelecroix wrote:

> Could you be more specific : Which sage version ? which setup ?
>
> Vincent
>
> Le 13/01/2022 à 15:05, 'Martin R' via sage-devel a écrit :
> > I have some very strange behaviour of a substitution, which I don't know
> > how to reproduce, but it happens from time to time, and is REALLY
> > disturbing. I don't even know what to write into a ticket, so I'm asking
> > here first. The definition of CSP is at the end of the mail.
> > 
> > sage: R. = ZZ[]
> > sage: p = q^21 + q^20 + q^19 + q^18 + q^17 + q^16 + q^15 + q^14 + q^13 +
> > q^12 + q^11 + 2*q^10 + 2*q^9 + 2*q^8 + 2*q^7 + 2*q^6 + 2*q^5 + 2*q^4 +
> > 2*q^3 + 2*q^2 + 3*q + 4
> > sage: p == CSP(22)
> > True
> > sage: CSP(22).subs({q:QQbar.zeta(2)})
> > -28
> > sage: CSP(22).subs({q:QQbar.zeta(2)})
> > 2
> > sage: CSP(22).parent()
> > Univariate Polynomial Ring in q over Integer Ring
> > 
> > Sometimes I also get a complex number.
> > 
> > Martin
> > 
> > ###
> > def cycle_power(g, e):
> > """
> > Return k such that g^k = e
> > """
> > if e.is_one():
> > return 0
> > k = 1
> > p = g
> > while True:
> > if e == p:
> > return k
> > p *= g
> > k += 1
> > 
> > @cached_function
> > def CSP(n):
> > C = groups.permutation.Cyclic(n)
> > g = C.gen()
> > R. = ZZ[]
> > return sum(q^min(cycle_power(g, e) for e in coset) for H in
> > C.subgroups() for coset in C.cosets(H))
> > 
>

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/7666fd06-2e97-4bed-923c-407bf1299395n%40googlegroups.com.


Re: [sage-devel] not easily reproducible QQbar bug

2022-01-13 Thread Vincent Delecroix

Could you be more specific : Which sage version ? which setup ?

Vincent

Le 13/01/2022 à 15:05, 'Martin R' via sage-devel a écrit :

I have some very strange behaviour of a substitution, which I don't know
how to reproduce, but it happens from time to time, and is REALLY
disturbing.  I don't even know what to write into a ticket, so I'm asking
here first.  The definition of CSP is at the end of the mail.

sage: R. = ZZ[]
sage: p = q^21 + q^20 + q^19 + q^18 + q^17 + q^16 + q^15 + q^14 + q^13 +
q^12 + q^11 + 2*q^10 + 2*q^9 + 2*q^8 + 2*q^7 + 2*q^6 + 2*q^5 + 2*q^4 +
2*q^3 + 2*q^2 + 3*q + 4
sage: p == CSP(22)
True
sage: CSP(22).subs({q:QQbar.zeta(2)})
-28
sage: CSP(22).subs({q:QQbar.zeta(2)})
2
sage: CSP(22).parent()
Univariate Polynomial Ring in q over Integer Ring

Sometimes I also get a complex number.

Martin

###
def cycle_power(g, e):
 """
 Return k such that g^k = e
 """
 if e.is_one():
 return 0
 k = 1
 p = g
 while True:
 if e == p:
 return k
 p *= g
 k += 1

@cached_function
def CSP(n):
 C = groups.permutation.Cyclic(n)
 g = C.gen()
 R. = ZZ[]
 return sum(q^min(cycle_power(g, e) for e in coset) for H in
C.subgroups() for coset in C.cosets(H))



--
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/a05289f9-3b44-b4fa-e119-3c8b07c54a39%40gmail.com.


[sage-devel] not easily reproducible QQbar bug

2022-01-13 Thread 'Martin R' via sage-devel
I have some very strange behaviour of a substitution, which I don't know 
how to reproduce, but it happens from time to time, and is REALLY 
disturbing.  I don't even know what to write into a ticket, so I'm asking 
here first.  The definition of CSP is at the end of the mail.

sage: R. = ZZ[]
sage: p = q^21 + q^20 + q^19 + q^18 + q^17 + q^16 + q^15 + q^14 + q^13 + 
q^12 + q^11 + 2*q^10 + 2*q^9 + 2*q^8 + 2*q^7 + 2*q^6 + 2*q^5 + 2*q^4 + 
2*q^3 + 2*q^2 + 3*q + 4
sage: p == CSP(22)
True
sage: CSP(22).subs({q:QQbar.zeta(2)})
-28
sage: CSP(22).subs({q:QQbar.zeta(2)})
2
sage: CSP(22).parent()
Univariate Polynomial Ring in q over Integer Ring

Sometimes I also get a complex number.

Martin

###
def cycle_power(g, e):
"""
Return k such that g^k = e
"""
if e.is_one():
return 0
k = 1
p = g
while True:
if e == p:
return k
p *= g
k += 1

@cached_function
def CSP(n):
C = groups.permutation.Cyclic(n)
g = C.gen()
R. = ZZ[]
return sum(q^min(cycle_power(g, e) for e in coset) for H in 
C.subgroups() for coset in C.cosets(H))

-- 
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 view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-devel/a013e022-a007-4748-9a67-ae1e45f3e825n%40googlegroups.com.