Re: [sage-support] Size reduced of a basis

2021-04-20 Thread Santanu Sarkar
Hi Martin,
Thank you so much for your kind help. It works!

Kind regards,
Santanu

On Mon, 22 Mar 2021 at 19:49, 'Martin R. Albrecht' via sage-support <
sage-support@googlegroups.com> wrote:

> Hi Santanu,
>
> With very high precision it goes through:
>
> #+begin_src jupyter-python :kernel sagemath
> A = random_matrix(ZZ, 10, 10, x=-2^500, y=2^500)
> A.echelonize() # make it interesting by turning into HNF
>
> from fpylll import FPLLL, IntegerMatrix, GSO, LLL
> B = IntegerMatrix.from_matrix(A)
> FPLLL.set_precision(2) # 2 bits of precision!
> M = GSO.Mat(B, float_type="mpfr")
> M.update_gso()
> L = LLL.Reduction(M)
> L.size_reduction()
> C = B.to_matrix(matrix(ZZ, 10, 10)) # back to Sage's format
> #+end_src
>
> HNF is pretty bad for precision, so it’s an extreme example.
>
> Cheers,
> Martin
>
>
> Santanu Sarkar  writes:
> > Hi Martin,
> >Thanks a lot. For entries upto 500 bits, it works fine.
> > But for large entries, I am getting error.
> > A = random_matrix(ZZ, 10, 10, x=-2^550, y=2^550)
> > File "abc.sage.py", line 28, in 
> > L.size_reduction()
> >   File "src/fpylll/fplll/lll.pyx", line 379, in
> > fpylll.fplll.lll.LLLReduction.size_reduction
> > fpylll.util.ReductionError: b'success'
> >
> > Kind regards,
> > Santanu
> >
> >
> > On Wed, 17 Mar 2021 at 15:47, 'Martin R. Albrecht' via sage-support <
> > sage-support@googlegroups.com> wrote:
> >
> >> Hi there,
> >>
> >> You can do it by calling down to FPyLLL which (together with NTL) powers
> >> lattice reduction in Sage. Here’s an example:
> >>
> >> #+begin_src jupyter-python :kernel sagemath
> >> A = random_matrix(ZZ, 10, 10, x=-1, y=2)
> >> A.echelonize() # make it interesting by turning into HNF
> >> print("# Input")
> >> print(A)
> >> print()
> >>
> >> from fpylll import IntegerMatrix, GSO, LLL
> >> B = IntegerMatrix.from_matrix(A)
> >> M = GSO.Mat(B)
> >> M.update_gso()
> >> L = LLL.Reduction(M)
> >> L.size_reduction()
> >> C = B.to_matrix(matrix(ZZ, 10, 10)) # back to Sage's format
> >>
> >> print("# Output")
> >> print(C)
> >> print()
> >> #+end_src
> >>
> >> #+RESULTS:
> >> #+begin_example
> >> # Input
> >> [  1   0   0   0   0   0   0   0   0  41]
> >> [  0   1   0   0   0   0   0   0   0  34]
> >> [  0   0   1   0   0   0   0   0   1  27]
> >> [  0   0   0   1   0   0   0   0   1  96]
> >> [  0   0   0   0   1   0   0   0   0  38]
> >> [  0   0   0   0   0   1   0   0   1  78]
> >> [  0   0   0   0   0   0   1   0   1   1]
> >> [  0   0   0   0   0   0   0   1   1  91]
> >> [  0   0   0   0   0   0   0   0   2  69]
> >> [  0   0   0   0   0   0   0   0   0 100]
> >>
> >> # Output
> >> [  1   0   0   0   0   0   0   0   0  41]
> >> [ -1   1   0   0   0   0   0   0   0  -7]
> >> [ -1   0   1   0   0   0   0   0   1 -14]
> >> [ -1  -1  -1   1   0   0   0   0   0  -6]
> >> [ -1   0   0   0   1   0   0   0   0  -3]
> >> [  0   0   0  -1   0   1   0   0   0 -18]
> >> [  0   0   0   0   0   0   1   0   1   1]
> >> [  0   0   0  -1   0   0   0   1   0  -5]
> >> [  1   0   0  -1   0   0   0   0   1  14]
> >> [  0   0   0  -1   0   0   0   0  -1   4]
> >> #+end_example
> >>
> >>
> >> Cheers,
> >> Martin
> >>
> >> Santanu Sarkar  writes:
> >> > Dear all,
> >> >In Sagemath, is it possible to change a basis
> >> > of a lattice which is size reduced? That is my interest is only on
> >> > 1st condition of LLL basis.
> >> >
> >> >
> >> > Kind regards,
> >> > Santanu
> >>
> >>
> >> --
> >>
> >> _pgp: https://keybase.io/martinralbrecht
> >> _www: https://malb.io
> >>
> >> --
> >> You received this message because you are subscribed to the Google
> Groups
> >> "sage-support" group.
> >> To unsubscribe from this group and stop receiving emails from it, send
> an
> >> email to sage-support+unsubscr...@googlegroups.com.
> >> To view this discussion on the web visit
> >>
> https://groups.google.com/d/msgid/sage-support/871rcet773.fsf%40googlemail.com
> >> .
> >>
>
>
> --
>
> _pgp: https://keybase.io/martinralbrecht
> _www: https://malb.io
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-support/87mtuwzrbw.fsf%40googlemail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAOe8sPLNzAmFsTLRvK-GEkFcbkutV0%2BkB%3DoZYHda8i6MzZBpJA%40mail.gmail.com.


Re: [sage-support] Size reduced of a basis

2021-03-19 Thread Santanu Sarkar
Hi Martin,
   Thanks a lot. For entries upto 500 bits, it works fine.
But for large entries, I am getting error.
A = random_matrix(ZZ, 10, 10, x=-2^550, y=2^550)
File "abc.sage.py", line 28, in 
L.size_reduction()
  File "src/fpylll/fplll/lll.pyx", line 379, in
fpylll.fplll.lll.LLLReduction.size_reduction
fpylll.util.ReductionError: b'success'

Kind regards,
Santanu


On Wed, 17 Mar 2021 at 15:47, 'Martin R. Albrecht' via sage-support <
sage-support@googlegroups.com> wrote:

> Hi there,
>
> You can do it by calling down to FPyLLL which (together with NTL) powers
> lattice reduction in Sage. Here’s an example:
>
> #+begin_src jupyter-python :kernel sagemath
> A = random_matrix(ZZ, 10, 10, x=-1, y=2)
> A.echelonize() # make it interesting by turning into HNF
> print("# Input")
> print(A)
> print()
>
> from fpylll import IntegerMatrix, GSO, LLL
> B = IntegerMatrix.from_matrix(A)
> M = GSO.Mat(B)
> M.update_gso()
> L = LLL.Reduction(M)
> L.size_reduction()
> C = B.to_matrix(matrix(ZZ, 10, 10)) # back to Sage's format
>
> print("# Output")
> print(C)
> print()
> #+end_src
>
> #+RESULTS:
> #+begin_example
> # Input
> [  1   0   0   0   0   0   0   0   0  41]
> [  0   1   0   0   0   0   0   0   0  34]
> [  0   0   1   0   0   0   0   0   1  27]
> [  0   0   0   1   0   0   0   0   1  96]
> [  0   0   0   0   1   0   0   0   0  38]
> [  0   0   0   0   0   1   0   0   1  78]
> [  0   0   0   0   0   0   1   0   1   1]
> [  0   0   0   0   0   0   0   1   1  91]
> [  0   0   0   0   0   0   0   0   2  69]
> [  0   0   0   0   0   0   0   0   0 100]
>
> # Output
> [  1   0   0   0   0   0   0   0   0  41]
> [ -1   1   0   0   0   0   0   0   0  -7]
> [ -1   0   1   0   0   0   0   0   1 -14]
> [ -1  -1  -1   1   0   0   0   0   0  -6]
> [ -1   0   0   0   1   0   0   0   0  -3]
> [  0   0   0  -1   0   1   0   0   0 -18]
> [  0   0   0   0   0   0   1   0   1   1]
> [  0   0   0  -1   0   0   0   1   0  -5]
> [  1   0   0  -1   0   0   0   0   1  14]
> [  0   0   0  -1   0   0   0   0  -1   4]
> #+end_example
>
>
> Cheers,
> Martin
>
> Santanu Sarkar  writes:
> > Dear all,
> >In Sagemath, is it possible to change a basis
> > of a lattice which is size reduced? That is my interest is only on
> > 1st condition of LLL basis.
> >
> >
> > Kind regards,
> > Santanu
>
>
> --
>
> _pgp: https://keybase.io/martinralbrecht
> _www: https://malb.io
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support+unsubscr...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-support/871rcet773.fsf%40googlemail.com
> .
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAOe8sPLBQKG74Bv3OoBtVOEwXpq7-33ppHpK_Jb0aHZmRYJSAw%40mail.gmail.com.


[sage-support] Size reduced of a basis

2021-03-16 Thread Santanu Sarkar
Dear all,
   In Sagemath, is it possible to change a basis
of a lattice which is size reduced? That is my interest is only on
1st condition of LLL basis.


Kind regards,
Santanu

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAOe8sPJdfdziwmybabcU5UDXGYHmyg_5an1OzdXqQxYiqiN5jA%40mail.gmail.com.


[sage-support] Linear complexity profile of a binary sequence

2020-11-11 Thread Santanu Sarkar
Dear all,
 I have a binary sequence
{0,1,1,1,1,0,0,0,1,1,0,1,0,1,0,0,1,0,1,1,1,0,0,0,1,1,0,1,0,1}.
I want to find its Linear complexity profile using SageMath. Any idea?

Regards,
Santanu

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAOe8sPKRRWb1y3AFK20Ld9gjL4zOhapToJVZoW45ZL_Hfh1b%2Bg%40mail.gmail.com.


[sage-support] Unimodular transformation matrix of LLL algorithm

2020-09-27 Thread Santanu Sarkar
Dear all,
   I have a matrix M1 with integer entries with 90 rows and 6 columns.
After applying LLL algorithm of M1, I get M2=M1.LLL(). I want to get
corresponding unimodular transformation matrix T such that
T*M1=M2. We can find T by
T=M2*M1.pseudoinverse() or T== M1.solve_left(M2), but determinant of T
becomes 0 i.e.,  T.det()=0.
I want T.det()=1.

Best regards,
Santanu

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAOe8sPKjdEU95wO0B8P0sYxw5S15aVWX_MgL-6XX3wUUVEJ4-Q%40mail.gmail.com.


[sage-support] Reduction over Ideal

2020-08-05 Thread Santanu Sarkar
Dear all,
Consider ideal I= over the binary field GF(2).
Then (x2).reduce(I) gives x2. I want it to be x0*x1.
In fact , I want this kind of reduction always should give quadratic
polynomial
(I know that this is possible for my problems).

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAOe8sPJcWOxLLtWNCH1deD1WOa4brnoSwLeUtVeKayeNPk3S8g%40mail.gmail.com.


[sage-support] Installation problem

2020-04-21 Thread Santanu Sarkar
Dear all,
  I am trying to install Sage 9.0. But I am getting error.
I have upgraded from Ubuntu 14.04 to Ubuntu 18.04.
I am getting this:

(base) santanu@Santanu-Laptop:~/Documents/sage-9.0-Ubuntu_18.04-i686/SageMath$
make
...
.
make[1]: ***
[/home/santanu/Documents/sage-9.0-Ubuntu_18.04-i686/SageMath/local/var/lib/sage/installed/pkgconf-0.9.7.p2]
Error 1
make[1]: Leaving directory
'/home/santanu/Documents/sage-9.0-Ubuntu_18.04-i686/SageMath/build/make'

real 0m48.492s
user 0m1.040s
sys 0m0.363s
***
Error building Sage.

The following package(s) may have failed to build (not necessarily
during this run of 'make base-toolchain'):

* package: pkgconf-0.9.7.p2
  log file:
/home/santanu/Documents/sage-9.0-Ubuntu_18.04-i686/SageMath/logs/pkgs/pkgconf-0.9.7.p2.log
  build directory:
/home/santanu/Documents/sage-9.0-Ubuntu_18.04-i686/SageMath/local/var/tmp/sage/build/pkgconf-0.9.7.p2

The build directory may contain configuration files and other potentially
helpful information. WARNING: if you now run 'make' again, the build
directory will, by default, be deleted. Set the environment variable
SAGE_KEEP_BUILT_SPKGS to 'yes' to prevent this.

Makefile:31: recipe for target 'base-toolchain' failed
make: *** [base-toolchain] Error 1
(base) santanu@Santanu-Laptop
:~/Documents/sage-9.0-Ubuntu_18.04-i686/SageMath$

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAOe8sP%2BpAmEzNu2vpEyG6fpziMDjaMabQig%2BSVnG%2B2SGrOwo%2BQ%40mail.gmail.com.


[sage-support] Problem to install Cryptominisat

2020-04-19 Thread Santanu Sarkar
Hi all,
  When I am trying to install Cryptominisat, I am getting following error.

(base) santanu@Santanu-Laptop:~/Desktop/sage-8.9-Ubuntu_18.04-i686/SageMath$
./sage -i cryptominisat



***
Error building Sage.

The following package(s) may have failed to build (not necessarily
during this run of 'make all-toolchain'):

* package: pkgconf-0.9.7.p2
  log file:
/home/santanu/Desktop/sage-8.9-Ubuntu_18.04-i686/SageMath/logs/pkgs/pkgconf-0.9.7.p2.log
  build directory:
/home/santanu/Desktop/sage-8.9-Ubuntu_18.04-i686/SageMath/local/var/tmp/sage/build/pkgconf-0.9.7.p2

The build directory may contain configuration files and other potentially
helpful information. WARNING: if you now run 'make' again, the build
directory will, by default, be deleted. Set the environment variable
SAGE_KEEP_BUILT_SPKGS to 'yes' to prevent this.

Makefile:31: recipe for target 'all-toolchain' failed
make: *** [all-toolchain] Error 1




But I have installed pkgconf.


(base) santanu@Santanu-Laptop:~$ sudo apt-get install pkgconf
Reading package lists... Done
Building dependency tree
Reading state information... Done
pkgconf is already the newest version (0.9.12-6).
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.
(base) santanu@Santanu-Laptop:~$

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAOe8sPJUUV_kiUXcic3zi5jact_LQWo%3DAqCwx-Lk0CP%3DoOnCzg%40mail.gmail.com.


[sage-support] LLL algorithm in infinity norm

2019-11-01 Thread Santanu Sarkar
Dear all,
  I want run LLL algorithm in infinity norm (max norm). Is it
possible in Sage? My lattice is generated by row vectors
of a square matrix.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAOe8sPK62RGd%3DP03PPZmHvuTFM9E5w6cACcxERc4TRTjpg8ADA%40mail.gmail.com.


[sage-support] Solve inequality in Sage

2019-10-20 Thread Santanu Sarkar
Hi,
 I have inequalities like these:

3 x1 + 5 x2 + 2 x3 + 5 x4 + 7 x5 <= 28
 2 x1 + 0 x2 + 0 x3 + 8 x4 <= 14
 4 x4 + 5 x5 <= 22
 3 x2 <= 2
 3 x4  >= 1

I want to get a  solution. Values of x's are either 0 or 1.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAOe8sPLL%3DwyaGMVQPzCfAG9LX%3D1tjcRxrbc9w3LB8rt9T_SWhQ%40mail.gmail.com.


Re: [sage-support] Re: How to find one element of residue field as a vector over base field

2019-05-15 Thread Santanu Sarkar
On Wed, 15 May 2019 at 17:03, Kwankyu  wrote:

> Hi Chandra,
>
> What is Place (x^2 + x + 1, x*y + 1)? Is it ideal generated by
>>
>> (x^2 + x + 1, x*y + 1).
>>
>>
> No. Place (x^2 + x + 1, x*y + 1) is the unique place of the function field
>
> at which both functions x^2 + x +1, x*y + 1 vanish.
>
> Thank you for your response. We know that a place is the unique maximal
ideal of a local (valuation) ring obtained from the valuation map, which is
well known to be a principle ideal.
 So, there will be a single generator for a place. But here it is
represented by two polynomials. We didn't get what it means. Can we find
the corresponding valuation ring, valuation map
ant the generator for the place?


>
>
>> What is the value of $\frac{xy}{(x^2 + x + 1) } +
>>
>> \frac{1}{x^2 + x + 1}+$ Place $(x^2 + x + 1, x y + 1)$?
>>
>>
> You cannot add an element of the function field with a place.
>
Actually by this we meant the element modulo the place ( a maximum ideal).


>
>
>> It is an element of residue field which is isomorphic to
>>
>> $\mathbb{F}_{2^2}$. Since $\mathbb{F}_{2^2}$ is isomorphic
>> to $\mathbb{F}^2_{2}$ as a vector space,
>>
>> I want value in $\mathbb{F}^2_{2}$.
>>
>>
> vector(a)
>
> or you can use the maps returned by
>
> k.vector_space(map=True)
>
> if k is the residue field.
>
>
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-support.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-support/813396b6-b7ae-452d-9b30-c73003262155%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAOe8sPLhyMm3HFxUx42_N2goGF_FHnv%2BUuAEPvdbX%2Bs3h2ySbg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Function Field

2019-05-13 Thread Santanu Sarkar
Hi,
  Sorry. This is not working:

K. = FunctionField(GF(2))
R. = K[]
f=y^2 + 1 + 1/x
L. = K.extension(f)
print L.places(1)

I am using https://sagecell.sagemath.org/

On Mon, 13 May 2019 at 16:48, Vincent Delecroix <20100.delecr...@gmail.com>
wrote:

> Hello,
>
> It works for me and I obtain
>
> [Place (1/x, y), Place (1/x, y + 1), Place (x, x*y)]
>
> Could you describe the SageMath version you are using?
>
> Vincent
>
> Le 13/05/2019 à 10:10, Santanu Sarkar a écrit :
> > Hi,
> >This code works well.
> >
> > K. = FunctionField(GF(2))
> > R. = K[]
> > f=y^2 + y + 1/x
> > L. = K.extension(f)
> > print L.places(1)
> >
> >
> > But if I take f=y^2 + y + 1/x, it is giving error.
> >
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-support.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-support/e8d3d937-7dd5-0e51-1f8e-e9c310aaa74c%40gmail.com
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAOe8sPLZ78QwoK55xhx5431x1pDOtOtiGB_YzMy9jG8TLBb4Mg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Function Field

2019-05-13 Thread Santanu Sarkar
Hi,
  This code works well.

K. = FunctionField(GF(2))
R. = K[]
f=y^2 + y + 1/x
L. = K.extension(f)
print L.places(1)


But if I take f=y^2 + y + 1/x, it is giving error.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAOe8sPLT-%2BHx3we%2BMimrV0qm-b2g5NZFnZcnHX-BEKb_rFTSvw%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: How to define variables over integer

2019-05-09 Thread Santanu Sarkar
Dear friends,
   Thank you so much for your help. It is working now.

Regards,
Santanu

On Thu, 9 May 2019 at 15:19, Simon King  wrote:

> Hi Santanu,
>
> Am Mittwoch, 8. Mai 2019 15:15:06 UTC+2 schrieb Santanu:
>>
>> I know how to define variables over BooleanPolynomialRing.
>> This is as follows.
>>
>> n=4
>> V=BooleanPolynomialRing(n+1,['z%d'%(i) for i in range(n+1)] )
>> V.inject_variables()
>>
>
> The above is what you could do *in an interactive session* in the case
> that the number of variables isn't known in advance. If it is known that
> you have exactly four variables, simply do
>sage: V. = BooleanPolynomialRing()
> which would automatically define z0,...,z3 in the global namespace.
>
> Similarly, you can do
>sage: V. = ZZ[]
> to create a polynomial ring over the integers with generators z0,...,z3
>
> But the above is not what you could do *in a python module* and in a
> module it is also a bad idea to inject variables.
>
> So, simply put the variables in a list or access them by methods of V.
>
>
>> Can we define similar code over integers (ZZ) or rationals (QQ)?
>>
>
> Actually I wonder if we mean the same when we say "variables over ZZ". I
> mean "generators of a polynomial ring with integer coefficients". When the
> number of generators isn't known in advance, but the generators are named
> z0,z1,z2,..., such ring can be created, e.g., by
> sage: P = PolynomialRing(ZZ, 'z', 5)
> sage: P
> Multivariate Polynomial Ring in z0, z1, z2, z3, z4 over Integer Ring
>
> However, I could imagine that you wanted to ask how to create a symbolic
> variable that is assumed to take values in ZZ --- and that's totally
> different from a generator of a polynomial ring over ZZ. So, if that's what
> you mean, you could do (in an interactive session)
>
> sage: var('z0 z1 z2 z3', domain='integer')
> (which would inject the variables into the global namespace) or
> Z = var('z0 z1 z2 z3', domain='integer')
> (which would also work in a python module and puts the variables into a
> tuple).
>
> Also I want to store variables in an array like Z=[z0,z1,z2,z3]
>> but it should be automatic. I will change only n.
>>
>
> If you really want to work with symbolic variables, you could do
> sage: n = 5
> sage: Z = var(['z{}'.format(i) for i in range(n)], domain='integer')
> sage: Z
> (z0, z1, z2, z3, z4)
> sage: z0
> z0
> (thus, the variables are both put in a tuple and injected into the global
> name space.
>
> However, I believe that very many Sage users work with symbolic variables
> when they should better use generators of polynomial rings. So, perhaps
> code such as the following
> sage: P = PolynomialRing(ZZ, 'z', n)
> sage: Z = P.gens()
> sage: Z
> (z0, z1, z2, z3, z4)
> sage: P.gen(0)
> z0
> sage: P.inject_variables()
> Defining z0, z1, z2, z3, z4
> (the latter only in an interactive session) suites your needs better.
>
> Best regards,
> Simon
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-support.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/sage-support/d7d49151-5dc8-445c-b0dc-e494eb558965%40googlegroups.com
> 
> .
> For more options, visit https://groups.google.com/d/optout.
>

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAOe8sPJhKPX4jYZUPAJnjNjkGvMtj4TNCpPkcBD9zg0vo1k4ng%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


[sage-support] How to define variables over integer

2019-05-08 Thread Santanu Sarkar
I know how to define variables over BooleanPolynomialRing.
This is as follows.

n=4
V=BooleanPolynomialRing(n+1,['z%d'%(i) for i in range(n+1)] )
V.inject_variables()

Can we define similar code over integers (ZZ) or rationals (QQ)?
Also I want to store variables in an array like Z=[z0,z1,z2,z3]
but it should be automatic. I will change only n.

-- 
You received this message because you are subscribed to the Google Groups 
"sage-support" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sage-support+unsubscr...@googlegroups.com.
To post to this group, send email to sage-support@googlegroups.com.
Visit this group at https://groups.google.com/group/sage-support.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sage-support/CAOe8sPKEKd0DEWaz-4fWpu5MemssWHUtrNJwaLOS_dCvTkTUXg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.


Re: [sage-support] Re: How to find solution

2017-10-18 Thread Santanu Sarkar
Dear Simon,
Thank you so much.

Regards,
Santanu

On 15 October 2017 at 13:30, Simon King  wrote:

> On 2017-10-14, Simon King  wrote:
> > First, define a variable `a`. I don't know if one really needs
> > to declare its domain to solve the problem, but when one does,
> > the computation works:
>
> One doesn't need to. var('a') is just fine.
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.
>

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


[sage-support] How to find solution

2017-10-14 Thread Santanu Sarkar
In Sage, is it possible to find a such that

 \int_{a}^{\infty} e^(-x^2/2) dx=2^(-20)

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


Re: [sage-support] Re: Division in non-Integral domain

2017-02-27 Thread Santanu Sarkar
Dear Simon,
   Thank you very much for your help.

Regards,
Santanu

On 26 February 2017 at 00:03, Simon King <simon.k...@uni-jena.de> wrote:

> Hi Santanu,
>
> I am sorry that your question was unanswered for so long.
>
> On 2017-02-24, Santanu Sarkar <sarkar.santanu@gmail.com> wrote:
> > How to check  $x+4 \in <1+x+x^2+2x^3>$ in the ring $\mathbb{Z}_8[x]$,
> where
> ><1+x+x^2+2x^3> is the ideal generated by 1+x+x^2+2x^3?
> > If yes, how to find $g(x)$ so that $g(x) (1+x+x^2+2x^3)=x+4$?
>
> Here, Singular (or libsingular) can help. Singular provides the method
> "lift". You are working in ZZ/8[x], which is a quotient of ZZ[x]. Hence,
> your relation ideal has the two generators 1+x+x^2+2x^3 and 8.
>
> A slight complication: The default implementation of ZZ[x] does not use
> Singular. Hence, below I implicitly force using singular by defining a
> *multivariate* polynomial ring over ZZ:
>   sage: R.<x,y> = ZZ[]
>   sage: I = [1+x+x^2+2*x^3, 8]*R
>
> And then you can check containment in a straight forward way:
>   sage: 6*x^2 + 6*x + 2 in I
>   True
>   sage: x+4 in I
>   False
>
> So, it should be possible to express 6*x^2+6*x+2 in terms of 8 and
> 1+x+x^2+2*x^3. Indeed, using Singular's lift, we obtain this:
>   sage: from sage.libs.singular.function import singular_function
>   sage: lift = singular_function('lift')
>   sage: L = lift(I, 6*x^2 + 6*x + 2); L
>   [24*x^2 - 12*x - 6]
>   [ -6*x^5 + 3*x + 1]
>   sage: L[0]*I.0+L[1]*I.1
>   (6*x^2 + 6*x + 2)
>   sage: lift(I, x+4)
>   Traceback (most recent call last):
>   ...
>   RuntimeError: error in Singular function call 'lift':
>   2nd module does not lie in the first
>
> Best regards,
> Simon
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.
>

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


[sage-support] Division in non-Integral domain

2017-02-23 Thread Santanu Sarkar
Hi,

How to check  $x+4 \in <1+x+x^2+2x^3>$ in the ring $\mathbb{Z}_8[x]$, where
<1+x+x^2+2x^3> is the ideal generated by 1+x+x^2+2x^3?
If yes, how to find $g(x)$ so that $g(x) (1+x+x^2+2x^3)=x+4$?

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


Re: [sage-support] Re: Lattice reduction over polynomial lattice

2017-02-23 Thread Santanu Sarkar
Dear all,
   Thanks a lot for your kind help.

On 22 February 2017 at 13:49, Johan S. R. Nielsen 
wrote:

> Indeed, Sage has row_reduced_form for a polynomial matrix. The row reduced
> form is sufficient to find a vector in the row space which has minimal
> degree.
>
> The method used to be called weak_popov_form, but that form is slightly
> stronger and the algorithm does not compute it. Hence the warning.
>
> The current implementation is very slow. The next beta release of Sage
> should feature #21024 which introduces an implementation of the
> Mulders-Storjohann algorithm, which computes the weak Popov form, and does
> so much faster than the current row_reduced_form (hence, row_reduced_form
> will, in the future, actually call weak_popov_form). If you are impatient,
> you can checkout that ticket and recompile Sage to get the new
> implementation right away.
>
> Best,
> Johan
>
> --
> You received this message because you are subscribed to the Google Groups
> "sage-support" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to sage-support+unsubscr...@googlegroups.com.
> To post to this group, send email to sage-support@googlegroups.com.
> Visit this group at https://groups.google.com/group/sage-support.
> For more options, visit https://groups.google.com/d/optout.
>

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


[sage-support] Re: Lattice reduction over polynomial lattice

2017-02-20 Thread Santanu Sarkar
Dear all,
  I am searching lattice reduction for polynomial matrices in Sage.
Kindly help me.

T. Mulders and A. Storjohann. On lattice reduction for polynomial matrices.
Journal of Symbolic Computation, 35(4):377 – 401, 2003



On 20 February 2017 at 21:19, Santanu Sarkar <sarkar.santanu@gmail.com>
wrote:

> Dear all,
>I have polynomial lattice over a finite field. So each component of the
> vectors v_1, v_2, v_3 are polynomials over a finite field say F_11. Hence
> v_1=(f_1(x), f_2(x), f_3(x)),  v_2=(g_1(x), g_2(x), g_3(x)) and
> v_3=(h_1(x), h_2(x), h_3(x)). Here norm is the maximum degree of each
>  component. Does there exist LLL algorithm for this lattice in Sage?
>
>
>

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


[sage-support] Lattice reduction over polynomial lattice

2017-02-20 Thread Santanu Sarkar
Dear all,
   I have polynomial lattice over a finite field. So each component of the
vectors v_1, v_2, v_3 are polynomials over a finite field say F_11. Hence
v_1=(f_1(x), f_2(x), f_3(x)),  v_2=(g_1(x), g_2(x), g_3(x)) and
v_3=(h_1(x), h_2(x), h_3(x)). Here norm is the maximum degree of each
 component. Does there exist LLL algorithm for this lattice in Sage?

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


[sage-support] Sage Crash Report

2017-01-12 Thread Santanu Sarkar
I am getting these. Please help me.


santanu@Math-Sans:~/SageMath$ ./sage
┌┐
│ SageMath Version 7.1, Release Date: 2016-03-20 │
│ Type "notebook()" for the browser-based notebook interface.│
│ Type "help()" for help.│
└┘

**

Oops, Sage crashed. We do our best to make it stable, but...

A crash report was automatically generated with the following information:
  - A verbatim copy of the crash traceback.
  - A copy of your input history during this session.
  - Data on your current Sage configuration.

It was left in the file named:
'/home/santanu/.sage/ipython_genutils-0.1.0/Sage_crash_report.txt'
If you can email this file to the developers, the information in it will
help
them in understanding and correcting the problem.

You can mail it to: sage-support at sage-support@googlegroups.com
with the subject 'Sage Crash Report'.

If you want to do it now, the following command will work (under Unix):
mail -s 'Sage Crash Report' sage-support@googlegroups.com <
/home/santanu/.sage/ipython_genutils-0.1.0/Sage_crash_report.txt

To ensure accurate tracking of this issue, please file a report about it at:
http://trac.sagemath.org

Hit  to quit (your terminal may close):

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

IPython post-mortem report

{'commit_hash': u'7f50c6b',
 'commit_source': 'installation',
 'default_encoding': 'UTF-8',
 'ipython_path': 
'/home/santanu/SageMath/local/lib/python2.7/site-packages/IPython',
 'ipython_version': '4.1.2',
 'os_name': 'posix',
 'platform': 'Linux-4.4.0-57-generic-x86_64-with-debian-stretch-sid',
 'sys_executable': '/home/santanu/SageMath/local/bin/python',
 'sys_platform': 'linux2',
 'sys_version': '2.7.10 (default, Mar 22 2016, 03:28:40) \n[GCC 4.9.3]'}

***



***

Crash traceback:

---
---
ImportError  Python 2.7.10: /home/santanu/SageMath/local/bin/python
   Thu Jan 12 21:05:08 2017
A problem occurred executing Python code.  Here is the sequence of function
calls leading up to the error, with the most recent (innermost) call last.
/home/santanu/SageMath/src/bin/sage-ipython in ()
  1 #!/usr/bin/env python
  2 # -*- coding: utf-8 -*-
  3 """
  4 Sage IPython startup script.
  5 """
  6 
  7 # Install extra readline commands before IPython initialization
  8 from sage.repl.readline_extra_commands import *
  9 
 10 from sage.repl.interpreter import SageTerminalApp
 11 
 12 app = SageTerminalApp.instance()
---> 13 app.initialize()
global app.initialize = >
 14 app.start()

 in initialize(self=, argv=None)

/home/santanu/SageMath/local/lib/python2.7/site-packages/traitlets/config/application.pyc
 in catch_config_error(method=, 
app=, *args=(None,), **kwargs={})
 59 
 60 
#-
 61 # Application class
 62 
#-
 63 
 64 @decorator
 65 def catch_config_error(method, app, *args, **kwargs):
 66 """Method decorator for catching invalid config 
(Trait/ArgumentErrors) during init.
 67 
 68 On a TraitError (generally caused by bad config), this will print 
the trait's
 69 message, and exit the app.
 70 
 71 For use on init methods, to prevent invoking excepthook on invalid 
input.
 72 """
 73 try:
---> 74 return method(app, *args, **kwargs)
method = 
app = 
args = (None,)
kwargs = {}
 75 except (TraitError, ArgumentError) as e:
 76 app.print_help()
 77 app.log.fatal("Bad config encountered during initialization:")
 78 app.log.fatal(str(e))
 79 app.log.debug("Config at the time: %s", app.config)
 80 app.exit(1)
 81 
 82 
 83 class ApplicationError(Exception):
 84 pass
 85 
 86 
 87 class 

[sage-support] Save 3D plot

2015-08-29 Thread Santanu Sarkar
How to save 3D plot in eps format?

L=line3d([( 3 , 2 , 1 ), ( 4 , 3 , 2 )],color='red')

L=list_plot3d([[ 3 , 2 , 1 ], [ 4 , 3 , 2 ]],color='red')

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


[sage-support] Interpolation in Sage

2015-07-22 Thread Santanu Sarkar
Hello,
   I want to find a polynomial f(x_1,x_2,x_3,x_4) explicitly
by interpolation. I know that the degree of f is 2. I have enough data
points.  How can I do this in Sage?

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


[sage-support] Array

2015-02-26 Thread Santanu Sarkar
Dear all,

  How to define 3D array like in C language
double A[10][10][10];

For 1D array I use  A=[0]*10 and for 2D array
I use matrix A=matrix(RR,10,10, range(10*10)) in Sage


Best,
Santanu

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


[sage-support] Find real root

2015-01-09 Thread Santanu Sarkar
Dear all,

I have one polynomial
f_x(y) =y^3 +f_1(x) y^2 +f_2(x) y + f_3(x).

Since it is a cubic polynomial, it has atleast
one real root.
I want to find that real root  as a function of x.
I know that x \in [a,b].

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


Re: [sage-support] Re: Coefficient of Boolean Polynomial

2014-11-18 Thread Santanu Sarkar
Thank you so much.

On 18 November 2014 00:02, slelievre samuel.lelie...@gmail.com wrote:

 Santanu wrote:


 R.v1, v2, v3=BooleanPolynomialRing(3)
 f=v1*v2+v1*v3+v1
 print f.coefficient(v1)

 I am getting

 Traceback (click to the left of this block for traceback)
 ...
 AttributeError: 'sage.rings.polynomial.pbori.BooleanPolynomial' object
 has no attribute 'coefficient'

 Answer should be v2+v3+1. I do not want

 to use R.v1, v2, v3=GF(2)[] as in this

 ring  operations are much slower than
 R.v1, v2, v3=BooleanPolynomialRing(3).


 Here v1 divides f so you could do

 sage: sum(m/v1 for m in f.monomials())

 Without that assumption you could do

 sage: sum(m/v1 for m in (f-f(v1=0)).monomials())

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


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


[sage-support] Coefficient of Boolean Polynomial

2014-11-17 Thread Santanu Sarkar
In my Sage code,

R.v1, v2, v3=BooleanPolynomialRing(3)
f=v1*v2+v1*v3+v1
print f.coefficient(v1)

I am getting

Traceback (click to the left of this block for traceback)
...
AttributeError: 'sage.rings.polynomial.pbori.BooleanPolynomial' object
has no attribute 'coefficient'

Answer should be v2+v3+1. I do not want

to use R.v1, v2, v3=GF(2)[] as in this

ring  operations are much slower than
R.v1, v2, v3=BooleanPolynomialRing(3).

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


Re: [sage-support] How to handle file in Sage

2014-10-28 Thread Santanu Sarkar
Thank you so much.

On 28 October 2014 02:00, William Stein wst...@gmail.com wrote:

 On Mon, Oct 27, 2014 at 1:24 PM, slelievre samuel.lelie...@gmail.com
 wrote:
  'load' is expecting filenames with extension among
 
   .py, .sage, .sobj
 
  and maybe a few others.
 
  If the file name does not have an extension in that short list,
  'load' will add the extension .sobj.
 

 Yes, use Python's builtin open command:

   A1 = open(./Documents/program21.txt).read()

 
  Le lundi 27 octobre 2014 15:12:17 UTC+1, Santanu a écrit :
 
  Thanks a lot. But I am getting these errors:
 
  A1=load(./Documents/program21.txt)
 
 
  Traceback (most recent call last):
File stdin, line 1, in module
File _sage_input_4.py, line 10, in module
  exec compile(u'open(___code___.py,w).write(# -*- coding: utf-8
  -*-\\n +
 
 _support_.preparse_worksheet_cell(base64.b64decode(QTE9bG9hZCgiLi9Eb2N1bWVudHMvcHJvZ3JhbTIxLnR4dCIp),globals())+\\n);
  execfile(os.path.abspath(___code___.py))
File , line 1, in module
 
File /tmp/tmpYQU78_/___code___.py, line 2, in module
  exec compile(u'A1=load(./Documents/program21.txt)
File , line 1, in module
 
File sage_object.pyx, line 862, in sage.structure.sage_object.load
  (sage/structure/sage_object.c:9317)
  IOError: [Errno 2] No such file or directory:
  './Documents/program21.txt.sobj'
 
 
 
 
 --
 
 
  exec preparse(open('/Documents/program21.txt').read())
 
 
  Traceback (most recent call last):
File stdin, line 1, in module
File _sage_input_5.py, line 10, in module
  exec compile(u'open(___code___.py,w).write(# -*- coding: utf-8
  -*-\\n +
 
 _support_.preparse_worksheet_cell(base64.b64decode(ZXhlYyBwcmVwYXJzZShvcGVuKCcvRG9jdW1lbnRzL3Byb2dyYW0yMS50eHQnKS5yZWFkKCkp),globals())+\\n);
  execfile(os.path.abspath(___code___.py))
File , line 1, in module
 
File /tmp/tmpqrNaPI/___code___.py, line 2, in module
  exec compile(uexec
 preparse(open('/Documents/program21.txt').read())
  + '\n', '', 'single')
File , line 1, in module
 
  IOError: [Errno 2] No such file or directory: '/Documents/program21.txt'
 
 
  On 22 October 2014 05:56, William Stein wst...@gmail.com wrote:
 
  On Tue, Oct 21, 2014 at 5:19 PM, kcrisman kcri...@gmail.com wrote:
differently)
  
   Thanks - I meant %runfile not %execfile.  I find it hard to
 remember,
   which is yet another reason I am against removal of the more
 memorable
   %load
   that we had for years.
  
   
  
  
   Agreed, but this was semi-unavoidable because of the Ipython upgrade
 a
   while
   back, though, right?
 
  It was definitely not unavoidable.
 
  -- William
 
  
   --
   You received this message because you are subscribed to the Google
   Groups
   sage-support group.
   To unsubscribe from this group and stop receiving emails from it,
 send
   an
   email to sage-support...@googlegroups.com.
   To post to this group, send email to sage-s...@googlegroups.com.
   Visit this group at http://groups.google.com/group/sage-support.
   For more options, visit https://groups.google.com/d/optout.
 
 
 
  --
  William Stein
  Professor of Mathematics
  University of Washington
  http://wstein.org
 
  --
  You received this message because you are subscribed to the Google
 Groups
  sage-support group.
  To unsubscribe from this group and stop receiving emails from it, send
 an
  email to sage-support...@googlegroups.com.
  To post to this group, send email to sage-s...@googlegroups.com.
  Visit this group at http://groups.google.com/group/sage-support.
  For more options, visit https://groups.google.com/d/optout.
 
 
  --
  You received this message because you are subscribed to the Google Groups
  sage-support group.
  To unsubscribe from this group and stop receiving emails from it, send an
  email to sage-support+unsubscr...@googlegroups.com.
  To post to this group, send email to sage-support@googlegroups.com.
  Visit this group at http://groups.google.com/group/sage-support.
  For more options, visit https://groups.google.com/d/optout.



 --
 William Stein
 Professor of Mathematics
 University of Washington
 http://wstein.org

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


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

Re: [sage-support] How to handle file in Sage

2014-10-27 Thread Santanu Sarkar
Thanks a lot. But I am getting these errors:

A1=load(./Documents/program21.txt)


Traceback (most recent call last):
  File stdin, line 1, in module
  File _sage_input_4.py, line 10, in module
exec compile(u'open(___code___.py,w).write(# -*- coding: utf-8
-*-\\n +
_support_.preparse_worksheet_cell(base64.b64decode(QTE9bG9hZCgiLi9Eb2N1bWVudHMvcHJvZ3JhbTIxLnR4dCIp),globals())+\\n);
execfile(os.path.abspath(___code___.py))
  File , line 1, in module

  File /tmp/tmpYQU78_/___code___.py, line 2, in module
exec compile(u'A1=load(./Documents/program21.txt)
  File , line 1, in module

  File sage_object.pyx, line 862, in sage.structure.sage_object.load
(sage/structure/sage_object.c:9317)
IOError: [Errno 2] No such file or directory:
'./Documents/program21.txt.sobj'



--


exec preparse(open('/Documents/program21.txt').read())


Traceback (most recent call last):
  File stdin, line 1, in module
  File _sage_input_5.py, line 10, in module
exec compile(u'open(___code___.py,w).write(# -*- coding: utf-8
-*-\\n +
_support_.preparse_worksheet_cell(base64.b64decode(ZXhlYyBwcmVwYXJzZShvcGVuKCcvRG9jdW1lbnRzL3Byb2dyYW0yMS50eHQnKS5yZWFkKCkp),globals())+\\n);
execfile(os.path.abspath(___code___.py))
  File , line 1, in module

  File /tmp/tmpqrNaPI/___code___.py, line 2, in module
exec compile(uexec preparse(open('/Documents/program21.txt').read())
+ '\n', '', 'single')
  File , line 1, in module

IOError: [Errno 2] No such file or directory: '/Documents/program21.txt'


On 22 October 2014 05:56, William Stein wst...@gmail.com wrote:

 On Tue, Oct 21, 2014 at 5:19 PM, kcrisman kcris...@gmail.com wrote:
   differently)
 
  Thanks - I meant %runfile not %execfile.  I find it hard to remember,
  which is yet another reason I am against removal of the more memorable
 %load
  that we had for years.
 
  
 
 
  Agreed, but this was semi-unavoidable because of the Ipython upgrade a
 while
  back, though, right?

 It was definitely not unavoidable.

 -- William

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



 --
 William Stein
 Professor of Mathematics
 University of Washington
 http://wstein.org

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


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


Re: [sage-support] Re: How to extract value from array

2014-02-23 Thread Santanu Sarkar
Yes, this was the question.
Thanks a lot for detailed explanation.


On 23 February 2014 15:41, Dominique Laurain
dominique.laurai...@orange.frwrote:

 type() is one very helpful function in SAGE to know about data kinds

 print type(T)

 returns

 type 'list'


 so T is not strictly an array  but a list.
 your knowledge is mixing with other programming languages where [ and ]
 are special characters to get one element of an array.
 (some computer men will say to you: it's same, only difference, is list as
 no defined maximum number of elements)

 to get first element of this list in SAGE : use  T[0]

 print T[0]

 returns
 t == 1

 you can ask: what is it ? answer: simply first element of list:   an
 equation

 next question: how can I get t ? answer: get the left hand part of
 equation: T[0].left()

 print T[0].left()

 returns
 t

 next question: how to assign x with t ? answer: not assignement of
 value but substitution

 x = T[0].left() ; print x

 returns
 x

 next question: which value has x ?

 print x

 returns
 t

 Argh...I don't want this, but I want x has the same value than t ? answer:
 t has NO value, because t == 1, is not an assignment but an equation

 x = T[0].right()

 print x

 returns
 1

 OK..now x has value 1, and no relation anymore with t.


 To be 1 or not to be 1, was it the question ?


 On Sunday, 23 February 2014 05:39:54 UTC+1, Santanu wrote:

 Following code  I want to assign a value.


 var('a,t,x')
 T=[t==1, a==2]

 Now I want to make x=t which is 1 in this case.
 That is x will be 1.




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


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


[sage-support] How to extract value from array

2014-02-22 Thread Santanu Sarkar
Following code  I want to assign a value.


var('a,t,x')
T=[t==1, a==2]

Now I want to make x=t which is 1 in this case.
That is x will be 1.

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


[sage-support] Error

2014-01-01 Thread Santanu Sarkar
Suddenly I get the following error.


sage: notebook()
---
UnpicklingError   Traceback (most recent call last)
ipython-input-1-3728cb3d7c7d in module()
 1 notebook()

/home/drsantanu/Downloads/sage-5.13-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/devel/sagenb/sagenb/notebook/notebook_object.pyc
in __call__(self, *args, **kwds)
226 
227 def __call__(self, *args, **kwds):
-- 228 return self.notebook(*args, **kwds)
229
230 notebook = run_notebook.notebook_run

/home/drsantanu/Downloads/sage-5.13-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/devel/sagenb/sagenb/notebook/run_notebook.pyc
in notebook_run(self, directory, port, interface, port_tries, secure,
reset, accounts, openid, server_pool, ulimit, timeout, doc_timeout, upload,
automatic_login, start_path, fork, quiet, server, profile, subnets,
require_login, open_viewer, address)
527 # if none use defaults
528
-- 529 nb = notebook.load_notebook(directory)
530
531 directory = nb._dir

/home/drsantanu/Downloads/sage-5.13-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/devel/sagenb/sagenb/notebook/notebook.pyc
in load_notebook(dir, interface, port, secure, user_manager)
   1809
   1810 dir = make_path_relative(dir)
- 1811 nb = Notebook(dir)
   1812 nb.interface = interface
   1813 nb.port = port

/home/drsantanu/Downloads/sage-5.13-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/devel/sagenb/sagenb/notebook/notebook.pyc
in __init__(self, dir, user_manager)
138 # Now set the configuration, loaded from the datastore.
139 try:
-- 140 self.__conf = S.load_server_conf()
141 except IOError:
142 # Worksheet has never been saved before, so the server
conf doesn't exist.

/home/drsantanu/Downloads/sage-5.13-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/devel/sagenb/sagenb/storage/filesystem_storage.pyc
in load_server_conf(self)
219
220 def load_server_conf(self):
-- 221 return self._basic_to_server_conf(self._load('conf.pickle'))
222
223 def save_server_conf(self, server_conf):

/home/drsantanu/Downloads/sage-5.13-linux-64bit-ubuntu_12.04.3_lts-x86_64-Linux/devel/sagenb/sagenb/storage/filesystem_storage.pyc
in _load(self, filename)
165 def _load(self, filename):
166 with open(self._abspath(filename)) as f:
-- 167 result = cPickle.load(f)
168 return result
169

UnpicklingError: invalid load key, '�'.

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


[sage-support] Integration

2013-12-09 Thread Santanu Sarkar
I want to find the following integration.

I=integral_{t=x}^y I_{x=y}t, where I_{x=y} is the indicator function whose
value is 1 when x=y, else 0.

So, value of I=(y^2-x^2)/2 if x=y
   =0   if xy

Does Sage  provide this kind of symbolic integration?

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


[sage-support] Install cryptominisat-2.9.5 in Ubuntu 13.10

2013-11-18 Thread Santanu Sarkar
Dear all,
  I am trying to install cryptominisat in my Ubuntu 13.10. But I have the
following
error.

sage: B = BooleanPolynomialRing(10,'x')
sage: I = Ideal(B.random_element() for _ in range(10))
sage: import sage.sat.boolean_polynomials
sage: sage.sat.boolean_polynomials.solve(I.gens())
---
ImportError   Traceback (most recent call last)
ipython-input-13-c4875d7744cb in module()
 1 sage.sat.boolean_polynomials.solve(I.gens())

/home/santanu/Downloads/sage-5.12-linux-32bit-ubuntu_13.04-i686-Linux/local/lib/python2.7/site-packages/sage/sat/boolean_polynomials.pyc
in solve(F, converter, solver, n, target_variables, **kwds)
150
151 if solver is None:
-- 152 from sage.sat.solvers.cryptominisat import CryptoMiniSat as
solver
153
154 if not isinstance(solver, SatSolver):

/home/santanu/Downloads/sage-5.12-linux-32bit-ubuntu_13.04-i686-Linux/local/lib/python2.7/site-packages/sage/sat/solvers/cryptominisat/__init__.py
in module()
  2 from cryptominisat import CryptoMiniSat
  3 except ImportError:
 4 raise ImportError(Failed to import
'sage.sat.solvers.cryptominisat.CryptoMiniSat'. Run
\install_package('cryptominisat')\ to install it.)
  5
  6 from solverconf import SolverConf

ImportError: Failed to import
'sage.sat.solvers.cryptominisat.CryptoMiniSat'. Run
install_package('cryptominisat') to install it.


I have already installed cryptominisat. Hence I am getting

sage: install_package('cryptominisat')
---
ValueErrorTraceback (most recent call last)
ipython-input-14-93ad48af6de9 in module()
 1 install_package('cryptominisat')

/home/santanu/Downloads/sage-5.12-linux-32bit-ubuntu_13.04-i686-Linux/local/lib/python2.7/site-packages/sage/misc/package.pyc
in install_package(package, force)
169 if not force:
170 if is_package_installed(package):
-- 171 raise ValueError, Package is already installed.
Try install_package('%s',force=True)%(package)
172 raise ValueError, There is no package name starting with
'%s'.%(package)
173 # len(L)==1, i.e. exactly one package matches the given one.

ValueError: Package is already installed. Try
install_package('cryptominisat',force=True)
sage:

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


[sage-support] Re: Install cryptominisat-2.9.5 in Ubuntu 13.10

2013-11-18 Thread Santanu Sarkar
Installed it. Is there any updated version of cryptominisat-2.9.5?


On 18 November 2013 15:48, Santanu Sarkar sarkar.santanu@gmail.comwrote:

 Dear all,
   I am trying to install cryptominisat in my Ubuntu 13.10. But I have the
 following
 error.

 sage: B = BooleanPolynomialRing(10,'x')
 sage: I = Ideal(B.random_element() for _ in range(10))
 sage: import sage.sat.boolean_polynomials
 sage: sage.sat.boolean_polynomials.solve(I.gens())
 ---
 ImportError   Traceback (most recent call last)
 ipython-input-13-c4875d7744cb in module()
  1 sage.sat.boolean_polynomials.solve(I.gens())

 /home/santanu/Downloads/sage-5.12-linux-32bit-ubuntu_13.04-i686-Linux/local/lib/python2.7/site-packages/sage/sat/boolean_polynomials.pyc
 in solve(F, converter, solver, n, target_variables, **kwds)
 150
 151 if solver is None:
 -- 152 from sage.sat.solvers.cryptominisat import CryptoMiniSat
 as solver
 153
 154 if not isinstance(solver, SatSolver):

 /home/santanu/Downloads/sage-5.12-linux-32bit-ubuntu_13.04-i686-Linux/local/lib/python2.7/site-packages/sage/sat/solvers/cryptominisat/__init__.py
 in module()
   2 from cryptominisat import CryptoMiniSat
   3 except ImportError:
  4 raise ImportError(Failed to import
 'sage.sat.solvers.cryptominisat.CryptoMiniSat'. Run
 \install_package('cryptominisat')\ to install it.)
   5
   6 from solverconf import SolverConf

 ImportError: Failed to import
 'sage.sat.solvers.cryptominisat.CryptoMiniSat'. Run
 install_package('cryptominisat') to install it.


 I have already installed cryptominisat. Hence I am getting

 sage: install_package('cryptominisat')
 ---
 ValueErrorTraceback (most recent call last)
 ipython-input-14-93ad48af6de9 in module()
  1 install_package('cryptominisat')

 /home/santanu/Downloads/sage-5.12-linux-32bit-ubuntu_13.04-i686-Linux/local/lib/python2.7/site-packages/sage/misc/package.pyc
 in install_package(package, force)
 169 if not force:
 170 if is_package_installed(package):
 -- 171 raise ValueError, Package is already installed.
 Try install_package('%s',force=True)%(package)
 172 raise ValueError, There is no package name starting with
 '%s'.%(package)
 173 # len(L)==1, i.e. exactly one package matches the given one.

 ValueError: Package is already installed. Try
 install_package('cryptominisat',force=True)
 sage:



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


Re: [sage-support] Re: Sage Install Matrix Problem

2013-11-14 Thread Santanu Sarkar
Thanks a lot. My version was Ubuntu 12.04. Now I can fix the problem.


On 9 October 2013 15:56, Dima Pasechnik dimp...@gmail.com wrote:

 On 2013-10-09, Santanu Sarkar sarkar.santanu@gmail.com wrote:
  I have installed sage 5.11 in the  following way.
 
  santanu@santanu-Compaq-Presario-C700-Notebook-PC
 :~/Desktop/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux$
 
  ./sage
 
  notebook()
 
 
  Some functions work perfectly, but
 
  when I write
  M=matrix(ZZ,2,2,[1,2,3,4])
 
  I have the following:
 
 
  Traceback (most recent call last):
File stdin, line 1, in module
   File _sage_input_3.py, line 10, in module
  exec compile(u'open(___code___.py,w).write(# -*- coding:
  utf-8 -*-\\n +
 
 _support_.preparse_worksheet_cell(base64.b64decode(TT1tYXRyaXgoWlosMiwyLFsxLDIsMyw0XSk=),globals())+\\n);
  execfile(os.path.abspath(___code___.py))
File , line 1, in module
 
File /tmp/tmpy7xYJm/___code___.py, line 3, in module
  exec compile(u'M=matrix(ZZ,_sage_const_2 ,_sage_const_2
  ,[_sage_const_1 ,_sage_const_2 ,_sage_const_3 ,_sage_const_4 ])
File , line 1, in module
 
File
 /home/santanu/Desktop/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux/local/lib/python2.7/site-packages/sage/matrix/constructor.py,
  line 559, in _matrix_constructor
  import numpy
File
 /home/santanu/Desktop/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux/local/lib/python2.7/site-packages/numpy/__init__.py,
  line 137, in module
  import add_newdocs
File
 /home/santanu/Desktop/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux/local/lib/python2.7/site-packages/numpy/add_newdocs.py,
  line 9, in module
  from numpy.lib import add_newdoc
File
 /home/santanu/Desktop/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux/local/lib/python2.7/site-packages/numpy/lib/__init__.py,
  line 13, in module
  from polynomial import *
File
 /home/santanu/Desktop/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux/local/lib/python2.7/site-packages/numpy/lib/polynomial.py,
  line 17, in module
  from numpy.linalg import eigvals, lstsq, inv
File
 /home/santanu/Desktop/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux/local/lib/python2.7/site-packages/numpy/linalg/__init__.py,
  line 48, in module
  from linalg import *
File
 /home/santanu/Desktop/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux/local/lib/python2.7/site-packages/numpy/linalg/linalg.py,
  line 23, in module
  from numpy.linalg import lapack_lite
  ImportError: /lib/i386-linux-gnu/libc.so.6: version `GLIBC_2.17' not
  found (required by
 
 /home/santanu/Desktop/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux/local/lib/libgfortran.so.3)

 please look at
 http://ask.sagemath.org/question/2716/glibc-217-dependency

 What is the version of Linux you are running?

 

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


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


[sage-support] Sage Install Matrix Problem

2013-10-09 Thread Santanu Sarkar
I have installed sage 5.11 in the  following way.

santanu@santanu-Compaq-Presario-C700-Notebook-PC:~/Desktop/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux$

./sage

notebook()


Some functions work perfectly, but

when I write
M=matrix(ZZ,2,2,[1,2,3,4])

I have the following:


Traceback (most recent call last):
  File stdin, line 1, in module
 File _sage_input_3.py, line 10, in module
exec compile(u'open(___code___.py,w).write(# -*- coding:
utf-8 -*-\\n +
_support_.preparse_worksheet_cell(base64.b64decode(TT1tYXRyaXgoWlosMiwyLFsxLDIsMyw0XSk=),globals())+\\n);
execfile(os.path.abspath(___code___.py))
  File , line 1, in module

  File /tmp/tmpy7xYJm/___code___.py, line 3, in module
exec compile(u'M=matrix(ZZ,_sage_const_2 ,_sage_const_2
,[_sage_const_1 ,_sage_const_2 ,_sage_const_3 ,_sage_const_4 ])
  File , line 1, in module

  File 
/home/santanu/Desktop/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux/local/lib/python2.7/site-packages/sage/matrix/constructor.py,
line 559, in _matrix_constructor
import numpy
  File 
/home/santanu/Desktop/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux/local/lib/python2.7/site-packages/numpy/__init__.py,
line 137, in module
import add_newdocs
  File 
/home/santanu/Desktop/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux/local/lib/python2.7/site-packages/numpy/add_newdocs.py,
line 9, in module
from numpy.lib import add_newdoc
  File 
/home/santanu/Desktop/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux/local/lib/python2.7/site-packages/numpy/lib/__init__.py,
line 13, in module
from polynomial import *
  File 
/home/santanu/Desktop/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux/local/lib/python2.7/site-packages/numpy/lib/polynomial.py,
line 17, in module
from numpy.linalg import eigvals, lstsq, inv
  File 
/home/santanu/Desktop/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux/local/lib/python2.7/site-packages/numpy/linalg/__init__.py,
line 48, in module
from linalg import *
  File 
/home/santanu/Desktop/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux/local/lib/python2.7/site-packages/numpy/linalg/linalg.py,
line 23, in module
from numpy.linalg import lapack_lite
ImportError: /lib/i386-linux-gnu/libc.so.6: version `GLIBC_2.17' not
found (required by
/home/santanu/Desktop/sage-5.11-linux-32bit-ubuntu_13.04-i686-Linux/local/lib/libgfortran.so.3)

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


[sage-support] Convolution Polynomial Ring

2013-08-22 Thread Santanu Sarkar
Dear all,
  Is convolution polynomial ring implemented in Sage?
I want to implement NTRU public key cryptosystem. Hence I need
modular inverse of a polynomial also in the ring.

With regards,
Santanu

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


[sage-support] Re: Convolution Polynomial Ring

2013-08-22 Thread Santanu Sarkar
How to define  polynomial ring  like Z[x]/(x^10-1)  Z_5[x]/(x^10-1) in
Sage?


On 22 August 2013 12:37, Santanu Sarkar sarkar.santanu@gmail.comwrote:

 Dear all,
   Is convolution polynomial ring implemented in Sage?
 I want to implement NTRU public key cryptosystem. Hence I need
 modular inverse of a polynomial also in the ring.

 With regards,
 Santanu


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


Re: [sage-support] Re: Convolution Polynomial Ring

2013-08-22 Thread Santanu Sarkar
Thanks. But in this ring, I can not find gcd.

N=7
p=3

R2.b = PolynomialRing(GF(p))
S.x = R2.quotient(b^N - 1)


f=x^6-x^4+x^3+x^2-1
g=x^6+x^4-x^2-x

print gcd(f,g),xgcd(f,g)

Traceback (click to the left of this block for traceback)
...
TypeError: unable to find gcd




On 23 August 2013 03:10, Stefan van Zwam stefanvanz...@gmail.com wrote:

 On Thursday, August 22, 2013 4:06:22 PM UTC-4, Santanu wrote:

 How to define  polynomial ring  like Z[x]/(x^10-1)  Z_5[x]/(x^10-1) in
 Sage?


 sage: R1.a = PolynomialRing(ZZ)
 sage: R.x = R1.quotient(a^10 - 1)

 sage: R2.b = PolynomialRing(GF(5))
 sage: S.y = R2.quotient(b^10 - 1)

 Now you can do:

 sage: x^12
 x^2

 sage: y^14 + 7 * y
 y^4 + 2*y

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


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


[sage-support] Roots af a polynomial

2013-07-18 Thread Santanu Sarkar
What algorithm is used in Sage to calculate the roots of a polynomial f(x)?
Corresponding Sage function is f.roots()

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




Re: [sage-support] Roots af a polynomial

2013-07-18 Thread Santanu Sarkar
Over integer.


On 18 July 2013 15:50, William Stein wst...@gmail.com wrote:

 On Thu, Jul 18, 2013 at 11:54 AM, Santanu Sarkar
 sarkar.santanu@gmail.com wrote:
  What algorithm is used in Sage to calculate the roots of a polynomial
 f(x)?
  Corresponding Sage function is f.roots()

 What is the base ring?   There are a dozen answers, depending on the
 ring in which the coefficients of f live...

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



 --
 William Stein
 Professor of Mathematics
 University of Washington
 http://wstein.org

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




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




Re: [sage-support] Roots af a polynomial

2013-07-18 Thread Santanu Sarkar
Thank you.


On 18 July 2013 16:09, William Stein wst...@gmail.com wrote:

 On Thu, Jul 18, 2013 at 12:53 PM, Santanu Sarkar
 sarkar.santanu@gmail.com wrote:
  Over integer.

 I did

 R.x = QQ[x]
 f = x*(x^3+1)*(x-17)

 then looked at f.roots?? which says it uses f.factor.  So I looked at
 f.factor?? and it uses Pari.  (It probably helped that I wrote a lot
 of this code.)

 So the answer appears to be the Sage completely factors the polynomial
 using Pari, then pulls off the degree 1 factors to give the roots.

 I make no claim that this is in any way the best approach -- it really
 can't be in general.  For example, if you can factor the constant term
 of the polynomial, then simply checking through divisors might be
 dramatically faster (depending on how many divisors there are).

 William

 
 
  On 18 July 2013 15:50, William Stein wst...@gmail.com wrote:
 
  On Thu, Jul 18, 2013 at 11:54 AM, Santanu Sarkar
  sarkar.santanu@gmail.com wrote:
   What algorithm is used in Sage to calculate the roots of a polynomial
   f(x)?
   Corresponding Sage function is f.roots()
 
  What is the base ring?   There are a dozen answers, depending on the
  ring in which the coefficients of f live...
 
  
   --
   You received this message because you are subscribed to the Google
   Groups
   sage-support group.
   To unsubscribe from this group and stop receiving emails from it, send
   an
   email to sage-support+unsubscr...@googlegroups.com.
   To post to this group, send email to sage-support@googlegroups.com.
   Visit this group at http://groups.google.com/group/sage-support.
   For more options, visit https://groups.google.com/groups/opt_out.
  
  
 
 
 
  --
  William Stein
  Professor of Mathematics
  University of Washington
  http://wstein.org
 
  --
  You received this message because you are subscribed to the Google
 Groups
  sage-support group.
  To unsubscribe from this group and stop receiving emails from it, send
 an
  email to sage-support+unsubscr...@googlegroups.com.
  To post to this group, send email to sage-support@googlegroups.com.
  Visit this group at http://groups.google.com/group/sage-support.
  For more options, visit https://groups.google.com/groups/opt_out.
 
 
 
  --
  You received this message because you are subscribed to the Google Groups
  sage-support group.
  To unsubscribe from this group and stop receiving emails from it, send an
  email to sage-support+unsubscr...@googlegroups.com.
  To post to this group, send email to sage-support@googlegroups.com.
  Visit this group at http://groups.google.com/group/sage-support.
  For more options, visit https://groups.google.com/groups/opt_out.
 
 



 --
 William Stein
 Professor of Mathematics
 University of Washington
 http://wstein.org

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




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




[sage-support] Coefficient of Boolean Polynomial

2013-05-27 Thread Santanu Sarkar
Dear all,
  In the following code, although the
coefficient of x0 is 1+x1*x2, it returns
1.

from sage.crypto.boolean_function import BooleanFunction
R.x0,x1,x2,x3,x4,x5=BooleanPolynomialRing(6)

f=(1+x1*x2)*x0+x4*x5
print f.monomial_coefficient(x0)

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




[sage-support] Array in Sage

2013-05-19 Thread Santanu Sarkar
Is the any way to write four dimensional array in Sage like C
int M[10][10][10][10]?  For two dimensional case I use Matrix.

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




Re: [sage-support] Conjunctive Normal Form

2013-04-21 Thread Santanu Sarkar
Dear all,
  Thank you very much for your help.

With regards,
Santanu


On 21 April 2013 07:02, Martin Albrecht martinralbre...@googlemail.comwrote:

 sage: B.a,b,c = BooleanPolynomialRing()
 sage: f=a+b*c
 sage: from sage.sat.converters.polybori import CNFEncoder
 sage: from sage.sat.solvers.dimacs import DIMACS
 sage: solver = DIMACS()
 sage: ce = CNFEncoder(solver, B)
 sage: ce([f])
 [None, a, b, c]
 sage: solver.clauses()
 [((-2, -3, 1), False, None), ((3, -1), False, None), ((2, -1), False,
 None)]


 On Saturday 20 Apr 2013, Santanu Sarkar wrote:
  Dear all,
I want to convert the polynomial f into Conjunctive Normal Form (CNF)
  in Sage. How can I do this?
 
 
  B.a,b,c = BooleanPolynomialRing()
  f=a+b*c

 Cheers,
 Martin

 --
 name: Martin Albrecht
 _pgp: http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x8EF0DC99
 _otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
 _www: http://martinralbrecht.wordpress.com/
 _jab: martinralbre...@jabber.ccc.de

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




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




[sage-support] Conjunctive Normal Form

2013-04-20 Thread Santanu Sarkar
Dear all,
  I want to convert the polynomial f into Conjunctive Normal Form (CNF)
in Sage. How can I do this?


B.a,b,c = BooleanPolynomialRing()
f=a+b*c

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




[sage-support] Boolean Function

2013-04-18 Thread Santanu Sarkar
Dear all,
  I have a  Boolean polynomial f with huge degree  variables.
Also it has huge number of monomials.
I want to delete all monomials from f with degree greater
than 20. For that I have written the following approach.

V=BooleanPolynomialRing(4,['r%d'%(i) for i in range(4)])
V.inject_variables()
f=r0+r1*r2+r1*r2*r3
print f.degree()
A=f.monomials()
g=0
for i in range(Set(A).cardinality()):
 if((A[i]).degree()=2):
g=g+V(A[i])

f=f+g
print f

But observed that for my actual case, it is very slow. Will you
kindly give any better idea?

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




[sage-support] Problem in Sat Solver

2013-04-04 Thread Santanu Sarkar
When I run the following code, I have

Traceback (click to the left of this block for traceback)
...
AssertionError



from sage.crypto.boolean_function import BooleanFunction

R.x0, x1, x2, x3, x4, x5=BooleanPolynomialRing(6)

C=[x0,   x0 + x1,   x1 + x2, x3,   x2 + 1,   x4 +x5]
tt=cputime()

I = Ideal(C)

import sage.sat.boolean_polynomials
B= sage.sat.boolean_polynomials.solve(I.gens())

print cputime(tt)


However B should be False, which I get when
C=[x0,   x0 + x1,   x1 + x2, x3,   x2 + 1]

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




[sage-support] Extract only some elements from a set

2013-02-26 Thread Santanu Sarkar
Dear all,
  I have  a set non linear equations over  Boolean variables x_1,...,
x_{1}.
Sat solver gives I=[{x1: 0, x100: 1, .}]. I am interested to see only
the values
of x1,.., x100. Will you kindly help me ?

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




Re: [sage-support] Re: Extract only some elements from a set

2013-02-26 Thread Santanu Sarkar
Sorry, I can not understand the approach.

Let I=[{x0:1, x1: 0, y0: 1}]. Suppose I want to find only x0 and x1.
How is it possible?


On 26 February 2013 16:37, akhil lalwani.ak...@gmail.com wrote:



 On Tuesday, February 26, 2013 1:40:26 PM UTC+5:30, Santanu wrote:

 Dear all,
   I have  a set non linear equations over  Boolean variables x_1,...,
 x_{1}.
 Sat solver gives I=[{x1: 0, x100: 1, .}]. I am interested to see only
 the values
 of x1,.., x100. Will you kindly help me ?



 Hello,

 Let d be the concerned dictionary, whose keys are x1 to x1, and
 corresponding to each key, value is in {0,1}.

 One can do the following:

 l = [ ]
 for i in range(1,101):
 l.append('x' + str(i))

 d1 = { }

 d1 = {keys:d[keys] for keys in l}

 The result will be the dictionary d1 containing only (key,value) pairs
 corresponding to keys x1,x100.

 Regards,

 AKHIL.





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




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




Re: [sage-support] Re: Extract only some elements from a set

2013-02-26 Thread Santanu Sarkar
Thank you very much.

On 26 February 2013 18:52, Christophe BAL projet...@gmail.com wrote:

 Hello,
 this is more a python question that a sympy question

 If  L is the list [{x0:1, x1: 0, y0: 1}], then L[0] is the dictionnary
 {x0:1, x1: 0, y0: 1}. Than you can try something like L[0][x0] or
 L[0][x0].

 Hoping that this will help you.

 Best regards.
 Christophe.


 2013/2/26 Santanu Sarkar sarkar.santanu@gmail.com

 Sorry, I can not understand the approach.

 Let I=[{x0:1, x1: 0, y0: 1}]. Suppose I want to find only x0 and x1.
 How is it possible?


 On 26 February 2013 16:37, akhil lalwani.ak...@gmail.com wrote:



 On Tuesday, February 26, 2013 1:40:26 PM UTC+5:30, Santanu wrote:

 Dear all,
   I have  a set non linear equations over  Boolean variables x_1,...,
 x_{1}.
 Sat solver gives I=[{x1: 0, x100: 1, .}]. I am interested to see
 only the values
 of x1,.., x100. Will you kindly help me ?



 Hello,

 Let d be the concerned dictionary, whose keys are x1 to x1, and
 corresponding to each key, value is in {0,1}.

  One can do the following:

 l = [ ]
 for i in range(1,101):
 l.append('x' + str(i))

 d1 = { }

 d1 = {keys:d[keys] for keys in l}

 The result will be the dictionary d1 containing only (key,value) pairs
 corresponding to keys x1,x100.

 Regards,

 AKHIL.





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




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




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




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




[sage-support] Arrays of Boolean variables

2013-02-26 Thread Santanu Sarkar
Dear all,
   I need two arrays of Boolean variables. So I have written

R=BooleanPolynomialRing(2,['x%d'%(i+1) for i in range
(1)]+,['y%d'%(i+1) for i in range (1)] )
R.inject_variables()

Now in one array A, I want to store x1,..,x1 and in another array B
want to store
y1,..y1.  Hence  A=[x1,.., x1]  B=[y1,..,y1]. How this can be
possible?

Also function R.inject_variables() explicitly shows the variables, which I
do not want.
Is there any way to tackle this?

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




[sage-support] Re: Arrays of Boolean variables

2013-02-26 Thread Santanu Sarkar
Dear all,
  Using R.variable(), I can solve the first problem.


On 27 February 2013 07:20, Santanu Sarkar sarkar.santanu@gmail.comwrote:

 Dear all,
I need two arrays of Boolean variables. So I have written

 R=BooleanPolynomialRing(2,['x%d'%(i+1) for i in range
 (1)]+,['y%d'%(i+1) for i in range (1)] )
 R.inject_variables()

 Now in one array A, I want to store x1,..,x1 and in another array B
 want to store
 y1,..y1.  Hence  A=[x1,.., x1]  B=[y1,..,y1]. How this can be
 possible?

 Also function R.inject_variables() explicitly shows the variables, which I
 do not want.
 Is there any way to tackle this?




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




[sage-support] Re: Error when type notebook()

2013-02-19 Thread Santanu Sarkar
My version is  sage-5.6-linux-32bit-ubuntu_12.04.1_lts-i686-Linux.

On 19 February 2013 08:46, Santanu Sarkar sarkar.santanu@gmail.comwrote:

 Dear all,
   when I type notebook(), I get the following error.
 Will you kindly help me?


 sage: notebook()
 ---
 EOFError  Traceback (most recent call last)

 /home/a/.sage/ipython console in module()

 /home/a/Downloads/sage-5.6-linux-32bit-ubuntu_12.04.1_lts-i686-Linux/devel/sagenb/sagenb/notebook/notebook_object.pyc
 in __call__(self, *args, **kwds)
 221 
 222 def __call__(self, *args, **kwds):
 -- 223 return self.notebook(*args, **kwds)
 224
 225 notebook = run_notebook.notebook_run

 /home/a/Downloads/sage-5.6-linux-32bit-ubuntu_12.04.1_lts-i686-Linux/devel/sagenb/sagenb/notebook/run_notebook.pyc
 in notebook_run(self, directory, port, interface, port_tries, secure,
 reset, accounts, openid, server_pool, ulimit, timeout, upload,
 automatic_login, start_path, fork, quiet, server, profile, subnets,
 require_login, open_viewer, address)
 526 # if none use defaults
 527
 -- 528 nb = notebook.load_notebook(directory)
 529
 530 directory = nb._dir

 /home/a/Downloads/sage-5.6-linux-32bit-ubuntu_12.04.1_lts-i686-Linux/devel/sagenb/sagenb/notebook/notebook.pyc
 in load_notebook(dir, interface, port, secure, user_manager)
1794
1795 dir = make_path_relative(dir)
 - 1796 nb = Notebook(dir)
1797 nb.interface = interface
1798 nb.port = port

 /home/a/Downloads/sage-5.6-linux-32bit-ubuntu_12.04.1_lts-i686-Linux/devel/sagenb/sagenb/notebook/notebook.pyc
 in __init__(self, dir, user_manager)
 147 # Set the list of users
 148 try:
 -- 149 S.load_users(self._user_manager)
 150 except IOError:
 151 pass

 /home/a/Downloads/sage-5.6-linux-32bit-ubuntu_12.04.1_lts-i686-Linux/devel/sagenb/sagenb/storage/filesystem_storage.pyc
 in load_users(self, user_manager)
 265 {'admin': admin, 'wstein': wstein}
 266 
 -- 267 for user in
 self._basic_to_users(self._load('users.pickle')).itervalues():
 268 user_manager.add_user_object(user, force=True)
 269 user_manager.set_password(user.username(),
 user.password(), encrypt = False)

 /home/a/Downloads/sage-5.6-linux-32bit-ubuntu_12.04.1_lts-i686-Linux/devel/sagenb/sagenb/storage/filesystem_storage.pyc
 in _load(self, filename)
 165 def _load(self, filename):
 166 with open(self._abspath(filename)) as f:
 -- 167 result = cPickle.load(f)
 168 return result
 169

 EOFError:
 sage:



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




Re: [sage-support] Error when type notebook()

2013-02-19 Thread Santanu Sarkar
Thank you.

On 19 February 2013 09:55, Jan Groenewald j...@aims.ac.za wrote:

  HI

 Sometimes $SAGE_ROOT/.sage/sage_notebook.sagenb/conf.pickle or
 users.pickle get corrupted. Try back them up elsewhere and try start
 without them.  A blank one will be created.

 Regards,
 Jan



  On 19 February 2013 05:16, Santanu Sarkar 
 sarkar.santanu@gmail.comwrote:

  Dear all,
   when I type notebook(), I get the following error.
 Will you kindly help me?


 sage: notebook()

 ---
 EOFError  Traceback (most recent call
 last)

 /home/a/.sage/ipython console in module()

 /home/a/Downloads/sage-5.6-linux-32bit-ubuntu_12.04.1_lts-i686-Linux/devel/sagenb/sagenb/notebook/notebook_object.pyc
 in __call__(self, *args, **kwds)
 221 
 222 def __call__(self, *args, **kwds):
 -- 223 return self.notebook(*args, **kwds)
 224
 225 notebook = run_notebook.notebook_run

 /home/a/Downloads/sage-5.6-linux-32bit-ubuntu_12.04.1_lts-i686-Linux/devel/sagenb/sagenb/notebook/run_notebook.pyc
 in notebook_run(self, directory, port, interface, port_tries, secure,
 reset, accounts, openid, server_pool, ulimit, timeout, upload,
 automatic_login, start_path, fork, quiet, server, profile, subnets,
 require_login, open_viewer, address)
 526 # if none use defaults
 527
 -- 528 nb = notebook.load_notebook(directory)
 529
 530 directory = nb._dir

 /home/a/Downloads/sage-5.6-linux-32bit-ubuntu_12.04.1_lts-i686-Linux/devel/sagenb/sagenb/notebook/notebook.pyc
 in load_notebook(dir, interface, port, secure, user_manager)
1794
1795 dir = make_path_relative(dir)
 - 1796 nb = Notebook(dir)
1797 nb.interface = interface
1798 nb.port = port

 /home/a/Downloads/sage-5.6-linux-32bit-ubuntu_12.04.1_lts-i686-Linux/devel/sagenb/sagenb/notebook/notebook.pyc
 in __init__(self, dir, user_manager)
 147 # Set the list of users
 148 try:
 -- 149 S.load_users(self._user_manager)
 150 except IOError:
 151 pass

 /home/a/Downloads/sage-5.6-linux-32bit-ubuntu_12.04.1_lts-i686-Linux/devel/sagenb/sagenb/storage/filesystem_storage.pyc
 in load_users(self, user_manager)
 265 {'admin': admin, 'wstein': wstein}
 266 
 -- 267 for user in
 self._basic_to_users(self._load('users.pickle')).itervalues():
 268 user_manager.add_user_object(user, force=True)
 269 user_manager.set_password(user.username(),
 user.password(), encrypt = False)

 /home/a/Downloads/sage-5.6-linux-32bit-ubuntu_12.04.1_lts-i686-Linux/devel/sagenb/sagenb/storage/filesystem_storage.pyc
 in _load(self, filename)
 165 def _load(self, filename):
 166 with open(self._abspath(filename)) as f:
 -- 167 result = cPickle.load(f)
 168 return result
 169

 EOFError:
 sage:

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






 --
   .~.
   /V\ Jan Groenewald
  /( )\www.aims.ac.za
  ^^-^^

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




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




Re: [sage-support] Re: Boolean Variables

2013-02-18 Thread Santanu Sarkar
Thank you very much.

On 16 February 2013 21:50, akhil lalwani.ak...@gmail.com wrote:



 On Saturday, February 16, 2013 9:38:14 AM UTC+5:30, Santanu wrote:

 Dear all,
  I have the following problem.


 I am working with Boolean variables. So I call the following.

 from sage.crypto.boolean_function import BooleanFunction
 R.x0,x1,x2,x3,x4,x5,x6,x7,x8,**x9=BooleanPolynomialRing(10)


 Suppose during run time of my code, I get three polynomials
 x1*x2+x3+x4, x0+x5, x4+x5. Now I want to replace last polynomial
 by x4=x1*x2+x3  x5=x0. However this replacement is not constant.
 That is next time x4 may be  replaced by x0+x1.

 How this is possible?



 Hi,

 The subs( ) function works with symbolic variables as well. Therefore, to
 replace x4 by x1*x2 + x3 and x5 by x0, do the following:

 sage:from sage.crypto.boolean_function import BooleanFunction
 sage:R.x0,x1,x2,x3,x4,x5,x6,x7,x8,x9=BooleanPolynomialRing(10)
 sage:f = x4 + x5
 sage:f.subs({x4 :x1*x2 + x3, x5:x0})
 x0 + x1*x2 + x3#Answer returned by SAGE

 If you have a single substitution to make, e.g replace only x5 by x0,
 there is no need to pass a dictionary.

 sage:f.subs(x5 = x0)
 x0 + x4


 I hope it is clear.

 Regards,

 AKHIL.




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




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




[sage-support] Error when type notebook()

2013-02-18 Thread Santanu Sarkar
Dear all,
  when I type notebook(), I get the following error.
Will you kindly help me?


sage: notebook()
---
EOFError  Traceback (most recent call last)

/home/a/.sage/ipython console in module()

/home/a/Downloads/sage-5.6-linux-32bit-ubuntu_12.04.1_lts-i686-Linux/devel/sagenb/sagenb/notebook/notebook_object.pyc
in __call__(self, *args, **kwds)
221 
222 def __call__(self, *args, **kwds):
-- 223 return self.notebook(*args, **kwds)
224
225 notebook = run_notebook.notebook_run

/home/a/Downloads/sage-5.6-linux-32bit-ubuntu_12.04.1_lts-i686-Linux/devel/sagenb/sagenb/notebook/run_notebook.pyc
in notebook_run(self, directory, port, interface, port_tries, secure,
reset, accounts, openid, server_pool, ulimit, timeout, upload,
automatic_login, start_path, fork, quiet, server, profile, subnets,
require_login, open_viewer, address)
526 # if none use defaults
527
-- 528 nb = notebook.load_notebook(directory)
529
530 directory = nb._dir

/home/a/Downloads/sage-5.6-linux-32bit-ubuntu_12.04.1_lts-i686-Linux/devel/sagenb/sagenb/notebook/notebook.pyc
in load_notebook(dir, interface, port, secure, user_manager)
   1794
   1795 dir = make_path_relative(dir)
- 1796 nb = Notebook(dir)
   1797 nb.interface = interface
   1798 nb.port = port

/home/a/Downloads/sage-5.6-linux-32bit-ubuntu_12.04.1_lts-i686-Linux/devel/sagenb/sagenb/notebook/notebook.pyc
in __init__(self, dir, user_manager)
147 # Set the list of users
148 try:
-- 149 S.load_users(self._user_manager)
150 except IOError:
151 pass

/home/a/Downloads/sage-5.6-linux-32bit-ubuntu_12.04.1_lts-i686-Linux/devel/sagenb/sagenb/storage/filesystem_storage.pyc
in load_users(self, user_manager)
265 {'admin': admin, 'wstein': wstein}
266 
-- 267 for user in
self._basic_to_users(self._load('users.pickle')).itervalues():
268 user_manager.add_user_object(user, force=True)
269 user_manager.set_password(user.username(),
user.password(), encrypt = False)

/home/a/Downloads/sage-5.6-linux-32bit-ubuntu_12.04.1_lts-i686-Linux/devel/sagenb/sagenb/storage/filesystem_storage.pyc
in _load(self, filename)
165 def _load(self, filename):
166 with open(self._abspath(filename)) as f:
-- 167 result = cPickle.load(f)
168 return result
169

EOFError:
sage:

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




[sage-support] Boolean Variables

2013-02-15 Thread Santanu Sarkar
Dear all,
 I have the following problem.


I am working with Boolean variables. So I call the following.

from sage.crypto.boolean_function import BooleanFunction
R.x0,x1,x2,x3,x4,x5,x6,x7,x8,x9=BooleanPolynomialRing(10)


Suppose during run time of my code, I get three polynomials
x1*x2+x3+x4, x0+x5, x4+x5. Now I want to replace last polynomial
by x4=x1*x2+x3  x5=x0. However this replacement is not constant.
That is next time x4 may be  replaced by x0+x1.

How this is possible?

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




[sage-support] Solve polynomial over ring

2013-01-30 Thread Santanu Sarkar
I want to solve a polynomial over ring.
However my code does not work.


N=8
R.x=Integers(N)[]
f=x^2-1
print f.roots()

In my case, N is always a power of 2.

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




Re: [sage-support] Solve polynomial over ring

2013-01-30 Thread Santanu Sarkar
Thank you.

On 30 January 2013 10:17, Charles Bouillaguet charles.bouillag...@gmail.com
 wrote:

 On Jan 30, 2013, at 3:20 PM, Santanu Sarkar wrote:

 
  N=8
  R.x=Integers(N)[]
  f=x^2-1
  print f.roots()


 Try :

 sage: print f.roots(multiplicities=False)
 [1, 3, 5, 7]

 It's a start...
 ---
 Charles Bouillaguet
 http://www.lifl.fr/~bouillaguet/

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




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




[sage-support] Polynomial Ring

2013-01-23 Thread Santanu Sarkar
I have written following code:

R=Integers(30)['X']
f1=X-10
f2=X-30
print f1*f2

This gives X^2-40*X+300

However I want coefficients to be modulo 30 i.e., 40 =10 , 300=0 in R.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




Re: [sage-support] Sat Solver

2012-12-24 Thread Santanu Sarkar
Thank you. I will install the new version.

On 24 December 2012 17:28, Martin Albrecht
martinralbre...@googlemail.comwrote:

 Works for me

 $ sage
 --
 | Sage Version 5.4.1, Release Date: 2012-11-15   |
 | Type notebook() for the browser-based notebook interface.|
 | Type help() for help.|
 --
 sage: from sage.sat.solvers import SatSolver
 sage:

 $ /opt/sage-5.5.rc1/sage
 --
 | Sage Version 5.5.rc1, Release Date: 2012-12-18 |
 | Type notebook() for the browser-based notebook interface.|
 | Type help() for help.|
 --
 **
 **
 * Warning: this is a prerelease version, and it may be unstable. *
 **
 **
 sage: from sage.sat.solvers import SatSolver
 sage:


 On Monday 24 Dec 2012, Santanu Sarkar wrote:
  Dear all,
   To solve a SAT problem, when I have written  the following, I got error.
 
  from sage.structure.sequence import Sequence
  from sage.rings.infinity import PlusInfinity
 
  from sage.sat.solvers import SatSolver
  from sage.sat.converters import ANF2CNFConverter
 
 
 
  Traceback (click to the left of this block for traceback)
  ...
  ImportError: No module named sat.solvers

 Cheers,
 Martin

 --
 name: Martin Albrecht
 _pgp: http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x8EF0DC99
 _otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
 _www: http://martinralbrecht.wordpress.com/
 _jab: martinralbre...@jabber.ccc.de

 --
 You received this message because you are subscribed to the Google Groups
 sage-support group.
 To post to this group, send email to sage-support@googlegroups.com.
 To unsubscribe from this group, send email to
 sage-support+unsubscr...@googlegroups.com.
 Visit this group at http://groups.google.com/group/sage-support?hl=en.




-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




[sage-support] Sat Solver

2012-12-23 Thread Santanu Sarkar
Dear all,
 To solve a SAT problem, when I have written  the following, I got error.

from sage.structure.sequence import Sequence
from sage.rings.infinity import PlusInfinity

from sage.sat.solvers import SatSolver
from sage.sat.converters import ANF2CNFConverter



Traceback (click to the left of this block for traceback)
...
ImportError: No module named sat.solvers

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




[sage-support] Symbolic Calculation in Sage

2012-12-14 Thread Santanu Sarkar
Is there any function in Sage   by which  this kind of symbolic calculation
is possible?
s=0
for i=1 to m
  if(ia+t)
s=s+2i
  else
 s=s+t

m,a,t are non negative integers.

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




Re: [sage-support] Solve system of non linear equations

2012-12-12 Thread Santanu Sarkar
Thank you very much for your help.

On 9 December 2012 12:18, Georgi Guninski gunin...@guninski.com wrote:

 On Sat, Dec 08, 2012 at 11:44:19AM +0530, Santanu Sarkar wrote:
  Dear all,
I have a system of non linear equations over GF(2). How to solve
  them in Sage?
 

 If you need to solve large nonlinear systems over GF(2) and don't
 insist on using sage I suspect a better choice is to convert
 them to conjunctive normal form (CNF) and then use state of the
 art SAT solver like lingeling/cryptominisat.

 There are sage programs for converting ANF to CNF, don't know if
 they are in vanilla sage.


-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




[sage-support] Groebner Basis over finite field

2012-12-12 Thread Santanu Sarkar
I have a set of non-linear
equations over a prime field.
I want to solve them using
Groebner basis technique.

When I want to calculate
Groebner basis, I have following error.


verbose 0 (3292: multi_polynomial_ideal.py, groebner_basis) Warning:
falling back to very slow toy implementation.



P1=next_prime(2^100)
R.x,y,z=GF(P1)[]
M=[x-2,x^2+y^2-1]
I=M*R
B=I.groebner_basis()

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




Re: [sage-support] Re: Solve system of non linear equations

2012-12-08 Thread Santanu Sarkar
Thank you. But when I try to solve
f1=x1 + x2 + x4 + x10 + x31 + x43 + x56 ,
f2=x2 + x3 + x5 + x11 + x32 +x44 + x57,

it becomes very slow. Is there any faster approach like
F4 algorithm available in Sage?



On 8 December 2012 17:25, Martin Albrecht martinralbre...@googlemail.comwrote:

 Or compute a Gröbner basis:

 sage: P.x,y = BooleanPolynomialRing()
 sage: Ideal(x^2 + y^2).groebner_basis()
 [x + y]
 sage: Ideal(x^2 + y^2).variety()
 [{y: 0, x: 0}, {y: 1, x: 1}]

 On Saturday 08 Dec 2012, Volker Braun wrote:
  I take it you mean polynomial equations:
 
  sage: AA.x,y = AffineSpace(GF(2),2)
  sage: S = AA.subscheme(x^2+y^2)
  sage: S.point_set().points()
  [(0, 0), (1, 1)]
 
  On Saturday, December 8, 2012 6:14:19 AM UTC, Santanu wrote:
 I have a system of non linear equations over GF(2). How to solve
  
   them in Sage?

 Cheers,
 Martin

 --
 name: Martin Albrecht
 _pgp: http://pgp.mit.edu:11371/pks/lookup?op=getsearch=0x8EF0DC99
 _otr: 47F43D1A 5D68C36F 468BAEBA 640E8856 D7951CCF
 _www: http://martinralbrecht.wordpress.com/
 _jab: martinralbre...@jabber.ccc.de

 --
 You received this message because you are subscribed to the Google Groups
 sage-support group.
 To post to this group, send email to sage-support@googlegroups.com.
 To unsubscribe from this group, send email to
 sage-support+unsubscr...@googlegroups.com.
 Visit this group at http://groups.google.com/group/sage-support?hl=en.




-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




[sage-support] Solve system of non linear equations

2012-12-07 Thread Santanu Sarkar
Dear all,
  I have a system of non linear equations over GF(2). How to solve
them in Sage?

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




[sage-support] Array of Arrays

2012-10-01 Thread Santanu Sarkar
I have written the following:

T=[0]*2
S=[]
l=2
for i in range(l):
T[0]=i
T[1]=i+1
print T
S.append(T)

Now S becomes [[1, 2], [1, 2]] instead of [[0,1],[1,2]].
In my situation, length l of S is not fixed. Is there any
method to solve this problem?

-- 
You received this message because you are subscribed to the Google Groups 
sage-support group.
To post to this group, send email to sage-support@googlegroups.com.
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com.
Visit this group at http://groups.google.com/group/sage-support?hl=en.




[sage-support] Matrix

2012-08-06 Thread Santanu Sarkar
When I want to write a matrix, I have the following error.

sage: matrix(ZZ,2,2,[1,2,3,4])
---
AttributeErrorTraceback (most recent call last)

/home/a/Downloads/sage-4.8-linux-32bit-ubuntu_10.04_lts-i686-Linux/ipython
console in module()

/home/a/Downloads/sage-4.8-linux-32bit-ubuntu_10.04_lts-i686-Linux/local/lib/python2.6/site-packages/sage/matrix/constructor.pyc
in matrix(*args, **kwds)
495 # check to see if the number of rows is specified
496 try:
-- 497 import numpy
498 if isinstance(args[0], numpy.ndarray):
499 raise TypeError

/home/a/Downloads/sage-4.8-linux-32bit-ubuntu_10.04_lts-i686-Linux/local/lib/python2.6/site-packages/numpy/__init__.py
in module()
134 return loader(*packages, **options)
135
-- 136 import add_newdocs
137 __all__ = ['add_newdocs']
138

/home/a/Downloads/sage-4.8-linux-32bit-ubuntu_10.04_lts-i686-Linux/local/lib/python2.6/site-packages/numpy/add_newdocs.py
in module()
  7 #   core/fromnumeric.py, core/defmatrix.py up-to-date.
  8
 9 from numpy.lib import add_newdoc
 10
 11 
###

/home/a/Downloads/sage-4.8-linux-32bit-ubuntu_10.04_lts-i686-Linux/local/lib/python2.6/site-packages/numpy/lib/__init__.py
in module()
 11
 12 import scimath as emath
--- 13 from polynomial import *
 14 #import convertcode
 15 from utils import *

/home/a/Downloads/sage-4.8-linux-32bit-ubuntu_10.04_lts-i686-Linux/local/lib/python2.6/site-packages/numpy/lib/polynomial.py
in module()
  9 import re
 10 import warnings
--- 11 import numpy.core.numeric as NX
 12
 13 from numpy.core import isscalar, abs, finfo, atleast_1d, hstack

AttributeError: 'module' object has no attribute 'core'

-- 
-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org





[sage-support] Double Integral

2012-05-21 Thread Santanu Sarkar
When I use the following code it returns 0.

var('x y')
def f1(x,y):
if(x+y  5):
return x+y
else:
return 0

integral(integral(f1(x,y), x, 0,1), y, 0, 1)



whereas


integral(integral(x+y, x, 0,1), y, 0, 1)

returns 1.

Can any one point out the reason for this discrepancy and how to solve it?

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Normal Distribution

2012-02-17 Thread Santanu Sarkar
How to generate 1000 random integers which follow normal
distribution with mean 0 and variance 0.1?

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Normal Distribution

2012-02-17 Thread Santanu Sarkar
Thanks for the help.

On 17 February 2012 16:00, Vegard Lima vegard.l...@gmail.com wrote:
 On Fri, Feb 17, 2012 at 10:52 AM, Santanu Sarkar
 sarkar.santanu@gmail.com wrote:
 How to generate 1000 random integers which follow normal
 distribution with mean 0 and variance 0.1?

 You can do this with numpy:

 sage: import numpy as np
 sage: mu, sigma = 0, sqrt(0.1) # mean and standard deviation
 sage: s = np.random.normal(mu, sigma, 1000)

 Note that it takes std.deviation as input not variance.


 Cheers,
 --
 Vegard

 --
 To post to this group, send email to sage-support@googlegroups.com
 To unsubscribe from this group, send email to 
 sage-support+unsubscr...@googlegroups.com
 For more options, visit this group at 
 http://groups.google.com/group/sage-support
 URL: http://www.sagemath.org

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Fastest Lattice Reduction

2012-02-17 Thread Santanu Sarkar
I need to reduce a lattice of dimension
200 with its entries sizes  are of size like 3000 bit.  I use
LLL(algorithm=fpLLL:fast)
for faster lattice reduction. But it seems there is a problem in the
function. Reduction is
very bad. Is there any way to reduce this size of matrix efficiently?

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support]

2012-02-16 Thread Santanu Sarkar
Hi all,
  I have used the function  E,N1=M2.hermite_form(transformation=True)
to compute the Hermite Normal Form and
 observed  that it is very slow. Is there any better function?

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support]

2012-02-16 Thread Santanu Sarkar
M2 is a (50, 50) matrix. Its entries are large (2048 bit).

On 16 February 2012 09:32, William Stein wst...@gmail.com wrote:
 On Thu, Feb 16, 2012 at 9:23 AM, Santanu Sarkar
 sarkar.santanu@gmail.com wrote:
 Hi all,
  I have used the function  E,N1=M2.hermite_form(transformation=True)
 to compute the Hermite Normal Form and
  observed  that it is very slow. Is there any better function?

 What is M2?


 --
 To post to this group, send email to sage-support@googlegroups.com
 To unsubscribe from this group, send email to 
 sage-support+unsubscr...@googlegroups.com
 For more options, visit this group at 
 http://groups.google.com/group/sage-support
 URL: http://www.sagemath.org



 --
 William Stein
 Professor of Mathematics
 University of Washington
 http://wstein.org

 --
 To post to this group, send email to sage-support@googlegroups.com
 To unsubscribe from this group, send email to 
 sage-support+unsubscr...@googlegroups.com
 For more options, visit this group at 
 http://groups.google.com/group/sage-support
 URL: http://www.sagemath.org

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support]

2012-02-16 Thread Santanu Sarkar
No, that I do not know. I run my code half an hour. But still donot get result.

On 16/02/2012, William Stein wst...@gmail.com wrote:
 On Thu, Feb 16, 2012 at 9:53 AM, Santanu Sarkar
 sarkar.santanu@gmail.com wrote:
 M2 is a (50, 50) matrix. Its entries are large (2048 bit).

 On 16 February 2012 09:32, William Stein wst...@gmail.com wrote:
 On Thu, Feb 16, 2012 at 9:23 AM, Santanu Sarkar
 sarkar.santanu@gmail.com wrote:
 Hi all,
  I have used the function  E,N1=M2.hermite_form(transformation=True)
 to compute the Hermite Normal Form and
  observed  that it is very slow. Is there any better function?

 By very slow, do you mean very slow compared to insert other math
 software?

 William


 What is M2?


 --
 To post to this group, send email to sage-support@googlegroups.com
 To unsubscribe from this group, send email to
 sage-support+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/sage-support
 URL: http://www.sagemath.org



 --
 William Stein
 Professor of Mathematics
 University of Washington
 http://wstein.org

 --
 To post to this group, send email to sage-support@googlegroups.com
 To unsubscribe from this group, send email to
 sage-support+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/sage-support
 URL: http://www.sagemath.org

 --
 To post to this group, send email to sage-support@googlegroups.com
 To unsubscribe from this group, send email to
 sage-support+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/sage-support
 URL: http://www.sagemath.org



 --
 William Stein
 Professor of Mathematics
 University of Washington
 http://wstein.org

 --
 To post to this group, send email to sage-support@googlegroups.com
 To unsubscribe from this group, send email to
 sage-support+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/sage-support
 URL: http://www.sagemath.org


-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Area of a plot

2012-02-12 Thread Santanu Sarkar
Daer all,
 Is there any function in Sage by which we can calculate the area of a plot?
Actually I have many intersecting circles. I want to find the area covered
by them. Note that here total area is not sum of area of each circle.

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Order of a cyclic group

2012-01-21 Thread Santanu Sarkar
Thanks for the help.

On 21 January 2012 07:27, Maarten Derickx m.derickx.stud...@gmail.com wrote:
 Well the way I first tried is as follows:

 age: F.x=GF(2)[]
 sage: G.a=F.quotient(x^6 + x^4 + x^2 + x + 1)
 sage: a.multiplicative_order()
 ---
 NotImplementedError                       Traceback (most recent call last)


 But it gives a not implemented error. Luckily the following does work:

 sage: G.a=GF(2^6,modulus=x^6 + x^4 + x^2 + x + 1)
 sage: a.multiplicative_order()
 21

 --
 To post to this group, send email to sage-support@googlegroups.com
 To unsubscribe from this group, send email to
 sage-support+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/sage-support
 URL: http://www.sagemath.org

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Order of a cyclic group

2012-01-20 Thread Santanu Sarkar
Yes, exactly that we mean.

On 19 January 2012 20:13, John Cremona john.crem...@gmail.com wrote:
 On 19 January 2012 15:39, Santanu Sarkar sarkar.santanu@gmail.com wrote:
 Consider a polynomial f(x) over GF(2)[x]. How is it possible
 to find the order of the cyclic group generated by f(x)?

 What do you mean by the group generated by the polynomial?  Do you
 mean the group generated by a root of f (when f is irreducible)?

 John Cremona


 --
 To post to this group, send email to sage-support@googlegroups.com
 To unsubscribe from this group, send email to 
 sage-support+unsubscr...@googlegroups.com
 For more options, visit this group at 
 http://groups.google.com/group/sage-support
 URL: http://www.sagemath.org

 --
 To post to this group, send email to sage-support@googlegroups.com
 To unsubscribe from this group, send email to 
 sage-support+unsubscr...@googlegroups.com
 For more options, visit this group at 
 http://groups.google.com/group/sage-support
 URL: http://www.sagemath.org

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Period of a sequence

2012-01-20 Thread Santanu Sarkar
I have a sequence of 0 and 1. I know that period is small. Is there
any function in Sage by which
I can find the period? Or, can we find the period efficiently?
For example {0,1,0,1,0,1} has period of length 2.

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Period of a sequence

2012-01-20 Thread Santanu Sarkar
Thank you very much.

On 20 January 2012 20:57, David Joyner wdjoy...@gmail.com wrote:
 On Fri, Jan 20, 2012 at 9:56 AM, Santanu Sarkar
 sarkar.santanu@gmail.com wrote:
 I have a sequence of 0 and 1. I know that period is small. Is there
 any function in Sage by which
 I can find the period? Or, can we find the period efficiently?
 For example {0,1,0,1,0,1} has period of length 2.

 Try
 http://www.sagemath.org/doc/reference/sage/matrix/berlekamp_massey.html
 or
 http://www.sagemath.org/doc/reference/sage/crypto/lfsr.html


 --
 To post to this group, send email to sage-support@googlegroups.com
 To unsubscribe from this group, send email to 
 sage-support+unsubscr...@googlegroups.com
 For more options, visit this group at 
 http://groups.google.com/group/sage-support
 URL: http://www.sagemath.org

 --
 To post to this group, send email to sage-support@googlegroups.com
 To unsubscribe from this group, send email to 
 sage-support+unsubscr...@googlegroups.com
 For more options, visit this group at 
 http://groups.google.com/group/sage-support
 URL: http://www.sagemath.org

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Order of a cyclic group

2012-01-19 Thread Santanu Sarkar
Consider a polynomial f(x) over GF(2)[x]. How is it possible
to find the order of the cyclic group generated by f(x)?

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Factors of an integer

2012-01-17 Thread Santanu Sarkar
Sorry. I get the function.

On 17 January 2012 18:58, Santanu Sarkar sarkar.santanu@gmail.com wrote:
 Thanks. But this function gives only prime factors. Is there any
 function which gives
 all divisor?

 On 17 January 2012 00:39, Renan Birck Pinheiro renan.ee.u...@gmail.com 
 wrote:


 2012/1/16 Santanu Sarkar sarkar.santanu@gmail.com

 Is there any function in Sage by which I can get the
 number of prime factors,  number of factors of a
 positive ineger?

 If I understand you correctly:

 sage: factor(372)
 2^2 * 3 * 31

 One can get the number of factors by using 'len' on the result of this or in
 tuples form by using 'list':

 sage: len(factor(372))
 3
 sage: list(factor(372))
 [(2, 2), (3, 1), (31, 1)]

 Renan
 --
 Renan Birck Pinheiro, Grupo de Microeletrônica, Engenharia Elétrica, UFSM -
 Santa Maria, Brazil

 http://renanbirck.blogspot.com / skype: renan.ee.ufsm


 --
 To post to this group, send email to sage-support@googlegroups.com
 To unsubscribe from this group, send email to
 sage-support+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/sage-support
 URL: http://www.sagemath.org

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Factors of an integer

2012-01-16 Thread Santanu Sarkar
Is there any function in Sage by which I can get the
number of prime factors,  number of factors of a
positive ineger?

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Probability of a Boolean Function

2011-12-15 Thread Santanu Sarkar
I have a Boolean Function f which I know is not balanced. In fact f=0
with probability 1/4. If I use the function f.is_balanced() it tells
me that the function is not balanced, which is fine.
But is there a function which will tell me the what the probability of
a Boolean function being zero is ? If not is there any way I can find
out whether the probability of a boolean function f=0 is equal to 'p'
or not?

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Boolean function

2011-12-11 Thread Santanu Sarkar
I have a set of Boolean functions like
A[0]=x1*x2+x3*x4
A[1]=x3+x7+x10
A[2]=x19*x36+x43*x45*x50
over variables x_1,.. x_50.
But each function contains at most 10 variables.
I want to calculate the balancedness of each function.

I have done the following:

from sage.crypto.boolean_function import BooleanFunction
R=PolynomialRing(GF(2),'x',2^8)
x=R.gens()
S1=A[0]
xx=S1.variables()
l=len(xx)
P=BooleanPolynomialRing(l,map(str,xx))
f=BooleanFunction(A[0])
f.is_balanced()

But it does now work.
How can it be possible in Sage?

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Re: Boolean function

2011-12-11 Thread Santanu Sarkar
Sorry I meant to write
 But it does not work
apologies for the typo

On 12 December 2011 07:49, Santanu Sarkar sarkar.santanu@gmail.com wrote:
 I have a set of Boolean functions like
 A[0]=x1*x2+x3*x4
 A[1]=x3+x7+x10
 A[2]=x19*x36+x43*x45*x50
 over variables x_1,.. x_50.
 But each function contains at most 10 variables.
 I want to calculate the balancedness of each function.

 I have done the following:

 from sage.crypto.boolean_function import BooleanFunction
 R=PolynomialRing(GF(2),'x',2^8)
 x=R.gens()
 S1=A[0]
 xx=S1.variables()
 l=len(xx)
 P=BooleanPolynomialRing(l,map(str,xx))
 f=BooleanFunction(A[0])
 f.is_balanced()

 But it does now work.
 How can it be possible in Sage?

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Dependence set of a symbolic expression

2011-12-01 Thread Santanu Sarkar
Hello,
Let S be a symbolic expression of a certain number of variables taken
from a particular set of variables. How do I find out the list of the
distinct variables that S depends on?
Suppose {x0,x1,x2,x3,x4,x5,x6,x7,x8,x9} is a set of unknowns and S =
x1 + x3*x4 + x5*x7*x9. I need to find the subset {x1,x3,x4,x5,x7,x9}
on which S depends. How to do this in sage?

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Chinese Remainder Theorem

2011-09-23 Thread Santanu Sarkar
Thank you.

On 23 September 2011 10:38, D. S. McNeil dsm...@gmail.com wrote:

 On Fri, Sep 23, 2011 at 12:39 AM, Santanu Sarkar
 sarkar.santanu@gmail.com wrote:
  I want to find integer such that
  x= 1 mod 3
  x=2  mod 5
  x=3  mod 7
  like this system of congruences using Chinese Remainder Theorem.
  In Sage, crt() function takes only 4 argument.

 sage: help(CRT)

 crt(a, b, m=None, n=None)
Returns a solution to a Chinese Remainder Theorem problem.

INPUT:

- ``a``, ``b`` - two residues (elements of some ring for which
  extended gcd is available), or two lists, one of residues and
  one of moduli.
 [...]

If ``a`` and ``b`` are lists, returns a simultaneous solution to
the congruences `x\equiv a_i\pmod{b_i}`, if one exists.

.. SEEALSO::

- :func:`CRT_list`


 sage: CRT([1,2,3],[3,5,7])
 52
 sage: x = CRT([1,2,3],[3,5,7])
 sage: x % 3, x % 5, x % 7
 (1, 2, 3)


 Doug

 --
 To post to this group, send email to sage-support@googlegroups.com
 To unsubscribe from this group, send email to
 sage-support+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/sage-support
 URL: http://www.sagemath.org


-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Chinese Remainder Theorem

2011-09-22 Thread Santanu Sarkar
I want to find integer such that
x= 1 mod 3
x=2  mod 5
x=3  mod 7
like this system of congruences using Chinese Remainder Theorem.
In Sage, crt() function takes only 4 argument.

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] How to write Sage code to cython code

2011-09-17 Thread Santanu Sarkar
Hi all,

I want to use cython.

The following code does not work
%cython
cdef P
P = next_prime(ZZ.random_element(2^(100-1),2^100))

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] How to write Sage code to cython code

2011-09-17 Thread Santanu Sarkar
It always returns 101, not a random prime of 100 bit integer.

On 17 September 2011 18:04, Rajeev Singh rajs2...@gmail.com wrote:

 On Sat, Sep 17, 2011 at 5:46 PM, Santanu Sarkar
 sarkar.santanu@gmail.com wrote:
  Hi all,
 
  I want to use cython.
 
  The following code does not work
  %cython
  cdef P
  P = next_prime(ZZ.random_element(2^(100-1),2^100))
 
 
  --
  To post to this group, send email to sage-support@googlegroups.com
  To unsubscribe from this group, send email to
  sage-support+unsubscr...@googlegroups.com
  For more options, visit this group at
  http://groups.google.com/group/sage-support
  URL: http://www.sagemath.org
 

 Try this -

 %cython
 from sage.all import *
 cdef P
 P = next_prime(ZZ.random_element(2^(100-1),2^100))
 print P

 Rajeev

 --
 To post to this group, send email to sage-support@googlegroups.com
 To unsubscribe from this group, send email to
 sage-support+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/sage-support
 URL: http://www.sagemath.org


-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] How to write Sage code to cython code

2011-09-17 Thread Santanu Sarkar
Thank you.
Is there any function in Python for inverse modulo of an integer?
Corresponding Sage function is  A=15.inverse_mod(17).
Also is there any function like
''.join(str(i) for i in A)  in Python for an array A?



On 17 September 2011 19:36, D. S. McNeil dsm...@gmail.com wrote:

  It always returns 101, not a random prime of 100 bit integer.

 That's because in Python/Cython, the carat ^ isn't exponentiation,
 it's bitwise xor.  The most general solution is to use **:

 Python 2.7.2 (v2.7.2:8527427914a2, Jun 11 2011, 15:22:34)
 [GCC 4.2.1 (Apple Inc. build 5666) (dot 3)] on darwin
 Type help, copyright, credits or license for more information.
  2^(100-1)
 97
  2^(100)
 102
  2**(100-1)
 633825300114114700748351602688L
  2**(100)
 1267650600228229401496703205376L


 Doug

 --
 To post to this group, send email to sage-support@googlegroups.com
 To unsubscribe from this group, send email to
 sage-support+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/sage-support
 URL: http://www.sagemath.org


-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: Need to Express integers as 6 bit

2011-09-01 Thread Santanu Sarkar
Dear Maarten,
  Sorry for delay. Version of my Chrome is 5.0.375.70.
I have written programs in SAGE 4.2 over Linux Ubuntu 8.04 on a computer
with Dual CORE Intel(R) Pentium(R).

With regards,
Santanu


On 26 August 2011 13:46, Maarten Derickx m.derickx.stud...@gmail.comwrote:

 Dear Santanu,

 I work myself with sage an google chrome to and it's working for me. See
 below for an example. Could you please tell me which version of Chrome you
 are running and on which operating system. The version of sage you are using
 (or the adress of the webserver). And could you also please tell if you
 experience the same problem in other browsers then chrome.


 https://lh4.googleusercontent.com/-Lrtv1pNpb0c/TldVyWL_KeI/A2k/YppkHTiVRDA/tab_completion.jpg


 --
 To post to this group, send email to sage-support@googlegroups.com
 To unsubscribe from this group, send email to
 sage-support+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/sage-support
 URL: http://www.sagemath.org


-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


Re: [sage-support] Re: Need to Express integers as 6 bit

2011-09-01 Thread Santanu Sarkar
For mozilla firefox, it is perfect. I dont known about other browsers.

On 1 September 2011 15:30, Maarten Derickx m.derickx.stud...@gmail.comwrote:

 Maybe it's time to install a newer version of sage. 4.2 is quite old now,
 the latest stable release is now 4.7.1. Could you please, still also answer
 my question if it is only in chrome or also in other browsers you have
 installed?

 --
 To post to this group, send email to sage-support@googlegroups.com
 To unsubscribe from this group, send email to
 sage-support+unsubscr...@googlegroups.com
 For more options, visit this group at
 http://groups.google.com/group/sage-support
 URL: http://www.sagemath.org


-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


[sage-support] Inverse of a polynomial

2011-08-25 Thread Santanu Sarkar
How to calculate inverse of a polynomial f(x) modulo g(x) in the finite
field GF(2^10)?

-- 
To post to this group, send email to sage-support@googlegroups.com
To unsubscribe from this group, send email to 
sage-support+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/sage-support
URL: http://www.sagemath.org


  1   2   >