Re: [sage-support] Boolean Polynomial ring

2017-08-25 Thread David Joyner
On Fri, Aug 25, 2017 at 4:03 PM,   wrote:
> i am new in sage. and i want to define an array of dimension 79 and every
> time i want to save a new value in each array shell i.e. for i in range(79)
> a[i]= any value and also i want define a vector. can you help me out?
>

I'm not such what your exact question is, but I'll try to answer.

Once you have a list L of numbers, say rationals, you can define a
vector using the
syntax

v = vector(QQ,L)

To define a list, you can use a command like

L = [1/(i^2+1) for in range(79)]

More on Python lists can be found here:
https://docs.python.org/2/tutorial/datastructures.html

Hope this answers your question.


> --
> 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] Boolean Polynomial ring

2017-08-25 Thread santu . pal
i am new in sage. and i want to define an array of dimension 79 and every 
time i want to save a new value in each array shell i.e. for i in range(79) 
a[i]= any value and also i want define a vector. can you help me 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 https://groups.google.com/group/sage-support.
For more options, visit https://groups.google.com/d/optout.


[sage-support] Boolean polynomial ring works with .sage but not with .spyx extension

2014-03-19 Thread Prakash Dey
Consider this program (in Ubuntu 12.04 LTS)

#!/usr/bin/sage
from sage.all import *
R.a,b,c=BooleanPolynomialRing()
print (a+b+c)*(a+b)

it runs perfectly when run as a .sage file and produces the output
   a*c + a + b*c +b

but produces the following error when run with .spyx extension.

R.a,b,c=BooleanPolynomialRing()
 ^


_home_pdey_t_spyx_0.pyx:9:2: Expected an identifier

what is the problem 

-- 
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] Boolean Polynomial Ring variety computation problem

2009-03-10 Thread Florian

Hello everyone!

I am running Sage Version 3.2.3, Release Date: 2009-01-05 in a virtual
machine under Windows Vista.

I am trying to compute the variety of an ideal in a Boolean Polynomial
Ring. From what I have seen in previous posts, that doesn't seem to
work directly. So instead I use the Boolean Polynomial Ring setting to
compute the Groebner Basis of the ideal and then produce an ideal in
the corresponding polynomial ring over F_2 on which I then invoke the
variety command.
Although it does work for very small systems, I get a reproducible
error when increasing the system's size. It does not seem to be a
resource problem, though. Maybe I am doing something wrong? Any help
would be greatly appreciated!

The first set of instructions works fine:

{{{id=0|
B.x1,x2,x3,x4=BooleanPolynomialRing(4,order='lex')
I=ideal([x1+x2,x4-x1])
I2 = ideal([B(f) for f in I.gens()])
G=I2.groebner_basis()
GG=Ideal(G)
R.x1,x2,x3,x4=PolynomialRing(GF(2),4,order='lex')
GB = ideal([R(f) for f in G]) + ideal(sage.rings.ideal.FieldIdeal(R))
GB.variety()
///

[{x2: 0, x1: 0, x4: 0, x3: 0}, {x2: 0, x1: 0, x4: 0, x3: 1}, {x2: 1,
x1: 1, x4: 1, x3: 0}, {x2: 1, x1: 1, x4: 1, x3: 1}]
}}}

Now I increase the size to 20 variables. Still works fine. Now with 30
variables:

{{{id=2|
%time
B.x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,x17,x18,x19,x20,x21,x22,x23,x24,x25,x26,x27,x28,x29,x30=BooleanPolynomialRing
(30,order='lex')
I1=ideal([x13*x15 + x1*x7*x13*x25 + x9*x22 + x17 + x18 + x3 + x13,1 +
x6*x21 + x3,x2*x18 + 1 + x16*x25,x15 + x9 + x1*x10*x20,x23 +
x9*x21*x23*x27 + x25 + x7,x13 + x1*x4*x15 + x6*x24 + 1 + x26*x27 +
x3,1 + 1,1 + x13 + x22*x28 + x1*x29,x8 + x11*x29 + x15*x18 +
x5*x11,x3*x9 + 1 + 1,x8,x14 + x14 + x6*x16*x28 + x6 + x13 +
x23,x1*x15*x17 + 1 + x7 + x8 + x3 + x3*x15 + x12*x13*x25 +
x3,x26,x4*x7*x8 + x3*x7 + x15*x17 + x15 + 1,x3*x17*x26*x28 +
x2*x14*x20*x21 + x5*x18*x28 + x30,x5*x6 + x12 + x28 + x3*x25 + x12,1 +
x7 + x16*x23 + 1 + 1,x1*x12*x24 + x4*x22*x26 + x6,x19*x21 + x2*x5*x9 +
1 + x21 + x6,x30 + x13,x17 + x10*x11 + x3 + x10 + x7*x8*x18,x14 +
x7*x8*x11 + x5*x21 + x2*x15*x19 + x5*x7,x20*x21 + x15*x18*x19 +
x9*x10,x2*x8*x10*x19*x22 + x8 + x14 + x16*x24 + x16*x21 + x29,x9*x25 +
x10*x17*x18 + x2*x19 + x22*x25 + x6*x22*x25,x25 + x6 + x8*x26 +
x10*x23 + x29 + x12 + x30 + x4*x13,x22 + x24 + x26 + x2 + x30 +
x6*x10*x16 + x20,0,x28 + x8 + x9 + x2 + x15*x18*x29 + x16])
I2 = ideal([B(f) for f in I1.gens()])
G=I2.groebner_basis(faugere=False,linear_algebra_in_last_block=False)
GG=Ideal(G)
R.x1,x2,x3,x4,x5,x6,x7,x8,x9,x10,x11,x12,x13,x14,x15,x16,x17,x18,x19,x20,x21,x22,x23,x24,x25,x26,x27,x28,x29,x30=PolynomialRing
(GF(2),30,order='lex')
GB = ideal([R(f) for f in G]) + ideal(sage.rings.ideal.FieldIdeal(R))
GB.variety()
///

Traceback (most recent call last):
  File stdin, line 1, in module
  File /home/notebook/sage_notebook/worksheets/admin/15/code/16.py,
line 16, in module
exec compile(ur'GB.variety()' + '\n', '', 'single')
  File /usr/local/sage/local/lib/python2.5/site-packages/
zope.interface-3.3.0-py2.5-linux-i686.egg/, line 1, in module

  File /usr/local/sage/local/lib/python2.5/site-packages/sage/rings/
polynomial/multi_polynomial_ideal.py, line 1532, in variety
T = self.triangular_decomposition('singular:triangLfak')
  File /usr/local/sage/local/lib/python2.5/site-packages/sage/rings/
polynomial/multi_polynomial_ideal.py, line 781, in
triangular_decomposition
Tbar = Ibar.triangLfak()
  File /usr/local/sage/local/lib/python2.5/site-packages/sage/
interfaces/expect.py, line 1292, in __call__
return self._obj.parent().function_call(self._name, [self._obj] +
list(args), kwds)
  File /usr/local/sage/local/lib/python2.5/site-packages/sage/
interfaces/expect.py, line 1212, in function_call
['%s=%s'%(key,value.name()) for key, value in kwds.items()])))
  File /usr/local/sage/local/lib/python2.5/site-packages/sage/
interfaces/expect.py, line 1030, in new
return self(code)
  File /usr/local/sage/local/lib/python2.5/site-packages/sage/
interfaces/singular.py, line 593, in __call__
return SingularElement(self, type, x, False)
  File /usr/local/sage/local/lib/python2.5/site-packages/sage/
interfaces/singular.py, line 1009, in __init__
raise TypeError, x
TypeError: Singular error:
// ** redefining zerlegt
   ? wrong range[4] in ideal/module(3)
   ? error occurred in triang.lib::invertieren_oT line 433: `
T_bis_k = T[1..(k-1)];`
   ? leaving triang.lib::invertieren_oT
   ? wrong range[21] in ideal/module(3)
   ? error occurred in triang.lib::Erw_ggt_oT line 509: `parameter
poly f; parameter  poly g; parameter  int v; parameter  ideal T;  `
   ? wrong type declaration. type 'help poly;'
   ? leaving triang.lib::Erw_ggt_oT
   ? `f` is undefined
   ? error occurred in triang.lib::Erw_ggt_oT line 511: `poly p1 =
f;`
   ? expected poly-expression. type 'help poly;'
   ? leaving triang.lib::Erw_ggt_oT
   skipping text from `;` error at token `)`
   ? leaving triang.lib::invertieren_oT
   ?