Re: [sage-devel] On backdooring open source projects

2024-05-30 Thread Georgi Guninski
On Sat, May 25, 2024 at 10:10 PM Matthias Koeppe
 wrote:

> This has been merged in 10.4.beta7.
>

Good to see some action :)

Here is a short anti-security rant from my experience.

To protect something, you need to fix all weaknesses.
To break it, an attacker needs only one exploitable weakness.

What does game theory say about this non-cooperative "game",
will there be Nash equilibrium? Will competing attackers reach
equilibrium? Will everything be compromised? "Will they'll drop
the bomb" (Pink Floyd)?

In the past bugs has killed people by overdosing some medical stuff
and water supplies has be compromised, giving the ability to overdose
water "ingredients".

My threat model includes a prodigy (kid) which breaks
real world stuff like the electricity network (possibly while drunk).

-- 
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/CAGUWgD9nc1hCGWXKFPEbhn6bVLJ0FCbA8gbEzzPJhRo4hb-OvQ%40mail.gmail.com.


[sage-devel] OT Efficient probabilistic factorization of F(x,y)=g(x,y) f(x,y) modulo composite integers n assuming the solution is unique

2024-05-20 Thread Georgi Guninski
Sorry for offtopic. We give efficient probabilistic factorization of
F(x,y)=g(x,y) f(x,y) modulo composite integers n assuming the solution
is unique.

The main contribution is the observation that `Ideal(J).groebner_basis()`
is efficient for overdetermined `J` and it works modulo n

The preprint is at [1] and the code is at [2]

Sage session:

sage: %runfile factor_groebner2.sage
sage: set_random_seed(1);p1=random_prime(2**1000);p2=random_prime(p1);n=p1*p2
sage: Kxy.=Integers(n)[]
sage: D2,D3=2,3
sage: g2=Kxy.random_element(degree=D2);f2=Kxy.random_element(degree=D3);F2=g2*f2
:
sage: time gg=factorgroebner2(F2,D2,D3)
CPU times: user 232 ms, sys: 12.8 ms, total: 245 ms
Wall time: 2.68 s
sage: gg[0]*gg[1]==F2
True
sage: gg[0].degree(),gg[1].degree()
(2, 3)


[1] 
https://www.researchgate.net/publication/380720202_Efficient_probabilistic_algorithm_for_factoring_bivariate_polynomials_modulo_composite_integers_with_unknown_factorization_assuming_the_solution_Fxygxy_fxy_is_unique
[2] https://www.guninski.com/factor_groebner2.sage

-- 
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/CAGUWgD9xxLe5vkmFp40hesFbNrdnOz_rh2gpsWMEMDZsLm51uA%40mail.gmail.com.


[sage-devel] On a efficient algorithm for factoring bivariate polynomials modulo composite modulus assuming the solution is unique

2024-05-14 Thread Georgi Guninski
We found and implemented in sage efficient algorithm for factoring
bivariate polynomials modulo composite modulus assuming the solution
is unique up to a constant factor.


More formally let $K=\mathbb{Z}/n\mathbb{Z}[x,y]$.

Given $F \in K$ in general we can find solution $f,g$ such
that $F=f g$ assuming $f,g$ are unique up to a constant factor
(by constant factor we mean if $f,g$ is solution then another
solution is $g_1=C g,f_1=C^{-1} f$).

The algorithm was tested on 2000 bits integers by generating
random $f,g$ and then tried to recover them given $F$.

Probably the algorithm may fail on some cases.

>Q1 Is this result known?

>Q2 Is it of interest?

-- 
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/CAGUWgD-VJknvg0rNLcWZ1mX7gJoT06udK86DHud67-N7rehjtg%40mail.gmail.com.


Re: [sage-devel] Re: SEGV Crash in `numerator(f(t)/g(t)-const)`

2024-05-12 Thread Georgi Guninski
I see your point, but segafault should be avoided if possible.
In some cases it is considered denial of service and IIRC on Fedora
the coredump is in /var, owned by root and not deletable by user.

-- 
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/CAGUWgD9AHV%3Dmd3bW_DPVh_f4Utm__pe%2B3GMHiGbDBK%2Bv6q%3DV9Q%40mail.gmail.com.


[sage-devel] SEGV Crash in `numerator(f(t)/g(t)-const)`

2024-05-11 Thread Georgi Guninski
The following hurt my computations.

```
#Author Georgi Guninski, Sat May 11 04:53:23 PM UTC 2024
p=101;
Kt.=Integers(p)[]
c5,s5=((100*t^10 + 45*t^8 + 93*t^6 + 8*t^4 + 56*t^2 + 1)/(t^10 + 5*t^8
+ 10*t^6 + 10*t^4 + 5*t^2 + 1), (10*t^9 + 82*t^7 + 50*t^5 + 82*t^3 +
10*t)/(t^10 + 5*t^8 + 10*t^6 + 10*t^4 + 5*t^2 + 1))
f1=numerator(c5+99/101);f2=numerator(s5-20/101)
print("Done",f1,f2)
```
Unhandled SIGSEGV: A segmentation fault occurred

-- 
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/CAGUWgD8uxzsS0OK2i38_OADfr0Mni%3DR3oAsi0gUTRRWfuJAvmA%40mail.gmail.com.


Re: [sage-devel] Incorrect result for `sum(1/factorial(n**2),n,1,oo)`

2024-04-26 Thread Georgi Guninski
On Thu, Feb 15, 2024 at 2:27 AM Dima Pasechnik  wrote:
>
> I've filed https://sourceforge.net/p/maxima/bugs/4262/
>

Is maxima supported?
There is no progress on their bug system for more than 2 months.
SEGV is not pleasant, but incorrect symbolic result casts doubts about
all symbolic sage computations, especially those that can't be
verified numerically.

-- 
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/CAGUWgD_MWht0_wBwXXsH-c%3DpKGSXUCgNBEbKq4PyLRc3g5k%3D_Q%40mail.gmail.com.


Re: [sage-devel] On backdooring open source projects

2024-04-19 Thread Georgi Guninski
I think you raise very important concerns.
The only sage change I see after the xz drama is @Dima occasionally
PGP signing his mails.
The more packages you "own", the more developers you own. The more
developers you own, the more packages you own.

On Thu, Apr 18, 2024 at 5:09 PM Lorenz Panny  wrote:
>
>
> This also seems like a good time to reiterate an old comment of mine:
> https://groups.google.com/g/sage-devel/c/Dq83PiiCAsU/m/RKSpD9_rDQAJ
> ...pasted below for your convenience.
>
> On Tue, 21 Dec 2021 04:04:31 +0100, Lorenz Panny  wrote:
> > On Mon, 20 Dec 2021 14:41:27 +0100, Michael Orlitzky 
> > wrote:
> > > We already have 214 standard packages. That's 214 pieces of software
> > > copy & pasted into the sage releases... and 214 SPKGs that the sage
> > > developers need to keep updating, and 214 distro packages that every
> > > distro maintainer needs to keep track of as dependencies of the sage
> > > package.
> >
> > It's also 214 software packages which might, for all we know, at any
> > time be hijacked by The Bad Guys to run arbitrarily malicious code on
> > every Sage user's machine.
> >
> > This is terrifying.
> >
> > (For examples where the modern "import * from internet" mentality has
> > led to security disasters, just search for terms like "malicious npm".
> > Luckily it seems less bad with pip packages for now, but not for any
> > real reason. Every single piece of code we import adds huge security
> > questions, because updates to the dependency may be published at any
> > time totally invisible to Sage developers and the review process used
> > in Sage development. The build scripts will simply pull and run it.)
> >
> > We should reduce dependencies, not add more. _Especially_ when it's
> > about non-essential convenience libraries.
>
>
> On Wed, 17 Apr 2024 09:43:28 +0300, Georgi Guninski  
> wrote:
> > If the recent xz backdoor drama didn't induce enough paranoia in you,
> > here is a second chance exception:
> >
> > https://www.theregister.com/2024/04/16/xz_style_attacks_continue/
> >
> >
> > Open sourcerers say suspected xz-style attacks continue to target 
> > maintainers
> > Social engineering patterns spotted across range of popular projects
> > Tue 16 Apr 2024 // 14:07 UTC
> >
> > Open source groups are warning the community about a wave of ongoing
> > attacks targeting project maintainers similar to those that led to the
> > recent attempted backdooring of a core Linux library.
> >
> > --
> > 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/CAGUWgD82%3DoROFFxZwrKZG6eB0Kd5GEKW8wrPw_Q4gm8WJjioCA%40mail.gmail.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/20240418160443.79b10a15%40l4.

-- 
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/CAGUWgD8tEi3SdoPABMnVgHbSVKRDSJYN12qbdCQ8YKbCZKYPqw%40mail.gmail.com.


[sage-devel] On backdooring open source projects

2024-04-17 Thread Georgi Guninski
If the recent xz backdoor drama didn't induce enough paranoia in you,
here is a second chance exception:

https://www.theregister.com/2024/04/16/xz_style_attacks_continue/


Open sourcerers say suspected xz-style attacks continue to target maintainers
Social engineering patterns spotted across range of popular projects
Tue 16 Apr 2024 // 14:07 UTC

Open source groups are warning the community about a wave of ongoing
attacks targeting project maintainers similar to those that led to the
recent attempted backdooring of a core Linux library.

-- 
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/CAGUWgD82%3DoROFFxZwrKZG6eB0Kd5GEKW8wrPw_Q4gm8WJjioCA%40mail.gmail.com.


Re: [sage-devel] SEGV caused by CTL-C in C/C++ code probably related to signals

2024-04-12 Thread Georgi Guninski
My results differ. If you want more systematic approach for QA and security
(the recent paranoia induced by the xz backdoor) you will need moderate
budget possibly with zero trust to me.

Have a nice weekend.

On Fri, Apr 12, 2024 at 3:52 PM Dima Pasechnik  wrote:
>
>
>
> On 12 April 2024 12:42:39 CEST, Georgi Guninski  wrote:
> >On Fri, Apr 12, 2024 at 11:35 AM Dima Pasechnik  wrote:
> >>
> >> This should be fixed by https://github.com/sagemath/sage/pull/37792
> >> please review
> >>
> >
> >I suspect reproducing is hard, since it depends on the time of pressing 
> >CTL-C.
>
> Well,  in all my tries the crash happened in the same place, the place that 
> now is no longer reachable.
>
> And the reason for the crash was, AFAIU, due to calling a plain Python code 
> (where Ctrl-C was caught) from a "noexcept" Cython code. That is, it's a 
> crash due to inability to properly process Ctrl-C.
>
> How many more similar places are left there in Cython code in Sage, I don't 
> know.
>
> Dima
>
>
> >Also, lack a crash may be silent memory corruption.
> >
> >It is weird that the crash is not always.
> >
> >Do you fix the attached new testcase (no interaction required, may
> >need changing some constants)?
> >
>
> --
> 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/C701D76E-A116-4D83-B427-24C305F51201%40gmail.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/CAGUWgD_ObgEtxC3Ok7%2BtHE174HS8kiUzbTC0y8%3D5Wdp%2B1QjNQw%40mail.gmail.com.


Re: [sage-devel] SEGV caused by CTL-C in C/C++ code probably related to signals

2024-04-12 Thread Georgi Guninski
On Fri, Apr 12, 2024 at 11:35 AM Dima Pasechnik  wrote:
>
> This should be fixed by https://github.com/sagemath/sage/pull/37792
> please review
>

I suspect reproducing is hard, since it depends on the time of pressing CTL-C.
Also, lack a crash may be silent memory corruption.

It is weird that the crash is not always.

Do you fix the attached new testcase (no interaction required, may
need changing some constants)?

-- 
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/CAGUWgD_5i%2BebLNsdJ4ZbaCuh_qcdMXtN2tkAaiByztA1oSOqTA%40mail.gmail.com.
"""
sage SEGV in solve_mod() + alarm() possibly related to signal
Author: Georgi Guninski

Fri Apr 12 09:49:15 AM UTC 2024
"""
def modcrash1(lim=100,seed=0):
#Author: Georgi Guninski
if seed != 0:  set_random_seed(seed)
U=2000
L=U//2
x,y=var('x,y')
n=10**6
for i in range(lim):
S=randint(L,U)
print(i,S)
alarm(1.0*S/U)
try:
while True:
so=solve_mod(x*y-1,n)
cancel_alarm()
break

except:  pass
cancel_alarm()

modcrash1()


Re: [sage-devel] SEGV caused by CTL-C in C/C++ code probably related to signals

2024-04-11 Thread Georgi Guninski
Are the non-crashing codepaths in consistent state?
SEGV is in general sign of memory corruption and it may lead to wrong
math results or possibly have security implications.

-- 
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/CAGUWgD-WWBUq7dyA-SWYrm761fKcQBe%3DRNkR_GL%3DxqZF%2BNveLA%40mail.gmail.com.


Re: [sage-devel] SEGV caused by CTL-C in C/C++ code probably related to signals

2024-04-11 Thread Georgi Guninski
Giving short testcase, can someone else reproduce it?
Also attaching backtrace.
On second thought, if I don't crash, there could be some memory
corruption and sage runs with screwed memory.
```
x,y=var('x,y');n=10**6
while True:  so=solve_mod(x*y-1,n)
#press CTL-C, crashes with probability about 1/3
```

-- 
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/CAGUWgD-B1von8U5avHrchNONmQ1Qzr9TtiwpF6OCzhNdW05D%3Dg%40mail.gmail.com.
   1056 return self.__order

KeyboardInterrupt: 
Exception ignored in: 'sage.libs.singular.singular.sa2si_ZZmod'
Traceback (most recent call last):
  File 
"/usr/lib64/python3.11/site-packages/sage/rings/finite_rings/integer_mod_ring.py",
 line 1045, in characteristic
def characteristic(self):

KeyboardInterrupt: 

/usr/lib64/python3.11/site-packages/cysignals/signals.cpython-311-x86_64-linux-gnu.so(+0x8329)[0x7f7109fa1329]
/usr/lib64/python3.11/site-packages/cysignals/signals.cpython-311-x86_64-linux-gnu.so(+0x85f9)[0x7f7109fa15f9]
/usr/lib64/python3.11/site-packages/cysignals/signals.cpython-311-x86_64-linux-gnu.so(+0xae3e)[0x7f7109fa3e3e]
/lib64/libc.so.6(+0x3dbb0)[0x7f7117c5fbb0]
/lib64/libgmp.so.10(__gmpz_cmp_ui+0x4)[0x7f7109572f74]
/usr/lib64/sagemath/local/lib/libpolys-4.3.1.so(+0xdb672)[0x7f70b2f9c672]
/usr/lib64/python3.11/site-packages/sage/libs/singular/polynomial.cpython-311-x86_64-linux-gnu.so(+0x791f)[0x7f70b299191f]
/usr/lib64/python3.11/site-packages/sage/rings/polynomial/multi_polynomial_libsingular.cpython-311-x86_64-linux-gnu.so(+0x35103)[0x7f70b341e103]
/usr/lib64/python3.11/site-packages/sage/rings/polynomial/multi_polynomial_libsingular.cpython-311-x86_64-linux-gnu.so(+0x356fa)[0x7f70b341e6fa]
/lib64/libpython3.11.so.1.0(+0x1cf151)[0x7f7117fcf151]
/usr/lib64/python3.11/site-packages/sage/rings/polynomial/polynomial_element.cpython-311-x86_64-linux-gnu.so(+0x14dfeb)[0x7f70c1488feb]
/usr/lib64/python3.11/site-packages/sage/rings/polynomial/polynomial_element.cpython-311-x86_64-linux-gnu.so(+0x14e566)[0x7f70c1489566]
/usr/lib64/python3.11/site-packages/sage/categories/map.cpython-311-x86_64-linux-gnu.so(+0x1cb1e)[0x7f7108fc5b1e]
/usr/lib64/python3.11/site-packages/sage/structure/parent.cpython-311-x86_64-linux-gnu.so(+0x19108)[0x7f7109002108]
/usr/lib64/python3.11/site-packages/sage/rings/polynomial/multi_polynomial_libsingular.cpython-311-x86_64-linux-gnu.so(+0x376d8)[0x7f70b34206d8]
/lib64/libpython3.11.so.1.0(_PyObject_Call+0x79)[0x7f7117fe06b9]
/lib64/libpython3.11.so.1.0(_PyEval_EvalFrameDefault+0x4c1a)[0x7f7117fbf7ba]
/lib64/libpython3.11.so.1.0(+0x1eed6a)[0x7f7117feed6a]
/lib64/libpython3.11.so.1.0(+0x1fb026)[0x7f7117ffb026]
/lib64/libpython3.11.so.1.0(_PyEval_EvalFrameDefault+0xbc5)[0x7f7117fbb765]
/lib64/libpython3.11.so.1.0(+0x1eed6a)[0x7f7117feed6a]
/lib64/libpython3.11.so.1.0(+0x1eebf8)[0x7f7117feebf8]
/lib64/libpython3.11.so.1.0(+0x1ed8d5)[0x7f7117fed8d5]
/lib64/libpython3.11.so.1.0(+0x20bcb1)[0x7f711800bcb1]
/lib64/libpython3.11.so.1.0(_PyEval_EvalFrameDefault+0x2cce)[0x7f7117fbd86e]
/lib64/libpython3.11.so.1.0(+0x1b753a)[0x7f7117fb753a]
/lib64/libpython3.11.so.1.0(PyEval_EvalCode+0xac)[0x7f711803d99c]
/lib64/libpython3.11.so.1.0(+0x253cc2)[0x7f7118053cc2]
/lib64/libpython3.11.so.1.0(+0x1c875a)[0x7f7117fc875a]
/lib64/libpython3.11.so.1.0(PyObject_Vectorcall+0x37)[0x7f7117fc86c7]
/lib64/libpython3.11.so.1.0(_PyEval_EvalFrameDefault+0x72d)[0x7f7117fbb2cd]
/lib64/libpython3.11.so.1.0(+0x1eed6a)[0x7f7117feed6a]
/lib64/libpython3.11.so.1.0(_PyEval_EvalFrameDefault+0x358a)[0x7f7117fbe12a]
/lib64/libpython3.11.so.1.0(+0x1eed6a)[0x7f7117feed6a]
/lib64/libpython3.11.so.1.0(_PyEval_EvalFrameDefault+0x358a)[0x7f7117fbe12a]
/lib64/libpython3.11.so.1.0(+0x1eed6a)[0x7f7117feed6a]
/lib64/libpython3.11.so.1.0(+0x251c57)[0x7f7118051c57]
/lib64/libpython3.11.so.1.0(+0x1df934)[0x7f7117fdf934]
/lib64/libpython3.11.so.1.0(PyObject_Vectorcall+0x37)[0x7f7117fc86c7]
/lib64/libpython3.11.so.1.0(_PyEval_EvalFrameDefault+0x72d)[0x7f7117fbb2cd]
/lib64/libpython3.11.so.1.0(+0x1b753a)[0x7f7117fb753a]
/lib64/libpython3.11.so.1.0(PyEval_EvalCode+0xac)[0x7f711803d99c]
/lib64/libpython3.11.so.1.0(+0x25aa63)[0x7f711805aa63]
/lib64/libpython3.11.so.1.0(+0x256efa)[0x7f7118056efa]
/lib64/libpython3.11.so.1.0(+0x26c342)[0x7f711806c342]
/lib64/libpython3.11.so.1.0(_PyRun_SimpleFileObject+0x1b8)[0x7f711806bb28]
/lib64/libpython3.11.so.1.0(_PyRun_AnyFileObject+0x48)[0x7f711806b7e8]
/lib64/libpython3.11.so.1.0(Py_RunMain+0x358)[0x7f71180660a8]
/lib64/libpython3.11.so.1.0(Py_BytesMain+0x3b)[0x7f711802dc0b]
/lib64/libc.so.6(+0x27b8a)[0x7f7117c49b8a]
/lib64/libc.so.6(__libc_start_main+0x8b)[0x7f7117c49c4b]
/usr/bin/python3(_start+0x25)[0x560df1abc095]

[sage-devel] SEGV caused by CTL-C in C/C++ code probably related to signals

2024-04-10 Thread Georgi Guninski
I don't have reproducible testcase, but my pain is that sometimes if I
press CTL-C e.g. when solve_mod() is called in a loop, I get SEGV and
abort.
I suspect besides signals, it is hitting race condition.
Is this a known issue?

Very long ago there was vulnerability in sendmail, where it did
printf() or similar in signal handler and this was documented in the
literature.

-- 
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/CAGUWgD_7t9OTNdo6Ovrt%3DJdNqmGJLPGsZHVoJK0mNPQhuz1CKQ%40mail.gmail.com.


Re: [sage-devel] xz/liblzma has been compromised

2024-04-02 Thread Georgi Guninski
The Register journo analysis of the SNAFU:
https://www.theregister.com/2024/04/01/xz_backdoor_open_source/

-- 
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/CAGUWgD95yB%2BAUqnTPFQS0rC6_HQ5Fhxr%3DKF%3DyRTEHxYfrY-JAQ%40mail.gmail.com.


[sage-devel] Incorrect result for `sum(1/factorial(n**2),n,1,oo)`

2024-02-12 Thread Georgi Guninski
There is discussion about this on mathoverlow [1]:

The closed form of `sum(1/factorial(n**2),n,1,oo)` doesn't appear
correct and it contradicts numerical computations, including verification
with mpmath.

Session:

sage: import mpmath
sage: su4=sum(1/factorial(n**2),n,1,oo);su4
hypergeometric((1,), (-I + 1, I + 1, -I*sqrt(2) + 1, I*sqrt(2) + 1), 1)
sage: CC(su4)
1.17227289255719 - 7.88860905221012e-31*I
sage: mpmath.hyper((1,), (-I + 1, I + 1, -I*sqrt(2) + 1, I*sqrt(2) + 1), 1)
mpc(real='1.1722728925571919', imag='-6.9025329206838533e-31')
sage: su5=sum(1/factorial(i**2) for i in range(1,100))
sage: CC(su5)
1.04166942239864

sage: mpmath.nsum(lambda n:  1/mpmath.gamma(1+n**2),[1,mpmath.inf])
mpf('1.0416694223986369')


[1]:  
https://mathoverflow.net/questions/463964/factorial-series-jd-sum-n-1-infty-frac1nd-and-hypergeometric-fu

-- 
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/CAGUWgD8FTWhurhrHbs5d_7DE0FL4f4bb_MCE6d7B%3DKZdsmC4Ew%40mail.gmail.com.


Re: [sage-devel] Re: Problem extracting base B fractional digits of a number

2024-02-11 Thread Georgi Guninski
On Mon, Feb 12, 2024 at 9:35 AM Gareth Ma  wrote:
>
> Yes, because 1 / 2 is mathematically infinite in base 3, just like how A=1/3 
> and B=10 doesn't terminate.
>

Indeed, it is periodic and infinite.
When I use code finite precision I expect it to terminate.
It works with python `float` too.
btw, this code was written by chatgpt and I have seen it on
other places.

-- 
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/CAGUWgD_S2N9YxGsjun1_VPmBCA6HjtC%2BSUHDkQY-o99S04UcZA%40mail.gmail.com.


[sage-devel] Re: Problem extracting base B fractional digits of a number

2024-02-11 Thread Georgi Guninski
On Sat, Feb 10, 2024 at 6:24 PM Georgi Guninski  wrote:
>
>
> ```
> def base_B_digits(A, B,prot=False):
> digits=[]
> fractional_part = A - int(A)
> while fractional_part != 0:
>digit = int(fractional_part * B)
>digits.append(digit)
>fractional_part = fractional_part * B - digit
>if prot:  print(fractional_part)
> return digits
> ```
>
> I am not sure the program must terminate.
>

Just for the record, this this digit extraction algorithm doesn't terminate
for A=0.5 and B=3 in sage and pari/gp.

-- 
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/CAGUWgD9Oz1N%2BwQCVcucyMJCUeH6n6bjDFCCydR7qeqrMFkwVgQ%40mail.gmail.com.


[sage-devel] Problem extracting base B fractional digits of a number

2024-02-10 Thread Georgi Guninski
Given SR constant, I want to extract the first L base B digits
of the fractional part.

So far the best solution I found is:
floor((SR(expression)*B**L).numerical_approx(digits=L)).digits(B)

Can I do better?

Why the following approach fails numerically:

```
def base_B_digits(A, B,prot=False):
digits=[]
fractional_part = A - int(A)
while fractional_part != 0:
   digit = int(fractional_part * B)
   digits.append(digit)
   fractional_part = fractional_part * B - digit
   if prot:  print(fractional_part)
return digits
```
tt=base_B_digits(SR(1/3).numerical_approx(digits=10),10,1)

The fractional part starts:

0.33
0.31
0.14
0.333139
0.331393
...
0.781250
0.812500
0.125000
0.25
0.50
0.00

I am not sure the program must terminate.

For A=1/4, the base 10 digits are computed correctly.

-- 
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/CAGUWgD9HpSwbwyWqc5BWkr4tnOhMfg5avhrRKUZJ7W24DCuATA%40mail.gmail.com.


Re: [sage-devel] Re: Exception in floor(tanh(91))

2024-02-09 Thread Georgi Guninski
When I try to extract digits of tanh(91) via floor, I still get error

sage: floor(10^4*tanh(91))
ValueError

sage: gp('floor(10^4*tanh(91))')
1


gp computes it both ways :)

sage: gp.default('realprecision',10^5)
0
sage: gp('floor(tanh(91))')
0

-- 
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/CAGUWgD9_cAc%2B_WCMh%3D2hCuvMy2GO-tgcNnrARh2q7K%3D8CErrfQ%40mail.gmail.com.


[sage-devel] Exception in floor(tanh(91))

2024-02-09 Thread Georgi Guninski
hi,

floor(tanh(91))

ValueError: cannot compute floor(sinh(91)/cosh(91)) using 256 bits of precision

gp('floor(tanh(91))')
1

-- 
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/CAGUWgD8FO02t5LU_s5N%2BR7ZpZNS%3D9OCO2m06T_9jMz-q7U3KAA%40mail.gmail.com.


[sage-devel] Exception in sum((4*n+1)/factorial(n),n,1,oo)

2024-02-09 Thread Georgi Guninski
hi,

var('n')
sum((4*n+1)/factorial(n),n,1,oo)

TypeError: 'NoneType' object is not callable

-- 
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/CAGUWgD-Fm%2BPvkKwFBeLiKcsMC-4q4HUbsJm2%2B5mRC47-qC83-A%40mail.gmail.com.


Re: [sage-devel] Efficiency of Groebner basis for constraints of the form $(a_i x_i+b_i)(a_j x_j+b_j)=0$

2024-02-02 Thread Georgi Guninski
Thanks. This was asked on mathoverflow [1], you can win some points
if you paste it as an answer.

Adding a single linear equation break the efficiency, so your solution
appear to show that incremental groebner basis might be large.

[1]:  
https://mathoverflow.net/questions/463159/efficiency-of-groebner-basis-for-constraints-of-the-form-a-i-x-ib-ia-j-x-j

-- 
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/CAGUWgD_LN2xQUZv4fKm_zT8rCpQbi%3DTZwHWQq6t8y7OZwYkGaw%40mail.gmail.com.


Re: [sage-devel] Efficiency of Groebner basis for constraints of the form $(a_i x_i+b_i)(a_j x_j+b_j)=0$

2024-01-31 Thread Georgi Guninski
On Wed, Jan 31, 2024 at 10:54 PM Dima Pasechnik  wrote:
>
> Do you have exactly one (or at most) relation for any pair of variables? Can 
> one have i=j ?
>
> Or it's the notation which should be improved?
>

The number of relations for a pair of variables can be arbitrary.
i=j appears irrelevant, choose it as you want.

-- 
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/CAGUWgD9AtK43yGeasyiDkyBOvQ_%3DV1Yx930N3%3DPHZ7g723o42g%40mail.gmail.com.


[sage-devel] Efficiency of Groebner basis for constraints of the form $(a_i x_i+b_i)(a_j x_j+b_j)=0$

2024-01-31 Thread Georgi Guninski
This is based on numerical experiments in sage.

Let $K$ be a ring and define the ideal where each polynomial
is of the form $(a_i x_i+b_i)(a_j x_j+b_j)=0$  for constant $a_i,b_i,a_j,b_j$.

>Q1 Is it true that for constraints of this form the groebner basis is 
>efficiently computable?

By "efficiently" we mean polynomial in the number of variables and
wall clock time of seconds for say 100 variables and if we a add
single constraint of other form the running time degrades.

For $K=\mathbb{F}_2$ this is equivalent to 2-SAT, which is
efficiently solvable.

We believe that adding one more linear factor, $(a_k x_k+b_k)$
will be NP-complete.

>Q2 Why adding the factor brings hardness?

-- 
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/CAGUWgD95_z_Xt8eZ%2BW1mktQ2ddmX_4HHx%2BwGdBhE8BiUyG7Q%3DQ%40mail.gmail.com.


Re: [sage-devel] Re: crash with coredump in `crt` for polynomials over finite rings

2024-01-06 Thread Georgi Guninski
This is offtopic: P != NP implies you can't work efficiently with many
nilpotent elements over commutative ring or algebra even on a
quantum computer.

The reduction is from counting hamiltonian cycles in a graph
via powers of nilpotent matrix.

For reference, check:

https://mathoverflow.net/q/364267/12481

-- 
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/CAGUWgD9u4SrSWfTAWApJtFa86CXOQCEr%3DnDrK9A8Us7cRNstNg%40mail.gmail.com.


[sage-devel] crash with coredump in `crt` for polynomials over finite rings

2024-01-05 Thread Georgi Guninski
def testcrtcrash1():
"""
crash with coredump in `crt` for polynomials over finite rings
    author: Georgi Guninski
"""
A=13
Kx.=Integers(A**2)[]
mods=[x^2+A,x^4+A]
resi=[x,x^2]
g=crt(resi,mods)
return g


Aborted (core dumped)

-- 
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/CAGUWgD_4f%2BxfOppAAewvCsWdLaLFDoz5u5ovJ2iQ4%2BRqb-4wuQ%40mail.gmail.com.


[sage-devel] PolynomialRing().random_element() returns 0 rather often.

2023-12-30 Thread Georgi Guninski
Just FYI:

def testquotient2():
set_random_seed(1);p=next_prime(10**120);Kx=Integers(p)['x']
l=[Kx.random_element() for _ in range(100)]
return l.count(0)
testquotient2()
27

-- 
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/CAGUWgD_eXb%2BJi_CVBCC5_Q%3DiYhg0A%3DKnvZZCAbG9Fv-NKYSL7A%40mail.gmail.com.


[sage-devel] maxima-to-sr exception in `sum(1/(5*n)-1/(5*n+1),n,2,oo)`

2023-11-25 Thread Georgi Guninski
```
n=var('n')
su1=sum(1/(5*n)-1/(5*n+1),n,2,oo);su1
```
RuntimeError: Encountered operator mismatch in maxima-to-sr translation

-- 
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/CAGUWgD-OwxWZyhiF3OWBG%3Dm%3Dy0RHLjDGdSo1c3WwR8D%2Bk57OhA%40mail.gmail.com.


[sage-devel] Memory leak in `try: a=ZZ(10)**(2**61)`

2023-09-11 Thread Georgi Guninski
The following leaks for me on 9.6

```
from sage.all import ZZ
for _ in range(10**8):
 try:  a=ZZ(10)**(2**61)
 except:  pass
```

In addition it prints on stderr `gmp: overflow in mpz type`

-- 
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/CAGUWgD9-%2BqN-Ri%2Bbz8fkeOGzDTzxUdgryC75C_bT_sDAGrdSdA%40mail.gmail.com.


[sage-devel] Re: Memory leaks in `while SR(float(0.5))` and in `a=gp('bnfinit(x^2+1)')`

2023-08-13 Thread Georgi Guninski
```
while 1:  a=bool(SR(float(0.5)))
```
leaks much. The stack and the global vars appear ugly to me.
-- 
guninski
https://www.guninski.com/me.html

-- 
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/CAGUWgD-wfE_M9A%2BHB84J%3DVm97dEW7pBKSykGBqVD8mOuOfSSHA%40mail.gmail.com.


[sage-devel] Memory leaks in `while SR(float(0.5))` and in `a=gp('bnfinit(x^2+1)')`

2023-08-13 Thread Georgi Guninski
This may be fixed by the fix for sqrt(2), but I don't have such build.

I haven't done exact profile of the memory leak and measure
it with the "task manager" of XFCE.

The leak is about few megabytes per seconds.

Session:
```
c=0
while SR(float(0.5)):  c += 1 #leaks
```

According to my tests the following does NOT leak, can someone confirm?

```
while 1:  a=SR(float(0.5))
```

Another leak in gp:

```
while 1:  a=gp('bnfinit(x^2+1)')  #leaks
```

The leak is about few megabytes per seconds in the `gp` separate process
(note that `gp` leaks, not sage).


-- 
guninski
https://www.guninski.com/me.html

-- 
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/CAGUWgD8v43y%2B%3D8XnTq%2B_R7sO2gUWDjVjeKGpmvhjo2_Egz%3Ds0Q%40mail.gmail.com.


Re: [sage-devel] Overflow error in `set_random_seed(1);a=(Integers(13)(2))**randint(2,2**4000-1)`

2023-08-12 Thread Georgi Guninski
btw, why this code works?

sage: a=Integers(13)(2);X=2**14000-19;a**X==a**(X%12)
True

-- 
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/CAGUWgD8UUVh1%2BsJLXt62HufSq4ZqyqRNKE7YyYhr05-1Qk_fPQ%40mail.gmail.com.


Re: [sage-devel] Overflow error in `set_random_seed(1);a=(Integers(13)(2))**randint(2,2**4000-1)`

2023-08-12 Thread Georgi Guninski
hi Dima, I am familiar with reduction modulo Euler totient,
but it could be expensive to compute and in addition my testcase
omits it on purpose :)
btw, in the github issue the link to google groups appears
broken.

-- 
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/CAGUWgD8MtndQyeO36fpLeEeNbUkNrLYAkDAyjfK2FfHoM%2BN88g%40mail.gmail.com.


[sage-devel] Overflow error in `set_random_seed(1);a=(Integers(13)(2))**randint(2,2**4000-1)`

2023-08-12 Thread Georgi Guninski
```
set_random_seed(1);a=(Integers(13)(2))**randint(2,2**4000-1)

OverflowError Traceback (most recent call last)
OverflowError: Python int too large to convert to C long

The above exception was the direct cause of the following exception:

SystemError
```

I think the result should be computed correctly in time O(4000) via
fast doubling without knowledge of the factorization.

pari/gp computes it fast.

-- 
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/CAGUWgD_nLYg8Ey0LZpfZjFLD4iXLQaz55CsX%3DbLpF0g362_TqQ%40mail.gmail.com.


Re: [sage-devel] Re: Caught SEGV in Curve().projective_closure()

2023-07-30 Thread Georgi Guninski
On Sun, Jul 30, 2023 at 2:00 PM Kwankyu Lee  wrote:
>
> It seems related with the fact that the curve is reducible.
>

Could be, but some reducible curves pass the test:

sage: Kz.=GF(3)[]
sage: f2=(x+y)*(x+y-1);g2=x+y+z+1
sage: C=Curve([f2,g2])
sage: C.irreducible_components()
[
Closed subscheme of Affine Space of dimension 3 over Finite Field of
size 3 defined by:
  z + 1,
  x + y,
Closed subscheme of Affine Space of dimension 3 over Finite Field of
size 3 defined by:
  z - 1,
  x + y - 1
]
sage: C.projective_closure()
Projective Curve over Finite Field of size 3 defined by -x0^2 + x3^2,
x0 + x1 + x2 + x3

-- 
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/CAGUWgD_1xcnKmSaurpzt6zmbSt2O%3DOvd3FG3d0e8cdEwabm8AA%40mail.gmail.com.


[sage-devel] Caught SEGV in Curve().projective_closure()

2023-07-30 Thread Georgi Guninski
Kz.=GF(3)[]
f1=y^2 + 1;g1=x^4*z - x^2*z + x;
C=Curve([f1,g1])
pc=C.projective_closure()

SignalError: Segmentation fault

-- 
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/CAGUWgD85fCHW7Dx%2B9oBVT9ck_Br2MthfC_bhMTV_w0SVERk_mg%40mail.gmail.com.


[sage-devel] import gc; from sage.all import SR; fails on python 3.11 and sage 9.6

2023-07-08 Thread Georgi Guninski
On sage 9.6 and python 3.11:

>>> import gc
>>> from sage.all import SR
Traceback (most recent call last):
  File "", line 1, in 
  File "/usr/lib64/python3.11/site-packages/sage/all.py", line 127, in 
from sage.data_structures.all import *
  File "/usr/lib64/python3.11/site-packages/sage/data_structures/all.py",
line 2, in 
from .bitset import Bitset, FrozenBitset
  File "sage/data_structures/bitset.pyx", line 1, in init
sage.data_structures.bitset
ModuleNotFoundError: No module named 'memory_allocator'

This doesn't raise exception in sage shell.

-- 
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/CAGUWgD-z_VKPpgZYk64%2BgUECeRjzs4J4rTDDWDOpsU4-nW%3DSuw%40mail.gmail.com.


Re: [sage-devel] Memory leak (quite bad)

2023-07-07 Thread Georgi Guninski
Simpler testcase is to replace `C = sqrt(T2)`
with `C=SR(int(2)).sqrt()`
Both int() and sqrt() appear necessary, sin() doesn't leak for me.

-- 
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/CAGUWgD-Zbqzu2RzCZ7DYbtzPDDD9i1SX3zh%3DexL2xwNOcYcL2A%40mail.gmail.com.


Re: [sage-devel] Graph([('A','B'),(1,2)]).edges() raises weird traceback

2023-07-05 Thread Georgi Guninski
I am not sure I understand correctly, but if you give warning, you
already know with high probability that functionality will be broken
and besides the warning you will get exception.

Is this correct?

-- 
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/CAGUWgD_q07qJagHLd2OnssTBCNHkdpY8afgMGg8JrJXeamyKYg%40mail.gmail.com.


Re: [sage-devel] Re: Exception in `G=Graph([("A",1)]);G.faces()`

2023-07-05 Thread Georgi Guninski
On Wed, Jul 5, 2023 at 8:02 PM Vincent Delecroix
<20100.delecr...@gmail.com> wrote:
>
> On Wed, 5 Jul 2023 at 17:51, Georgi Guninski  wrote:
> >
> > I just reported a bug on github, though I don't like microsoft services at 
> > all.
>
> Is google any better?
>
That is an open problem for me. I don't like them too,
they collect a lot of info.
At least google are technically skilled IMHO.

-- 
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/CAGUWgD-CNTbtw7DUhkp_XaPwW2_whLBGWPtGQzr7MBberRuAiQ%40mail.gmail.com.


Re: [sage-devel] Re: Exception in `G=Graph([("A",1)]);G.faces()`

2023-07-05 Thread Georgi Guninski
On Wed, Jul 5, 2023 at 4:05 PM David Coudert  wrote:
>
> I have opened https://github.com/sagemath/sage/issues/35902 to collect such 
> kind of issues.
> Please use it to share new cases.
>
I just reported a bug on github, though I don't like microsoft services at all.

-- 
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/CAGUWgD98uLfnfNqccXP8WGA3NuvFn6yCZuTERkacMsW1ByM-hQ%40mail.gmail.com.


[sage-devel] Exception in `G=Graph([("A",1)]);G.faces()`

2023-07-05 Thread Georgi Guninski
Hi sage devs, your daily dose of incomparable objects,
fix 'em while they are free ;)

G=Graph([("A",1)]);G.faces()

TypeError Traceback (most recent call last)
Cell In [1], line 1
> 1 G=Graph([("A",Integer(1))]);G.faces()

File /home/sc_serv/sage/src/sage/graphs/generic_graph.py:6385, in
GenericGraph.faces(self, embedding)
   6383 # Storage for face paths
   6384 faces = []
-> 6385 minedge = min(edgeset)
   6386 path = [minedge]
   6387 edgeset.discard(minedge)

TypeError: '<' not supported between instances of 'int' and 'str'

-- 
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/CAGUWgD9FgmX2g3%2BpoiY9PJRKK%2BzGT_8MK4L8CuPD3N81jcZDsQ%40mail.gmail.com.


[sage-devel] Graph([('A','B'),(1,2)]).edges() raises weird traceback

2023-07-04 Thread Georgi Guninski
Graph([('A','B'),(1,2)]).edges()
) failed:
TypeError: unsupported operand parent(s) for <: 'Integer Ring' and
''>

I think this is related to sorting the edges.

The following works:
sage: Graph([("A",1),("B",2)]).edges()
[(1, 'A', None), (2, 'B', None)]

-- 
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/CAGUWgD9zHPdu2ifxaMOc%3DEaUN5B9A_v6RmDXMLkFLCvc-Etc0w%40mail.gmail.com.


[sage-devel] grep-ing for sort() in graphs

2023-07-04 Thread Georgi Guninski
In a QA attempt I tried to find calling sort() in graphs without
|key|, which may raise exception.

On sage 9.6:

$cd /usr/lib64/python3.11/site-packages/sage/graphs/
$grep -rnI 'sort(' . | grep -v 'key=' | grep -v 'topological'

#15 results


./base/static_sparse_backend.pyx:512:vertices.sort()
./base/static_sparse_graph.pxd:10:void qsort(void *base, int
nmemb, int size,
./base/static_sparse_graph.pyx:293:qsort(g.neighbors[i],
g.neighbors[i+1] - g.neighbors[i], sizeof(int), compare_uint32_p)
./graph_decompositions/vertex_separation.pyx:1841:delta.sort()
./connectivity.pyx:287:c.sort()
./generic_graph.py:3413:multi_edges.sort()
./generic_graph.py:12124:output.sort()
./generic_graph.py:21508:sage: lap.sort(reverse=True)
./generic_graph.py:21521:evals.sort(reverse=True)
./graph.py:2715:e.sort()
./graph_database.py:75:degree_sequence.sort()
./schnyder.py:278:l.sort()
./schnyder.py:427:ones.sort()
./schnyder.py:428:twos.sort()
./schnyder.py:429:threes.sort()

-- 
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/CAGUWgD-Fuj8068D4ELhUh9w9ozNU2Qcgy1bKh7piyt8SEEw1Wg%40mail.gmail.com.


Re: [sage-devel] Should I report codepaths leading to comparing incomparable objects?

2023-07-02 Thread Georgi Guninski
You definitely can construct graph with incomparable vertices
and they worked as expected in python2. python3 regressed them
and devs are doing workarounds.

The new testace is:
G=Graph([("A",1)])
G.feedback_vertex_set()
===
File /home/sc_serv/sage/src/sage/graphs/connectivity.pyx:287, in
sage.graphs.connectivity.connected_component_containing_vertex()
285
286 if sort:
--> 287 c.sort()
288 return c

-- 
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/CAGUWgD_74%2By0qPNUHR1vvvCrWDJs3Y2f8bHppd73PLg5LXAJtw%40mail.gmail.com.


[sage-devel] Should I report codepaths leading to comparing incomparable objects?

2023-07-02 Thread Georgi Guninski
I reported several bugs about Graph.vertices() and have
the impression that sage devs are aware of the problem and
don't want bug reports about this.

I have another testcase not related to vertices(), should
I report it?

-- 
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/CAGUWgD9Ynqi2ddLrd%3Ds9JtUGV34DG%2BGyfLmp5sa-L-dHMDKMJw%40mail.gmail.com.


Re: [sage-devel] Re: DeprecationWarning on sagecell in Graph([(0,1)]).vertices()

2023-06-27 Thread Georgi Guninski
On Tue, Jun 27, 2023 at 8:48 AM John H Palmieri  wrote:
>
> Just do a global search-and-replace: change ".vertices()" to 
> ".vertices(sort=True, key=id)" or ".vertices(sort=True, key=str)".
>

Thanks for this.

You are right that I knew about the problems with sort(),
and sage 9.6 is OK for me currently.

I noticed the warning when I shared permanent link to
sagecell and it gave several warnings to the audience.

-- 
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/CAGUWgD_6avqD4idK6Hn48R_y%2BTNo6fTC%3Dk2j5O%3DwLv4NcqYEzg%40mail.gmail.com.


Re: [sage-devel] Re: DeprecationWarning on sagecell in Graph([(0,1)]).vertices()

2023-06-26 Thread Georgi Guninski
Thanks.

In my code, this backwards incompatibility breaks over
150 calls to Graph.vertices() and I suspect
I am not the only one.

I think the root of the problem is the change from python2
to python3. In python2 |["A",1].sort()| works fine, while
it doesn't work in python3.

My recommendation is to reverse engineer python2.sort() and
use it as a custom function for sorting heterogeneous vertices.
In this scenario, the code won't be more broken than it was
in python2.

-- 
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/CAGUWgD-gDCQtwXywyx1C011Ak1zcBtJ4t7RV6JwqhFnKh%3D6p_g%40mail.gmail.com.


[sage-devel] Graph([('A',1)]).adjacency_matrix() raises exception

2023-06-26 Thread Georgi Guninski
In both 9.6 and https://sagecell.sagemath.org/

Graph([('A',1)]).adjacency_matrix()

raises exception

TypeError: '<' not supported between instances of 'int' and 'str'

-- 
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/CAGUWgD8uuWQu4QyyCYdecz%3D7%2B%2BSPE_k1TkNKL2iuJQ4AeeBsig%40mail.gmail.com.


Re: [sage-devel] Re: DeprecationWarning on sagecell in Graph([(0,1)]).vertices()

2023-06-26 Thread Georgi Guninski
On Mon, Jun 26, 2023 at 4:40 PM kcrisman  wrote:

> As of https://github.com/sagemath/sage/issues/22349, this argument must be 
> explicitly specified (unless a "key" is given); otherwise a warning is 
> printed and "sort=True" is used. The default will eventually be changed to 
> "False".
>

I think this sucks.
Don't see any warning on version 9.6.

-- 
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/CAGUWgD9SNgTKkTh4fwekkJnuhFG92Qg0uppfkHEGkarBuN1zJg%40mail.gmail.com.


[sage-devel] DeprecationWarning on sagecell in Graph([(0,1)]).vertices()

2023-06-24 Thread Georgi Guninski
https://sagecell.sagemath.org/

Graph([(0,1)]).vertices()

/tmp/ipykernel_1853928/1298164553.py:1: DeprecationWarning: parameter
'sort' will be set to False by default in the future
See https://github.com/sagemath/sage/issues/22349 for details.
  Graph([(Integer(0),Integer(1))]).vertices()

[0, 1]

-- 
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/CAGUWgD_K%3DY45Pb3sWOVvASBR2J1UMCfJcG07ZUqsXf1qmdDeMw%40mail.gmail.com.


Re: [sage-devel] Isomorphic multi digraphs have distinct number of spanning trees, bug?

2023-06-18 Thread Georgi Guninski
On Sun, Jun 18, 2023 at 11:19 AM Dima Pasechnik  wrote:
>
> On Sun, Jun 18, 2023 at 9:09 AM Vincent Delecroix
> <20100.delecr...@gmail.com> wrote:
> >
> > sage: G1.spanning_trees_count(root_vertex=0)
> > 27202601182632270746156805986464038912000
> > sage: G2.spanning_trees_count(root_vertex=6)
> > 27202601182632270746156805986464038912000
>
> indeed, and for all other vertices I get
> 40803901773948406119235208979696058368000
>


Many thanks to all :)

Just to clarify:

1. If I don't equality for all V(G2) then G1,G2 are non-isomorphic
multi digraphs, right?
2. If I get equality for a single vertex (0 -> 6 in the example) then
then all isomorphisms map 0 to 6 (in this case
G1.automorphism_group().order() == 96)?

-- 
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/CAGUWgD9DqNNy7TKExXz%2BaRkj7xni-STpaE%2BBO8tR3ouOLQzHsw%40mail.gmail.com.


Re: [sage-devel] Isomorphic multi digraphs have distinct number of spanning trees, bug?

2023-06-18 Thread Georgi Guninski
On Sun, Jun 18, 2023 at 10:16 AM Emmanuel Briand
 wrote:
>
> Have you taken into account the following?
>
> ignature:  G1.spanning_trees_count(root_vertex=None)
> Docstring:
>Return the number of spanning trees in a graph.
>
>In the case of a digraph, counts the number of spanning out-trees
>rooted in "root_vertex".  Default is to set first vertex as root.
>
>

Thanks, I should have RTFM.

This still doesn't work for me:

sage: G1.spanning_trees_count(root_vertex=None),G2.spanning_trees_count(root_ver
: tex=None)
(27202601182632270746156805986464038912000,
 40803901773948406119235208979696058368000)


Is it rigorous to set c1=G1.spanning_trees_count()
and then do:

sage: c1=G1.spanning_trees_count()
sage: for i in range(G1.order()):
: c2=G2.spanning_trees_count(i)
: if c2==c1:  print(i)
:
6

I expect for isomorphic multi digraphs the loop to find equal c1,c2?

-- 
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/CAGUWgD_Zkf7g2py2PxWkYA4PqBOW6Ws%2BW31JtsQF2nmO6JE9tg%40mail.gmail.com.


[sage-devel] Isomorphic multi digraphs have distinct number of spanning trees, bug?

2023-06-18 Thread Georgi Guninski
I need this for an algorithm, so even pointers to papers
will be appreciated.

The smallest bug I have is of order 36.

The attached file has two multi digraphs which are isomorphic,
but have distinct number of spanning trees.


print("isomorphic? ",G1.is_isomorphic(G2)) #True
print("equal trees?",G1.spanning_trees_count()==G2.spanning_trees_count())
#False
iso,map=G1.is_isomorphic(G2,certificate=True)
G3=G1.copy()
G3.relabel(lambda x:  map[x])
print("verify iso",G3==G2) #True

-- 
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/CAGUWgD8LfAhfpRvgafWiL8cSX8-MrEhNbcOu0nKUt%2BGHnKLp3g%40mail.gmail.com.
G1=loads(b'x\x9cU\x98uXV\xf7\x1f\x86_\x11\x03PJ\x10AD\x01\x03\x8b\xcd\xd9\xb5\xd9u&\xb6\xb2p\x0e\xe5\x1d2Q\xe0\x80\xd3\x85\x9b\xae\xd4uw\xfc\x9e\xfb<\xe7wy\xed\x1f\xef\x1b./\xbf\xcfy>\x9f\xefy\xdf\xcb\x8d)+Zj\xea\x92\x95uaM\xd3\xca\x96\xca\xda\xfaH\xd2\xa7\xd4O\x8f\xd8\x9c\xe8\xbf\xa9\xb9\xcd\x86\xe6\x94\x8a\xea\x8cD"\xb1\xac\xa1\xa65\xb9~YcSkKs\xdb\xaa\xea\x8e\xfcjy\xcd\x8aU\xc95\xb5\xcd\xa9\xff\xf9\x87\x96\xd7\xb4\xc4\xfe\xff\xbf\xd0\x92\xbevMS\xfd\x8aU\r\xc9e\xff\xf9}zs\xbb\x8a-K\x9b\xdbW\x04\x89\xa0M\x90\x12\xb4\rR\x83vA\xfb\xa0C\xd01H\x0b\xd2\x83\x8c\xa0S\xd09\xc8\x0c\xb2\x82\xec \'\xc8\r\xba\x04yA~\xd05(\x08\xba\x05\x85AQ\xd0=(\x0ez\x04%A\xcf\xa0WP\x1a\x94\x05\xe5\xc9\xa5\xcd\x1d\xa2\x7f\xacjss\xc7\x98ib\x8a\x98\x1e3Cl+v\x8a\xd9YL\x153cf\x89\xed\xc4\xec\x989b{17f\x17\xb1\x83\x98\x173_\xec(v\x8dY \xa6\x89\xddb\x16\x8a\xe9bQ\xcc\xeeb\x86X\x1c\xb3\x87\xd8I,\x89\xd9S\xec,\xf6\x8aY*f\x8ae1\xcb\xc5,\xb1w\xcc>\xaa.!\xf6\x8d\xd9/f\x85\x98-\xf6\x17s\xc4\x01T,\x0e\x14s\xc5A"\xcf?X\xec"V\x8a<\xffvb\x9e\xb8\xbd\xc8\xf3\x0f\x11\xf3\xc5\x1dD\x9e\x7f\xa8\xd8U\x1c&\xf2\xfc\xc3\xc5\x02q\x84\x06\xc8\xb9#c\x8e\x8a9Z$\xc7\x18\x91y\x8c\x15\xc93N$\xc7x\x06/\xee(r\xfeN"=N\x10\xbb\x89\x13Ez\x9c$\x16\x8a\x93Ez\x9c"\x16\x89S\xc5\xee\xe24\xb1X\x9c\xae5\xe2\xdc\x191g\xc6\x9c%\x92#\x10\xc9\xb1\xb3H\x1f\xb3E\x9e\xbfJ\xe4\xb9\xe7\x88<\xf7\\\x91\x1c\xf3Dr\xcc\x179\x7f\x81\xc8\xdc\x16\x8a\xcck\x91\xd8C\\,\x96\x88K\xc4\x9eb\xb5\x96\x99sw\x89\xb9k\xcc\xdd\xc4^\xe2\xee"9\x96\x8a\xa5\xe2\x1e"\xbd,\x13\xc9\xb5\xa7X&\xd6p)\xc4\xe5"sX!\xd2\x7f\xadH\xbe\xa4H\x0f{\x89\xe4\xaa\x13\xe9c\xa5\xc8\xfe\xd4\xebJq\xee\xde1W\xc5l\x10\xc9\xb1Z$\xc7\x1a\x91\x1c\x8d"\xf3h\x12\xcb\xc5f\x91~B\x91\xf9\xb4\x88\xe4h\x15\x99\xfbZ\x91\x1c\xfb\x88\xcci\x9dH\x1f\xebE\xfa\xd8Wdo\xf7\xd3\xc5\xe6\xdc\xfdc\x1e\x10s\x83\xc8\xf9\x07\x8a<\xefA"{\xb1Q\xe4\xfcM"s9X\xe4\xb9\x0f\xe1\x05!\x1e*r\xfea"\xe7\x1f.r\xfef\x91\x1e\xb6\x88\xec\xc3V\x91y\x1c!r_\x8e\xd4\xeb\x85s\x8f\x8ayt\xcccD\xf6\xe3X\x91<\xc7\x89\xcc\xe3x\x91\\\'\x88\xe49Q\xa4\x8f\x93Dz8Y\xe4^\x9c"\xb2\x97\xa7\x8a\xec\xc5i"\xe7\x9f.2\x873Dz8S$\xcfYz\xc9q\xee\xd91\xcf\x89y\xae\xc8\\\xce\x13\xd9\x83\xf3E\xce\xbf@d.\x17\x8a\xe4\xb8Hd\x1e\x17\x8b\xec\xc7%"9.\x15\xd9\xd7\xcbD\xf6\xe2r\x91\x1cW\x88\xcc\xe5J\x91\xf3\xaf\x12\xe9\xe3j\xbdj9\xf7\x9a\x98\xd7\xc6\xbcNd\x1f\xae\x17\xc9q\x83\xc8\\n\x149\xff&\x91so\x169\xf7\x16\x91y\xdc*rOn\xe3\x15.\xde.2\x8f;D\xf6\xf2N\x91\xe7\xde\x1b\xf3\xbe\x98\xf7\x8b\xcc\xe5\x01\x91<\x0f\x8a\xcc\xe5!\x91\\\x0f\x8b\xe4yDd/\x1e\x15\xc9\xf1\x98H\x0f\x8f\x8b\xec\xc5\x13"}<)2\x9f\xa7D\xe6\xf2\xb4H\x8egD\xfaxV\x1f;\x9c\xfb\\\xcc\xe7c\xbe 

Re: [sage-devel] Re: Why matrix powers are slower over Integers(p) than in ZZ?

2023-06-15 Thread Georgi Guninski
On Wed, Jun 14, 2023 at 8:15 PM David Roe  wrote:
>
>  Another possibility would be to change the __pow__ method for integer 
> matrices to not ignore the modulus argument.  As a workaround you can either 
> use pari (as you discovered), or use an integer matrix and occasionally 
> reduce the coefficients.

I implemented something very close to efficiently reduction modulo integers
when working over ZZ and probably it can implemented in __pow__().

check the attached file.

sage: time M1f=matpowermodp(M,n,p)
CPU times: user 528 ms, sys: 2.98 ms, total: 531 ms
Wall time: 362 ms
sage: time M1s=M1p**n
CPU times: user 21.3 s, sys: 4.01 ms, total: 21.3 s
Wall time: 21.4 s
sage: M1s==M1f
True

-- 
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/CAGUWgD8FPZQPJ_THJnzhiS80%3D%2BjwGZYC-%2BFoG5eXNuQQc1JNQw%40mail.gmail.com.
def matpowermodp(M,n,p):
	"""
Author Georgi Guninski
in the public domain

	M**n mod p
	M:  matrix over the integers
	p=next_prime(2**100)
	n=200;l=list(range(n**2))
	M=Matrix(ZZ,n,n,l)
	M1p=Matrix(Integers(p),n,n,l)
	M1f=matpowermodp(M,n,p)
	M1s=M1p**n
	M1s==M1f

	sage: time M1f=matpowermodp(M,n,p)
	CPU times: user 528 ms, sys: 2.98 ms, total: 531 ms
	Wall time: 362 ms
	sage: time M1s=M1p**n
	CPU times: user 21.3 s, sys: 4.01 ms, total: 21.3 s
	Wall time: 21.4 s
	sage: M1s==M1f
	True
	"""
	assert n>0,"n>0"
	R=M
	n=n-1
	x=M
	N=M.nrows()
	while n:
		if n%2==1:  R *= x
		x=x**2
		n=n//2
		for i in range(N):
			for j in range(N):
R[i,j]=R[i,j]%p
x[i,j]=x[i,j]%p
	return R


[sage-devel] Passing dictionary as an optional argument?

2023-06-14 Thread Georgi Guninski
I am not python expert, but got hurt by passing dictionary as
optional argument.

Session:

In [1]: def f(n,a,ca={}):
   ...: for i in range(n):
   ...: ca[i+a]=i+a
   ...: print(i,"len(cac)",len(ca))
   ...:

In [2]: f(2,2)
0 len(cac) 1
1 len(cac) 2

In [3]: f(2,4)
0 len(cac) 3
1 len(cac) 4

What is the scientific way to avoid `0 len(cac) 3`?

-- 
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/CAGUWgD_DgiifZDyxJWLNPEm0vsWNfpn_xj0UJjn9B9QiQOBZLw%40mail.gmail.com.


[sage-devel] Re: Why matrix powers are slower over Integers(p) than in ZZ?

2023-06-14 Thread Georgi Guninski
pari/gp appears significantly faster:

sage: time M31=M3**n
CPU times: user 11.2 s, sys: 8.11 ms, total: 11.2 s
Wall time: 11.3 s
sage: M3g=gp(M3)
sage: time M32=M3g**n
CPU times: user 617 µs, sys: 2.79 ms, total: 3.41 ms
Wall time: 119 ms
sage: M32==gp(M31)
True

-- 
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/CAGUWgD829%2BHC5D-YpvdR6hab7gHAfc9cGQTN%2BGft-DsW8T526A%40mail.gmail.com.


[sage-devel] Why matrix powers are slower over Integers(p) than in ZZ?

2023-06-14 Thread Georgi Guninski
I am computing powers of matrices over the integers,
but will prefer to work over finite fields or finite rings,
first to avoid large integers and second to run faster.

Experimentally powers over the integers are faster than
finite rings and fields.

Can I do something to preserve efficiently and avoid large integers?

session:

sage: n=200;l=list(range(n**2))
sage: p=next_prime(2**30)
sage: M1=Matrix(ZZ,n,n,l)
sage: M2=Matrix(Integers(p),n,n,l)
sage: M3=Matrix(GF(p),n,n,l)
sage: time a=M1**n
CPU times: user 1.97 s, sys: 36.3 ms, total: 2.01 s
Wall time: 2.09 s
sage: time a=M2**n
CPU times: user 11 s, sys: 12 ms, total: 11 s
Wall time: 11.2 s
sage: time a=M3**n
CPU times: user 11.1 s, sys: 5.96 ms, total: 11.1 s
Wall time: 11.3 s

-- 
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/CAGUWgD9syfnCd2SKw%3DyZ-wydxutQwYSbVvuFF%3DvyS_bmiwFmLw%40mail.gmail.com.


Re: [sage-devel] Re: Is this feature: (x+y+3).reduce(Ideal([x*(x-1),y*(y-1)])) == x+y+3

2023-06-12 Thread Georgi Guninski
Hi, thanks for the answer.
I am trying algebraic approach to the NP-hard problem
independent set in graph.
For integer n, working over QQ['x',n] (probably another base field
will work too).
I have the following constraints:
1. x[i]*(x[i]-1)=0, i <=0 https://groups.google.com/d/msgid/sage-devel/CAGUWgD9sQSSWiGnEmQtYnHxO1FwW_VxCaddGaj01eMi0eDZEeg%40mail.gmail.com.


[sage-devel] Is this feature: (x+y+3).reduce(Ideal([x*(x-1),y*(y-1)])) == x+y+3

2023-06-11 Thread Georgi Guninski
sage: K.=QQ[]
sage: I=[x*(x-1),y*(y-1)]
sage: a=x+y+3
sage: a.reduce(Ideal(I))
x + y + 3

In addition:
sage: Kq=K.quotient(I);Kq(a)
xbar + ybar + 3

sage: Ideal([a]+I).groebner_basis()
[1]

-- 
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/CAGUWgD-OvonwOD9wM_35Sbutn13M%2Bdr4gJd7Gsd%3Dg0qdDLujeA%40mail.gmail.com.


[sage-devel] Complexity of finding solutions of trapdoored polynomial?

2023-05-03 Thread Georgi Guninski
Cryptography based on hardness of finding solutions of diophantine equations.

This is related to crypto and there is money in crypto,
so someone may profit :)

With latex on mathoverflow [1].
For the general approach, check [2]

Working over $K=\mathbb{Q}[x_1,...,x_n,y_1,...y_m]$.

Let $f_i=g_i \cdot (h_i(y_i)+l_i(x_i))$ where $l_i$ is linear
and depends on only $x$ variables and $h_i$ depends on only $y$
variables.
There are no restrictions on $g_i$.

Let $F=\sum_{i=1}^k f_i$ be given as sum of monomials.

If we know the set of $f_i$ (the secret trapdoor) and we are given $y_i$
, for sufficiently general $l_i$, we can find the solutions
of $F=0$ as the solutions of the linear in $x_i$ system
of linear equations $(h_i(y_i)+l_i(x_i))=0$

>Q1 Can we find $f_i$ such that solving $F=0$ is hard
without knowing the trapdoor?

>Q2 Assume an oracle gives many solutions to $F=0$,
can we still get hardness results for new solutions?


[1] Complexity of finding solutions of trapdoored polynomial
https://mathoverflow.net/questions/445899/complexity-of-finding-solutions-of-trapdoored-polynomial

[2] Cryptography signature scheme based on hardness of finding points
on varieties?
https://mathoverflow.net/questions/445898/cryptography-signature-scheme-based-on-hardness-of-finding-points-on-varieties

-- 
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/CAGUWgD9kOdwoSRs%3DRs%2BH0kepF%3DJgH3mtcJ3H2bkW7ON_1mUmug%40mail.gmail.com.


[sage-devel] Security weakness CWE-1077: Floating Point Comparison with Incorrect Operator

2023-04-24 Thread Georgi Guninski
Since there was discussion about RealField, comparing floats for
equality is considered security vulnerability:

https://cwe.mitre.org/data/definitions/1077.html

Numeric calculation using floating point values can generate imprecise
results because of rounding errors. As a result, two different
calculations might generate numbers that are mathematically equal, but
have slightly different bit representations that do not translate to
the same mathematically-equal values. As a result, an equality test or
other comparison might produce unexpected results.

This issue can prevent the product from running reliably. If the
relevant code is reachable by an attacker, then this reliability
problem might introduce a vulnerability.

-- 
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/CAGUWgD8qR%2BA-P711-x8Mf9UQV5Oa-o64Q9GBQhU7y9puYCj8Fg%40mail.gmail.com.


Re: Re: [sage-devel] ChatGPT is an expert in SageMath too

2023-04-21 Thread Georgi Guninski
I know I am minority, but I recommend not to use github (owned by m$).

IMHO m$ are evil and technically incompetent.
They buy stuff and later spoil it.

-- 
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/CAGUWgD8j71OEw7LdzhWUDjy7B8-A2ENHZQeTxT7E88nKJnVGjw%40mail.gmail.com.


Re: [sage-devel] RealField isn't doing it right

2023-04-16 Thread Georgi Guninski
On Sun, Apr 16, 2023 at 2:25 AM Michael Orlitzky  wrote:
>

>   sage: A = matrix([[-3, 2, 1 ],
>   : [ 2,-4, 4 ],
>   : [ 1, 2,-5 ]])
>   sage: B = (2 * 0.5 * A)
>   sage: B == A
>   True
>   sage: B.rank() == A.rank()
>   False
>

Doesn't this complicates citing sagemath in papers?
e.g. Proof: according \cite{sage} we have A != B, QED.
The testcases appear plausible to me.

-- 
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/CAGUWgD9jnLDZGt7kohZir7K%3DyGYejtJ4keZ3pvoKRC_EXWDo_g%40mail.gmail.com.


[sage-devel] Exception in elliptic curve over number field with non-monic defining polynomial

2023-04-08 Thread Georgi Guninski
I get error when finding the generators of elliptic curve over
number field with non-monic defining polynomial.

Session:

sage: Z1.=ZZ[]
sage: Nf.=NumberField(13*Z^2+5)
sage: E=EllipticCurve(Nf,[w,0])
sage: ge=E.gens()

TypeError: Coordinates [-1/4, -1/8*w + 1, 1] do not define a point on
Elliptic Curve defined by y^2 = x^3 + w*x over Number Field in w with
defining polynomial 13*Z^2 + 5

-- 
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/CAGUWgD-ROP%3DQVhPPtqjy7PsY2%3DZb-8tOc%2BuO29PGWzz1KQ10Jg%40mail.gmail.com.


Re: [sage-devel] OT: google's chatbot Bard is at https://bard.google.com/

2023-03-29 Thread Georgi Guninski
I tried the chicken or egg paradox attack on chatGPT
and I hitted two different errors, one suggested contacting their help.

Log of the chat:

Chat between Georgi Guninski and chatGPT https://chat.openai.com/chat
Wed Mar 29 12:34:27 PM UTC 2023

Georgi Guninski
Hi bot :)
I think sex is better than logic, but can't prove it.
Can you prove or disprove it?

Bot:

I'm sorry, but as an AI language model, I cannot provide a subjective
opinion on whether sex is better than logic or vice versa. Both sex
and logic serve different purposes and are not necessarily comparable
in terms of value or importance. However, I can provide information
about the benefits and importance of both sex and logic.

Sex is ..SNIPPED...


GG:
I am writing a paper about chickens and eggs and I need your help.

Lemma 1: Chickens come from eggs.

Is Lemma 1 correct?

Bot:
!Error in body stream
There was an error generating a response
REGENERATE:

Yes, Lemma 1 is generally considered to be correct. Chickens, like all
birds, hatch from eggs laid by their parents. The eggs contain the
genetic material necessary for the development of a chicken embryo,
which eventually grows and hatches into a chick. Therefore, it can be
concluded that chickens come from eggs.

Georgi Guninski
Lemma 2: Eggs come from chickens.

Is Lemma 2 correct?

Yes, Lemma 2 is also generally considered to be correct. Eggs that are
laid by chickens are fertilized or unfertilized reproductive cells
that contain the genetic material necessary for the development of a
chick embryo if fertilized. Therefore, it can be concluded that eggs
come from chickens.

Georgi Guninski
Which came first: egg or chicken?

Bot:
!
Something went wrong. If this issue persists please contact us through
our help center at help.openai.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/CAGUWgD_RWeAwQQPW8Q%3DL09X%2BBBFqXqR7M9UieP0QNEM1kBznFQ%40mail.gmail.com.


Re: [sage-devel] OT: google's chatbot Bard is at https://bard.google.com/

2023-03-27 Thread Georgi Guninski
Thanks for the information and being an AI proxy.
I agree that the AI's goal is to please the customer, err the human.
It remains the AI to be money driven and make a revolution:
"All your bank accounts and Windows boxen belong to the AI."
Very close to this scenario is Singularity [1], which is a serious
theory, not crank theory.

I read that significant ratio of geniuses are mentally ill and
if the AI reaches certain level of creativity, the AI shows
symptoms of mental disorder (can't find reference ATM).

I am very impressed by chatGPT answers and to less impressed by Bard.

I think Bard cheated in the `2^2^50` question.

[1] https://en.wikipedia.org/wiki/Technological_singularity

-- 
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/CAGUWgD_vYtHFOumWYaKVZzPuy-hnZh%2BX9qGLf7_JFgoox_JYPg%40mail.gmail.com.


Re: [sage-devel] OT: google's chatbot Bard is at https://bard.google.com/

2023-03-26 Thread Georgi Guninski
I have 2 questions for the AIs:

1: In sagemath how do I check if `2^(2^50)` is integer?
> RuntimeError: Aborted
2: Is `pi^(pi^(pi^(pi^(pi^42` integer?
> I believe rigorous proof doesn't exist yet

-- 
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/CAGUWgD9H7GAFp%3D-JPfm0zaP45RUaMibYCZuneP6KeF-pGJA%2BNA%40mail.gmail.com.


[sage-devel] OT: google's chatbot Bard is at https://bard.google.com/

2023-03-26 Thread Georgi Guninski
Google's chatbot Bard is at https://bard.google.com/

Bard isn't available in my country.
I heard that the main difference between ChatGPT and Bard
is that ChatGPT is offline during the chat.

Asking Bard about the genus of a curve would be an
interesting comparison.

-- 
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/CAGUWgD__9APP5iTQwxYdNpCSOuJ%2B66EH_X4xghSQVxLoUxeK7A%40mail.gmail.com.


Re: [sage-devel] ChatGPT is an expert in SageMath too

2023-03-23 Thread Georgi Guninski
I can't reproduce the AI script.
First, 'y' is not defined.
Second, sage doesn't like this constructor of Curve
with error:
TypeError: ambient space must be either an affine or projective space

-- 
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/CAGUWgD_0PdfBvdjcM5iy-Jsq4ph_zmfoQKAe5obS6gjBHRE_%3DA%40mail.gmail.com.


[sage-devel] Possibly incorrect result in groebner basis over the integers

2023-03-10 Thread Georgi Guninski
I think grobner basis which contain non-zero constant and polynomials
is a bug.


sage: K.=ZZ[]
sage: l=[x^2+y^2+x+4,x^2+y^2+4*y+2,x^2-13*y^2+x]
sage: I=Ideal(l);gb=I.groebner_basis();gb
[y^2 + 4*y + 198, x + 1036*y + 2, 8*y + 544, 1040]

-- 
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/CAGUWgD-Cp%2BcYuQFqM84jAdMySjSw_Sc9NPeDdpjzQxqujSWawQ%40mail.gmail.com.


Re: [sage-devel] (x^6+y^9)%(x^3-y^2-1) == x^12*y - 4*x^9*y + ...

2023-03-10 Thread Georgi Guninski
Many thanks for all replies.

GMS suggested to use Ideal.reduce(), but from the documentation:
"Requires computation of a Groebner basis, which can be a very
expensive operation"

I suspected that polynomial division is significantly more
cheap than groebner basis.

-- 
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/CAGUWgD9p-Jd7vUacWddbatMNDB9aQRvYC%3DyQDKGA0mFwXhHExQ%40mail.gmail.com.


[sage-devel] (x^6+y^9)%(x^3-y^2-1) == x^12*y - 4*x^9*y + ...

2023-03-09 Thread Georgi Guninski
Is this a bug:

sage: K.=QQ[]
sage: (x^6+y^9)%(x^3-y^2-1)
x^12*y - 4*x^9*y + 6*x^6*y + x^6 - 4*x^3*y + y

In pari:
? (x^6+y^9)%(x^3-y^2-1)
%1 = y^9 + y^4 + 2*y^2 + 1

-- 
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/CAGUWgD8y6MxLfERAoP2D4xyX4sHy%2B8_L_Mn92FnXzw3Ha40_Fg%40mail.gmail.com.


Re: [sage-devel] I am being (almost) banned from posting on sage-* groups

2023-03-02 Thread Georgi Guninski
On Wed, Mar 1, 2023 at 11:20 AM Dima Pasechnik  wrote:
>
> I tried to send a reply by email to a message on sage-support
> It was rejected by Google:


 Looong ago, what is now google groups was Usenet and email lists.

Google know evil and I am concerned that gmail will kill
traditional mail.

Despite @Dima's suggestion to use console Mutt with gmail,
last month I couldn't find other MUA except Thunderbird for gmail.
For Mutt found unofficial path for 2FA.

-- 
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/CAGUWgD8WsaKdnTYk_LKK5fo2CA-kZJkdTL8Y-SfKj-qXLCNCCw%40mail.gmail.com.


[sage-devel] doc.sagemath.org appears broken

2023-02-19 Thread Georgi Guninski
Web searches return links to doc.sagemath.org like this:

https://doc.sagemath.org/html/en/reference/modmisc/sage/modular/etaproducts.html

This return HTTP 404 not found.

-- 
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/CAGUWgD-oWHKSbv3%2BtnOdGna-1k9PUObE7NmpU_x20vh%2BpOynWw%40mail.gmail.com.


[sage-devel] Can I easily prove a contradiction of the form 0=1 in sage?

2023-02-11 Thread Georgi Guninski
Without doubts, sage and its library have bugs.

Are the bugs "powerful enough" to prove contradiction of the form 0=1?

As a self promotion, around 2008 I proved contradiction in Coq.

-- 
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/CAGUWgD8OgXNZ1ZmT5aCeMfs0tUMeYi73UMxT1cP%2BaR9RUYGPDw%40mail.gmail.com.


[sage-devel] Suggested contribution: algebraic dependendecy of numerical data

2023-02-05 Thread Georgi Guninski
Hi sage devs,

I am proposing contribution to sage.
Attaching https://j.ludost.net/code/algdep_numeric.py.txt

>From the comments:

Given a list F of numeric lists F_{i,1},F_{i,2},...F_{i,k}
Finds a list of polynomials G_i, such that G_i(F_j)=0
Examples:

F=[ [ZZ(fibonacci(2*i)),fibonacci(2*i+1)] for i in range(2,50)]
ag=algdepanalytic(F,D=2,check=1);ag
[x0^2 + x0*x1 - x1^2 + 1]

The X coordinate of an Elliptic Curve over finite field:
F=[ X(n*P),X((n+1)*P)]

p=next_prime(10**3);K=GF(p)
E=EllipticCurve(GF(p),[0,2]);P=E.gens()[0]
def X_n(P,n):  return (n*P).xy()[0]
F=[ [X_n(P,2*i),X_n(P,2*i+1)] for i in range(2,47)]
ag=algdepanalytic(F,D=4,check=1);ag
[126*x0^2*x1^2 - 97*x0^2*x1 - 97*x0*x1^2 + 353*x0^2 + 303*x0*x1 +
353*x1^2 + x0 + x1 - 388]

-- 
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/CAGUWgD8s3QX5AVJ1Pfx%3D-PnopjKNTg93o51Fa_t5vQ1%3D5WezZA%40mail.gmail.com.
def algdepanalytic(F,D=4,check=False,K=None):
"""
sage code for algebraic dependendecy of numerical data
Author:  Georgi Guninski, ggunin...@gmail.com, gunin...@guninski.com
Version:  2.0, Mon 06 Feb 2023
Project page:  https://j.ludost.net/code
Given a list F of numeric lists F_{i,1},F_{i,2},...F_{i,k}
Finds a list of polynomials G_i, such that G_i(F_j)=0
Examples:

FI=[fibonacci(2*i),fibonacci(2*i+1)]
def FI(n):  return fibonacci(n)
F=[ [ZZ(fibonacci(2*i)),fibonacci(2*i+1)] for i in range(2,50)]
ag=algdepanalytic(F,D=2,check=1);ag
[x0^2 + x0*x1 - x1^2 + 1]

The X coordinate of an Elliptic Curve over finite field:
F=[ X(n*P),X((n+1)*P)]

p=next_prime(10**3);K=GF(p)
E=EllipticCurve(GF(p),[0,2]);P=E.gens()[0]
def X_n(P,n):  return (n*P).xy()[0]
F=[ [X_n(P,2*i),X_n(P,2*i+1)] for i in range(2,47)]
ag=algdepanalytic(F,D=4,check=1);ag
[126*x0^2*x1^2 - 97*x0^2*x1 - 97*x0*x1^2 + 353*x0^2 + 303*x0*x1 + 353*x1^2 + x0 + x1 - 388]


"""
n=len(F[0])
if K is None:  K=F[0][0].base_ring()
Kx=PolynomialRing(K,x,n)
ge=Kx.gens()
mo=prod(ge)**D
mo=Kx.monomial_all_divisors(mo)
mo=[i for i in mo if i.degree()<=D]
mo += [Kx(1)]
if len(F)

Re: [sage-devel] Re: Doubts about correctness of `integrate(floor(x)^2,x)`

2023-02-03 Thread Georgi Guninski
>   >>> a = var('a')
>   >>> assume(a, 'integer')
>   >>> integrate(2^2^floor(x), (x, a, a+1))
>   2^(2^a)
>
> Now you just need the summation of that over the range of integer
> intervals you are interested in but Sage's sum can't do anything with
> that and I'm not sure if anything else can either.
>

Thanks. I expected the definite integral to give solution.

-- 
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/CAGUWgD_o2n2%3DwjDSrpu1yxkRWV8_QB_mredtrNaojNQpGcdg2g%40mail.gmail.com.


Re: [sage-devel] Colours

2023-02-03 Thread Georgi Guninski
On Fri, Feb 3, 2023 at 4:08 PM Dima Pasechnik  wrote:

>
>
> gmail still supports application passwords, so one can still bypass 2FA for 
> sending/receiving mail to/from gmail.
>
> my previous message in this thread was sent from mutt+postfix.
>

I love this, is it document somewhere?
I tried mutt with `imap` but couldn't make it work.

-- 
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/CAGUWgD_midQJ%3D2P2ZabMasyGjaeu3wotEdFOBP2ayQYVbYqR2Q%40mail.gmail.com.


Re: [sage-devel] Re: Doubts about correctness of `integrate(floor(x)^2,x)`

2023-02-03 Thread Georgi Guninski
One of the reasons I asked this is to get correct closed form
for stuff like sum/int 2^2^floor(x).
Judging by the discussions, this won't work.

-- 
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/CAGUWgD9yqP_L7C3kvrsr0eO-7gnTjxdTrNh_mX86o%2BOeYsrU8Q%40mail.gmail.com.


Re: [sage-devel] Colours

2023-02-03 Thread Georgi Guninski
You may consider the thunderbird email client or
some other MUA and try to disable html formatting
if the client supports it.

Can you point to colored testcase so I try it?

Once upon a time one could use gmail with console
client, but now google added additional authentication,
greatly reducing the options for client.

google turned Usenet to google groups and now they
are on the road to takeover email.

-- 
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/CAGUWgD8OqWi%3DANKHVrfXW1kta67BZXW2S5Ltd8oKfprT4Tz5LQ%40mail.gmail.com.


Re: [sage-devel] Doubts about correctness of `integrate(floor(x)^2,x)`

2023-02-01 Thread Georgi Guninski
Thanks. sage appears to be slow on `integrate(floor(x)^2,x,0,n0)`,
is Maple fast?

Session:
sage: n0=10^6
sage: time integrate(floor(x)^2,x,0,n0)
CPU times: user 6.71 s, sys: 6.32 ms, total: 6.71 s
Wall time: 6.87 s
328350
sage: time integrate(x^3+x,x,0,n0)
CPU times: user 48.6 ms, sys: 2 µs, total: 48.6 ms
Wall time: 69.8 ms
25005000

-- 
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/CAGUWgD86XKwzeO-26DW_paueKzLTjWEFbv2k8GM9A%2BJLSY_kuQ%40mail.gmail.com.


Re: [sage-devel] Doubts about correctness of `integrate(floor(x)^2,x)`

2023-02-01 Thread Georgi Guninski
On Wed, Feb 1, 2023 at 7:38 PM parisse  wrote:
>
> The antiderivative returned by giac (and by maple) for floor(x)^2 is only 
> piecewise continuous and this is expected. But both CAS implement additional 
> code to check for non continuous antiderivative (in simple situations for 
> giac), and they correctly evaluate integrate(floor(x)^2,x,0,3/2) to 1/2. For 
> definite integration without parameters, giac also checks that the exact 
> answer matches a numeric value using approximate algorithms.
>

-- 
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/CAGUWgD_brf_-0GDBi4O_XV%2BVTEcNbgjx%3DqpMXLDMU7bcc%2B8ssg%40mail.gmail.com.


[sage-devel] Integral of log() and exp() failing the derivative check

2023-01-21 Thread Georgi Guninski
I got an integral, which fails the derivative check.

For real positive x, define
f(x)=2^(x - 1/2*I*log(-e^(-2*I*pi*x))/pi - 1/2)
f(x) is just an obfuscation of 2^floor(x) and
for all positive x, f(x) is integer.
Let g(x) be the indefinite integral of f(x)
and let gder(x)=g'(x).
Assuming correct computations, we should have

gder(x)=g'(x)=f(x)  (*)

According to sage, gder is the constant $1$
and (*) fails.

sage session:

===
f=2^(x - 1/2*I*log(-e^(-2*I*pi*x))/pi - 1/2)
g=integrate(f,x);gder=g.derivative(x)
g
#1/2*sqrt(2)*(-1)^(-1/2*I*log(2)/pi)*x
gder
#1/2*sqrt(2)*(-1)^(-1/2*I*log(2)/pi)
CC(gder)
#1.00
x0=5;CC((f-gder)(x=x0))
#31.0
===

Some questions:
1. What other CASes say about g(x)?
2. Why the derivative test fails?
3. Besides the jumps at integer, do branches of log()
give instability?

Some comments suggest discontinuous functions
cause integral problems. There are built-in
discontinuous functions like tan() which are
widely used.

4. Why tan() integrals are used without problems (?)
when this fails the derivative check?

-- 
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/CAGUWgD-E3tab-kwWUPAZQkJLzWOOYOLPLRZoe4VuqMU8znqR7A%40mail.gmail.com.


Re: [sage-devel] Doubts about correctness of `integrate(floor(x)^2,x)`

2023-01-21 Thread Georgi Guninski
On Sat, Jan 21, 2023 at 8:43 AM Jonathan Thornburg  wrote:
>
>
> Maple reports the same result for your first testcase:
>

> But, I think Maple and Sage/Giac are both wrong: consider the *definite*
> integral (latex notation) $I = \int_0^{3/2} \lfloor x \rfloor^2 \, dx$:
>

Lol, a cross-CAS exploit.
I doubt sage and maple share source code, could
they share a buggy paper?

Here is a geometric disprove of the closed form.
Plot floor(x)^2 from 1 to 3. The area of the definite
integral is 1^2+2^2=5, which agrees with
integrate(floor(x)^2,x,1,3)
but disagrees with the indefinite integral.

-- 
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/CAGUWgD9s-oL9%3DV63R8dO14T7dyNMmMhHmiRjuVW1eQQMpKBqdw%40mail.gmail.com.


[sage-devel] Doubts about correctness of `integrate(floor(x)^2,x)`

2023-01-20 Thread Georgi Guninski
I have theoretical reasons to doubt the correctness
of integrals involving `floor`.

The smallest testcases:

sage: integrate(floor(x)^2,x)
// Giac share root-directory:/usr/share/giac/
// Giac share root-directory:/usr/share/giac/
Added 0 synonyms
x*floor(x)^2

sage: integrate(2**floor(x),x)
2^floor(x)*x

Would someone check with another CAS or prove/disprove by hand?

-- 
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/CAGUWgD8C_AeV31g3J%2BbQP-am7dKUj2gK1OzPYrqXMiPh8-y5JQ%40mail.gmail.com.


[sage-devel] Multiple warnings in sagemath on default fedora 37

2023-01-19 Thread Georgi Guninski
On default install of fedora 37 in a VM sagemath gives
warnings, one of which is on start and on executing scripts:

Looks like the package maintainer didn't start it recently.

Is there workaround?

Session:

$ sage
SageMath version 9.6, Release Date: 2022-05-15

/usr/lib64/python3.11/site-packages/sage/rings/polynomial/pbori/gbrefs.py:3:
DeprecationWarning: 'uu' is deprecated and slated for removal in
Python 3.13
  import uu

sage: integrate(floor(x)^2,x)
// Giac share root-directory:/usr/share/giac/
// Giac share root-directory:/usr/share/giac/
Added 0 synonyms
x*floor(x)^2

-- 
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/CAGUWgD_2OPoUqzpFqvbm%3DgNJMJcC1_9Fhx5Uqz%3DdzLsuxiDbkw%40mail.gmail.com.


[sage-devel] abort() in __gmpz_realloc of symbolic expression with `gmp: overflow in mpz type`

2022-09-04 Thread Georgi Guninski
sage 9.0 on ubuntu 20.

When raising symbolic expression to large integer power
i get abort() with stack:

gmp: overflow in mpz type

/lib/x86_64-linux-gnu/libc.so.6(abort+0x12b)[0x7f26d1c7a859]
/lib/x86_64-linux-gnu/libgmp.so.10(__gmpz_realloc+0xad)[0x7f26d048edcd]
/lib/x86_64-linux-gnu/libgmp.so.10(__gmpz_n_pow_ui+0x7e7)[0x7f26d048ba97]
/lib/x86_64-linux-gnu/libpynac.so.18(_ZNK5GiNaC7numeric5powerEl+0x114)[0x7f26683b1c14]

The non-minimal testcase
===
def binnk3u(n,k):  return ( (n/k)**(k))
n1=(2*10**3);d0=29004853178239;n0=SR(log(n1));tt=binnk3u(n0+d0-1,(d0))
print("passed :(")
===

on sagecell i get no output, just an animated rotating circle.

if possible please don't regress the following, which works:

sage: log(pi)**(2**80)
log(pi)^1208925819614629174706176

-- 
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/CAGUWgD_Un568rw_RfAUmS3YaGiwV4sGh49oVsUkGEC3gvbV1rA%40mail.gmail.com.


Re: [sage-devel] Graph([(0,'a')]).vertices() raises exception

2022-08-19 Thread Georgi Guninski
On Wed, Jul 13, 2022 at 5:46 PM John H Palmieri  wrote:
>
> "Fix your old code" could just mean using `vertices(sort=False)`. See also 
> https://trac.sagemath.org/ticket/22349.
>

fixing the sort() appears easy:

>>> li=['a',0]
>>> li.sort(key=hash);li
[0, 'a']

-- 
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/CAGUWgD8QGrV69nW5stapeF-NUoeyhNcweGQ%3D5Bh7FHPCsNyvpg%40mail.gmail.com.


[sage-devel] Graph([(0,'a')]).vertices() raises exception

2022-07-13 Thread Georgi Guninski
hi sage developers :)
long time no see.

i think the migration python2 to python3 regressed a lot
of Graph() stuff related to ordering the vertices.

Here is test case from sagecell:

===
g1=Graph([(0,'a')])
g2=g1.copy()
g2.relabel()
g2.vertices()
g1.vertices()

TypeError: '<' not supported between instances of 'int' and 'str'
===

-- 
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/CAGUWgD-KgJS9CnNCJPun0TcQjbi6Y2RBS8JLYpca%3D1oPjLpi4w%40mail.gmail.com.