[sage-support] Re: 2nd try: Integer solutions for systems of linear equations

2012-09-14 Thread Nathann Cohen
Helloo !!!

To consider the problem as linear program and use 
 MixedIntegerLinearProgram()  with integer constrains works, but it is very 
 very slow for larger systems.


Well, your problem is *precisely* what Integer Linear Program solvers are 
written for, so I guess that using them is the good way to go unless you 
plan on using some properties of the matrices you generate (and that the LP 
solvers would not notice) to solve your equation.

They are indeed slow in some cases, but we have to work with the tools 
available, or rather those we know about. ILP's what I would try to do 
myself -- if you find some other way to solve these equations please let me 
know, for I use them very often and I would be delighted to solve my graph 
problems faster too :-)

By the way, in Sage MixedIntegerLinearProgram uses GLPK by default to solve 
these problems, but you can also ask it to solve them with Gurobi or CPLEX, 
which are usually *MUCH* faster.

Good luck ! :-)

Nathann

-- 
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] Re: Is google groups buggy? Test posting

2012-09-14 Thread Harald Schilly


On Thursday, September 13, 2012 9:44:52 AM UTC+2, moritz wrote:

 Two days ago I tried to post on this list, using the UI of google groups. 
 The message did not appear on sage-support ..


I reported this in detail, that's all I can do :-(

H (group admin) 

-- 
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] Re: 2nd try: Integer solutions for systems of linear equations

2012-09-14 Thread Victor Miller
Since the OP's problem has no inequalities (such as requiring that all 
integers in question are non-negative), it is solved by using Hermite 
normal form.

If A is an m by n integer matrix, the Hermite normal form of A is an upper 
triangular integer matrix H (also m by n), along with an m by m integer 
matrix of determinant 1 (i.e. it's invertible) so that H = U A.  So the 
original equation A x = b becomes (after multiplying by U): H x = U b, for 
which it's easy to get the general solution (just back solve.  If you ever 
get a non-integer by dividing there are no solutions).  Since U is 
invertible, multiplying the equation by U doesn't introduce spurious 
solutions.

Victor

On Friday, September 14, 2012 5:46:01 AM UTC-4, Nathann Cohen wrote:

 Helloo !!!

 To consider the problem as linear program and use 
 MixedIntegerLinearProgram()  with integer constrains works, but it is very 
 very slow for larger systems.


 Well, your problem is *precisely* what Integer Linear Program solvers are 
 written for, so I guess that using them is the good way to go unless you 
 plan on using some properties of the matrices you generate (and that the LP 
 solvers would not notice) to solve your equation.

 They are indeed slow in some cases, but we have to work with the tools 
 available, or rather those we know about. ILP's what I would try to do 
 myself -- if you find some other way to solve these equations please let me 
 know, for I use them very often and I would be delighted to solve my graph 
 problems faster too :-)

 By the way, in Sage MixedIntegerLinearProgram uses GLPK by default to 
 solve these problems, but you can also ask it to solve them with Gurobi or 
 CPLEX, which are usually *MUCH* faster.

 Good luck ! :-)

 Nathann


-- 
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] Re: Splitting a notebook

2012-09-14 Thread Jason Grout

On 9/14/12 10:20 AM, Victor Miller wrote:

There are times when I've added a bunch of cells to a notebook, and then
I realize that I'd like to make those cells into a separate notebook.
Is there a straightforward way of doing this?  I know that I can cut and
paste individual cells, but that gets rather tedious.



I would go to the Edit view of the worksheet (upper right of 
worksheet) and then copy whatever cells I want.  Open up a new 
worksheet, click Edit in the new worksheet, paste, and save.


Thanks,

Jason



--
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: 2nd try: Integer solutions for systems of linear equations

2012-09-14 Thread Nathann Cohen
 Since the OP's problem has no inequalities (such as requiring that all
 integers in question are non-negative), it is solved by using Hermite
normal
 form.

 If A is an m by n integer matrix, the Hermite normal form of A is an upper
 triangular integer matrix H (also m by n), along with an m by m integer
 matrix of determinant 1 (i.e. it's invertible) so that H = U A.  So the
 original equation A x = b becomes (after multiplying by U): H x = U b, for
 which it's easy to get the general solution (just back solve.  If you ever
 get a non-integer by dividing there are no solutions).  Since U is
 invertible, multiplying the equation by U doesn't introduce spurious
 solutions.

**Applause**

Well... Thank you for teaching me that :-)

Nathann

-- 
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] Re: 2nd try: Integer solutions for systems of linear equations

2012-09-14 Thread Jason Grout

On 9/14/12 10:18 AM, Victor Miller wrote:

Since the OP's problem has no inequalities (such as requiring that all
integers in question are non-negative), it is solved by using Hermite
normal form.

If A is an m by n integer matrix, the Hermite normal form of A is an
upper triangular integer matrix H (also m by n), along with an m by m
integer matrix of determinant 1 (i.e. it's invertible) so that H = U A.
So the original equation A x = b becomes (after multiplying by U): H x =
U b, for which it's easy to get the general solution (just back solve.
If you ever get a non-integer by dividing there are no solutions).
Since U is invertible, multiplying the equation by U doesn't introduce
spurious solutions.


And for completeness, you can get hermite form by using the 
.hermite_form method:



sage: a=random_matrix(ZZ,5)
sage: a.hermite_form()
[  1   0   0   0  35]
[  0   1   0   0  73]
[  0   0   1   0  40]
[  0   0   0   1  51]
[  0   0   0   0 103]
sage: a.hermite_form(transformation=True)
(
[  1   0   0   0  35]  [ -37 -108   28  -10   97]
[  0   1   0   0  73]  [ -77 -224   58  -21  201]
[  0   0   1   0  40]  [ -44 -128   33  -12  115]
[  0   0   0   1  51]  [ -59 -172   44  -16  154]
[  0   0   0   0 103], [-110 -321   83  -30  288]
)


Thanks,

Jason


--
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: Splitting a notebook

2012-09-14 Thread Jeroen Demeyer
On 2012-09-14 17:25, Jason Grout wrote:
 On 9/14/12 10:20 AM, Victor Miller wrote:
 There are times when I've added a bunch of cells to a notebook, and then
 I realize that I'd like to make those cells into a separate notebook.
 Is there a straightforward way of doing this?  I know that I can cut and
 paste individual cells, but that gets rather tedious.

 
 I would go to the Edit view of the worksheet (upper right of
 worksheet) and then copy whatever cells I want.  Open up a new
 worksheet, click Edit in the new worksheet, paste, and save.

Alternatively, you can copy the worksheet (there is a menu option for
that) and then from both worksheets delete the parts that you don't want.

-- 
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] Sagenb.org

2012-09-14 Thread Dan Aldrich
Haven't been able to access sagenb.org or .com for over a day. Is 
this a long term outage?


Thank you,
-d


--
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] Strange sum() result and can't be evaluated numerically

2012-09-14 Thread Renan Birck Pinheiro
The command sum( ((-1)^k*(x^(2*k+1))/factorial(2*k+1)),k,0,oo) should give
sin(x) - it does in Mathematica. But in Sage it gives

1/2*sqrt(pi)*sqrt(2)*sqrt(x)*bessel_j(1/2, x)

which can't be evaluated numerically:

_(x=3).N()

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(Xyh4PTMpLk4oKQ==),globals())+\\n);
execfile(os.path.abspath(___code___.py))
  File , line 1, in module

  File /tmp/tmpMc56sG/___code___.py, line 3, in module
exec compile(u'_(x=_sage_const_3 ).N()
  File , line 1, in module

  File expression.pyx, line 4319, in
sage.symbolic.expression.Expression._numerical_approx
(sage/symbolic/expression.cpp:20837)
TypeError: cannot evaluate symbolic expression numerically

What am I missing here? I am using Sage 5.3.

Thanks!

--
Renan Birck Pinheiro - Grupo de MicroeletrĂ´nica
Engenharia Elétrica - UFSM - Santa Maria, Brasil
http://renanbirck.blogspot.com - +55 55 91162798

-- 
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.