[sage-support] Re: Making a copy of a MixedIntegerLinearProgram

2012-05-14 Thread Nathann Cohen
Hellooo Emil !!!

Well, I just tried something and it ended upi crashing Sage, so I can just 
advise you to create all your variables in the first LP from the start, 
*then* to copy the MixedIntegerLinearProgram object. Of course it is a bad 
answer :-)

John Perry was the one who needed this copy() feature for MILP and he was 
doing things similar to the ones you attempt. As I only had integer 
programs in mind when I wrote this class (hence hard problems to solve. 
hence the times it takes to generate the LP is totally small compared to 
the rest) I am totally ready to admit that it is not very suited to such 
computations. Dima mentionned recently that we may create some 
"LinearProgram" class at some point which would be thought *for* this type 
of problems, but I would fint it hard to write it myself considering that 
that would not be a user of it Hence no clue of what should be possible 
or not with it :-)

Nathann

-- 
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: Integration issue

2012-05-14 Thread Keshav Kini
John H Palmieri  writes:
> This works for me:
>
> sage: numerical_integral(x*cos(x^3), 0, 0.5)
> (0.1247560409610376, 1.3850702913602309e-15)

Interesting...


sage: numerical_integral(x*cos(x^3), 0, 0.5)
(0.1247560409610376, 1.3850702913602309e-15)
sage: (x*cos(x^3))(0)
/opt/sage-5.0.rc1/local/lib/python2.7/site-packages/IPython/iplib.py:2260: 
DeprecationWarning: Substitution using function-call syntax and unnamed 
arguments is deprecated and will be removed from a future release of Sage; you 
can use named arguments instead, like EXPR(x=..., y=...)
  exec code_obj in self.user_global_ns, self.user_ns
0

Why does numerical_integral() not trigger the deprecation warning?

-Keshav


Join us in #sagemath on irc.freenode.net !

-- 
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: Group action

2012-05-14 Thread Mike Hansen
On Mon, May 14, 2012 at 11:20 PM, Nathann Cohen  wrote:
>> One thing to watch out for is that the generators returned by
>> automorphism_group contain symbols that may not be the actual vertices. I
>> realised this once after several frustrating hours of bizarre results from
>> my program. I'm not sure if this is still the case in recent versions.
>
> Yep. I wasted 30 minutes easily on that one too. Actually the elements
> are always 1...n regardless of the graph's labelling (which often
> starts at 0). That's a shame.

This is because permutation groups used to not support arbitrary
domains.  Since they do now, it should be easy to return an
automorphism group that actually acts on the vertices.

--Mike

-- 
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: Integration issue

2012-05-14 Thread Robert Dodier
On 2012-05-14, JamesHDavenport  wrote:

> It may be "branch cut strangeness", but if so it is very strange. The 
> integrand is clearly well-behaved, and the integral,
> while in terms of the incomplete gamma function, seems to be off the usual 
> branch cut (negative real axis).

Try domain:complex before calling integrate; that changes the result to
what I think is expected.

I guess (emphasis on guess) that the problem originates not from
gamma_incomplete itself but from terms of the form (-1)^(1/n) which are
the result of simplifying or evaluating gamma_incomplete. Sorry I can't
be more helpful.

best,

Robert Dodier

-- 
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: Group action

2012-05-14 Thread Nathann Cohen
> One thing to watch out for is that the generators returned by
> automorphism_group contain symbols that may not be the actual vertices. I
> realised this once after several frustrating hours of bizarre results from
> my program. I'm not sure if this is still the case in recent versions.

Yep. I wasted 30 minutes easily on that one too. Actually the elements
are always 1...n regardless of the graph's labelling (which often
starts at 0). That's a shame.

Nathann

-- 
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: Group action

2012-05-14 Thread Emil
One thing to watch out for is that the generators returned by 
automorphism_group contain symbols that may not be the actual vertices. I 
realised this once after several frustrating hours of bizarre results from my 
program. I'm not sure if this is still the case in recent versions. 

Emil

On 15 May 2012, at 00:04, Dima Pasechnik  wrote:

> 
> 
> On Tuesday, 15 May 2012 01:02:46 UTC+2, Dima Pasechnik wrote:
> 
> 
> On Monday, 14 May 2012 16:57:40 UTC+2, Nathann Cohen wrote:
> Hellooo everybody !!! 
> 
> I would like to play with groups in Sage but I do not know how. I 
> actually get my groups from a graph in the following way : 
> 
> sage: g = graphs.PetersenGraph() 
> sage: ag = g.automorphism_group() 
> sage: type(ag) 
>  'sage.groups.perm_gps.permgroup.PermutationGroup_generic_with_category'> 
> 
> What I would like to do with this group is to consider it as a group 
> action on my vertices and compute the orbits of some *sets* of 
> vertices. Indeed, the method ag.orbits() would give me the list of all 
> orbits of my vertices, but I would like to compute the orbit of a Set 
> of vertices, that is all sets of the form "gg * my_set for gg in ag". 
> 
> Is there any way to achieve it with Sage ? 
> 
> Well, you can call GAP,  e.g. as follows:
> 
> sage: gap("Orbit("+str(ag._gap_())+",[1,2,7],OnSets);")
> [ [ 1, 2, 7 ], [ 1, 2, 3 ], [ 1, 6, 9 ], [ 2, 3, 4 ], [ 3, 4, 10 ], 
>   [ 1, 6, 8 ], [ 3, 4, 8 ], [ 4, 9, 10 ], [ 4, 7, 9 ], [ 5, 8, 10 ], 
>   [ 2, 5, 7 ], [ 5, 6, 8 ], [ 3, 5, 8 ], [ 4, 6, 9 ], [ 5, 7, 10 ], 
>   [ 5, 7, 9 ], [ 6, 7, 9 ], [ 3, 6, 8 ], [ 1, 6, 10 ], [ 2, 7, 9 ], 
>   [ 1, 2, 10 ], [ 2, 3, 8 ], [ 6, 8, 9 ], [ 1, 5, 10 ], [ 2, 3, 7 ], 
>   [ 1, 4, 10 ], [ 5, 7, 8 ], [ 3, 4, 9 ], [ 4, 5, 10 ], [ 1, 2, 6 ] ]
> sage: 
>  
> PS. it should not be hard to expand the ag.orbit method to incorporate the 
> action type...
> 
>  
> 
> Thaank youu  
> 
> Nathann 
> -- 
> 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] Making a copy of a MixedIntegerLinearProgram

2012-05-14 Thread Emil
I would like to solve a large number of very similar linear programs.
More specifically I would like to be able to

1) Create a MixedIntegerLinearProgram, and add some constraints.
2) Keep this MILP somewhere.
3) (Repeated many times) Take a copy of the saved MILP, add a few more
constraints specific to this problem instance, and solve it.

The difficulty I have is that I am unclear how to add new constraints
that include previous variables. Suppose I do

lp = MixedIntegerLinearProgram(maximization=True)
x = lp.new_variable()

Then I do:

nlp = copy(lp)
x = nlp.new_variable()

The variable 'x' now seems to contain different variables. So I cannot
add any constraints that use the existing variables. Or is there some
way to do this? Thanks,

Emil

-- 
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: Group action

2012-05-14 Thread Dima Pasechnik


On Tuesday, 15 May 2012 01:02:46 UTC+2, Dima Pasechnik wrote:
>
>
>
> On Monday, 14 May 2012 16:57:40 UTC+2, Nathann Cohen wrote:
>>
>> Hellooo everybody !!! 
>>
>> I would like to play with groups in Sage but I do not know how. I 
>> actually get my groups from a graph in the following way : 
>>
>> sage: g = graphs.PetersenGraph() 
>> sage: ag = g.automorphism_group() 
>> sage: type(ag) 
>> > 'sage.groups.perm_gps.permgroup.PermutationGroup_generic_with_category'> 
>>
>> What I would like to do with this group is to consider it as a group 
>> action on my vertices and compute the orbits of some *sets* of 
>> vertices. Indeed, the method ag.orbits() would give me the list of all 
>> orbits of my vertices, but I would like to compute the orbit of a Set 
>> of vertices, that is all sets of the form "gg * my_set for gg in ag". 
>>
>> Is there any way to achieve it with Sage ? 
>>
>
> Well, you can call GAP,  e.g. as follows:
>
> sage: gap("Orbit("+str(ag._gap_())+",[1,2,7],OnSets);")
> [ [ 1, 2, 7 ], [ 1, 2, 3 ], [ 1, 6, 9 ], [ 2, 3, 4 ], [ 3, 4, 10 ], 
>   [ 1, 6, 8 ], [ 3, 4, 8 ], [ 4, 9, 10 ], [ 4, 7, 9 ], [ 5, 8, 10 ], 
>   [ 2, 5, 7 ], [ 5, 6, 8 ], [ 3, 5, 8 ], [ 4, 6, 9 ], [ 5, 7, 10 ], 
>   [ 5, 7, 9 ], [ 6, 7, 9 ], [ 3, 6, 8 ], [ 1, 6, 10 ], [ 2, 7, 9 ], 
>   [ 1, 2, 10 ], [ 2, 3, 8 ], [ 6, 8, 9 ], [ 1, 5, 10 ], [ 2, 3, 7 ], 
>   [ 1, 4, 10 ], [ 5, 7, 8 ], [ 3, 4, 9 ], [ 4, 5, 10 ], [ 1, 2, 6 ] ]
> sage: 
>  
>
PS. it should not be hard to expand the ag.orbit method to incorporate the 
action type...

 

>
>> Thaank youu  
>>
>> Nathann 
>>
>

-- 
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: Group action

2012-05-14 Thread Dima Pasechnik


On Monday, 14 May 2012 16:57:40 UTC+2, Nathann Cohen wrote:
>
> Hellooo everybody !!! 
>
> I would like to play with groups in Sage but I do not know how. I 
> actually get my groups from a graph in the following way : 
>
> sage: g = graphs.PetersenGraph() 
> sage: ag = g.automorphism_group() 
> sage: type(ag) 
>  'sage.groups.perm_gps.permgroup.PermutationGroup_generic_with_category'> 
>
> What I would like to do with this group is to consider it as a group 
> action on my vertices and compute the orbits of some *sets* of 
> vertices. Indeed, the method ag.orbits() would give me the list of all 
> orbits of my vertices, but I would like to compute the orbit of a Set 
> of vertices, that is all sets of the form "gg * my_set for gg in ag". 
>
> Is there any way to achieve it with Sage ? 
>

Well, you can call GAP,  e.g. as follows:

sage: gap("Orbit("+str(ag._gap_())+",[1,2,7],OnSets);")
[ [ 1, 2, 7 ], [ 1, 2, 3 ], [ 1, 6, 9 ], [ 2, 3, 4 ], [ 3, 4, 10 ], 
  [ 1, 6, 8 ], [ 3, 4, 8 ], [ 4, 9, 10 ], [ 4, 7, 9 ], [ 5, 8, 10 ], 
  [ 2, 5, 7 ], [ 5, 6, 8 ], [ 3, 5, 8 ], [ 4, 6, 9 ], [ 5, 7, 10 ], 
  [ 5, 7, 9 ], [ 6, 7, 9 ], [ 3, 6, 8 ], [ 1, 6, 10 ], [ 2, 7, 9 ], 
  [ 1, 2, 10 ], [ 2, 3, 8 ], [ 6, 8, 9 ], [ 1, 5, 10 ], [ 2, 3, 7 ], 
  [ 1, 4, 10 ], [ 5, 7, 8 ], [ 3, 4, 9 ], [ 4, 5, 10 ], [ 1, 2, 6 ] ]
sage: 
 

>
> Thaank youu  
>
> Nathann 
>

-- 
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] Group action

2012-05-14 Thread David Joyner
On Mon, May 14, 2012 at 10:57 AM, Nathann Cohen  wrote:
> Hellooo everybody !!!
>
> I would like to play with groups in Sage but I do not know how. I
> actually get my groups from a graph in the following way :
>
> sage: g = graphs.PetersenGraph()
> sage: ag = g.automorphism_group()
> sage: type(ag)
>  'sage.groups.perm_gps.permgroup.PermutationGroup_generic_with_category'>
>
> What I would like to do with this group is to consider it as a group
> action on my vertices and compute the orbits of some *sets* of
> vertices. Indeed, the method ag.orbits() would give me the list of all
> orbits of my vertices, but I would like to compute the orbit of a Set
> of vertices, that is all sets of the form "gg * my_set for gg in ag".
>
> Is there any way to achieve it with Sage ?

The short answer is yes, if you use GAP. The problem is that I don't
know the syntax for group actions in GAP well enough to give you a
beter answer quickly. If you post a specific question to GAP support, I think
it would be answered immediately.


>
> Thaank youu 
>
> Nathann
>
> --
> 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] Re: Integration issue

2012-05-14 Thread JamesHDavenport
It may be "branch cut strangeness", but if so it is very strange. The 
integrand is clearly well-behaved, and the integral,
while in terms of the incomplete gamma function, seems to be off the usual 
branch cut (negative real axis).

On Monday, 14 May 2012 15:35:01 UTC+1, Robert Dodier wrote:
>
> On 2012-05-14, kcrisman  wrote: 
>
> > This is now http://trac.sagemath.org/sage_trac/ticket/12947.  We've had 
> > some issues with incomplete gamma functions translating properly in the 
> > past, and/or errors in Maxima, but I didn't have time to either look 
> into 
> > that or whether there was another ticket open for this, apologies if 
> there 
> > is one - just wanted to make sure this was opened. 
>
> My first guess is that there is branch cut strangeness going on. Sorry, 
> I don't have any details. But if you want to investigate, try 
> integrate(x*cos(x^3), x, 0, u) and then differentiate w.r.t. u, as a 
> point of departure. 
>
> best, 
>
> Robert Dodier 
>
>
>

-- 
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: Integration issue

2012-05-14 Thread John H Palmieri
On Sunday, May 13, 2012 8:46:41 PM UTC-7, ketchers wrote:
>
> Sage returns negative value for the integral of a positive function 
> x*cos(x^3) on (0,0.5), if I use abs(cos(x^3))*x, then it gets it correct?
>
>
This works for me:

sage: numerical_integral(x*cos(x^3), 0, 0.5)
(0.1247560409610376, 1.3850702913602309e-15)

-- 
John

-- 
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] Group action

2012-05-14 Thread Nathann Cohen
Hellooo everybody !!!

I would like to play with groups in Sage but I do not know how. I
actually get my groups from a graph in the following way :

sage: g = graphs.PetersenGraph()
sage: ag = g.automorphism_group()
sage: type(ag)


What I would like to do with this group is to consider it as a group
action on my vertices and compute the orbits of some *sets* of
vertices. Indeed, the method ag.orbits() would give me the list of all
orbits of my vertices, but I would like to compute the orbit of a Set
of vertices, that is all sets of the form "gg * my_set for gg in ag".

Is there any way to achieve it with Sage ?

Thaank youu 

Nathann

-- 
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: Integration issue

2012-05-14 Thread Robert Dodier
On 2012-05-14, kcrisman  wrote:

> This is now http://trac.sagemath.org/sage_trac/ticket/12947.  We've had 
> some issues with incomplete gamma functions translating properly in the 
> past, and/or errors in Maxima, but I didn't have time to either look into 
> that or whether there was another ticket open for this, apologies if there 
> is one - just wanted to make sure this was opened.

My first guess is that there is branch cut strangeness going on. Sorry,
I don't have any details. But if you want to investigate, try
integrate(x*cos(x^3), x, 0, u) and then differentiate w.r.t. u, as a
point of departure.

best,

Robert Dodier


-- 
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: Integration issue

2012-05-14 Thread kcrisman
This is now http://trac.sagemath.org/sage_trac/ticket/12947.  We've had 
some issues with incomplete gamma functions translating properly in the 
past, and/or errors in Maxima, but I didn't have time to either look into 
that or whether there was another ticket open for this, apologies if there 
is one - just wanted to make sure this was opened.

- kcrisman

On Sunday, May 13, 2012 11:46:41 PM UTC-4, ketchers wrote:
>
> Sage returns negative value for the integral of a positive function 
> x*cos(x^3) on (0,0.5), if I use abs(cos(x^3))*x, then it gets it correct?
>
>
> 
>
>
>
>

-- 
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: Application/Use of Sage in IT company or Industries

2012-05-14 Thread David Kirkby
On 14 May 2012 05:23, William Stein  wrote:

>> * Code is depreciated quite regularly,
>
> deprecated.   "depreciated" is a completely different word.

Sorry. An unfortunate error, though I could think of worst words with
a similar spelling!

Dave

-- 
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] Integration issue

2012-05-14 Thread ketchers


Sage returns negative value for the integral of a positive function 
x*cos(x^3) on (0,0.5), if I use abs(cos(x^3))*x, then it gets it correct?





-- 
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] Unintuitive behavior of round()

2012-05-14 Thread Zimmermann Paul
   Hi Lorenzo,

the strange behaviour of round() is explained in the documentation:

sage: u.round?
...
   This method evaluates an expression in "RR" first and rounds the
   result. This may lead to misleading results.

sage: RR(u).round()
207855083711803936
sage: RealField(100)(u).round()
207855083711803945

Paul Zimmermann

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