Re: [sage-support] Re: Group action

2012-05-15 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


[sage-support] Re: Integration issue

2012-05-15 Thread Robert Dodier
On 2012-05-14, JamesHDavenport j.h.davenp...@bath.ac.uk 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-15 Thread Mike Hansen
On Mon, May 14, 2012 at 11:20 PM, Nathann Cohen nathann.co...@gmail.com 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: Making a copy of a MixedIntegerLinearProgram

2012-05-15 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


Re: [sage-support] Re: Group action

2012-05-15 Thread Nathann Cohen
 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 ] ]

THnk you Dima !! I finally got it to work thanks to you
Too me some time to find out that Gap would return a totally weird
error message if the list you give as an argument is not sorted, and I
guess most of the time it takes to run the computation is devoted to
translating Gap object to Sage ones afterwards, but It works !!
;-

(But Gap definitely has the worst syntax ever)

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: Making a copy of a MixedIntegerLinearProgram

2012-05-15 Thread Emil
Hi Nathann,

Thanks for writing the MILP class - it works very well. Now, I can do:

x = lp.new_variable()

Is there any way to do something like

x = lp.get_existing_variables()

?

I'm working on some graph theoretic stuff: I'm solving two LPs for
each graph, for as many graphs as I can. - Emil.



On 15 May 2012 08:00, Nathann Cohen nathann.co...@gmail.com wrote:
 By the way, could I ask you what lead you to create and solve many LP ? I
 mean, what are you solving which requires you to do that ? ^^;

 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: Making a copy of a MixedIntegerLinearProgram

2012-05-15 Thread john_perry_usm
On Monday, May 14, 2012 7:32:25 PM UTC-5, Emil wrote:

 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, 


x *should* contain different variables, for two reasons. First, nlp already 
has a variable (a copy of the one you created for lp), so if you ask nlp to 
create a new variable for it, it won't return the variable lp created 
earlier.

Second, after copying lp to nlp, you might want to change some variables in 
one from real to integer, or vice-versa.

Also, I don't think Sage has ever let you create variables  add 
constraints that way. I don't know why, but if I want a variable with a 
compact notation, I've found MILP lets you do it this way:

sage: x, y = lp[0], lp[1]

but NOT

sage: x, y = lp.new_variable(), lp.new_variable()

You'll get variables alright, but you can't add constraints using the 
second. The first works fine.

To add constraints, I usually do the following:

sage: lp = MixedIntegerLinearProgram(maximization=False)
sage: lp.add_constraint(2*lp[0] + 3*lp[1] = 1)
sage: nlp = copy(lp)
sage: nlp.add_constraint(3*lp[0] - 2*lp[1] = 1)

Or, if you like, use x, y, etc., defining them as I did above (the FIRST 
way).

regards
john perry

-- 
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-15 Thread kcrisman



  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. 



(%i5) display2d:false;

(%o5) false
(%i6) integrate(x*cos(x^3),x);

(%o6) (gamma_incomplete(2/3,%i*x^3)+gamma_incomplete(2/3,-%i*x^3))/6
(%i7) domain:complex;

(%o7) complex
(%i8) integrate(x*cos(x^3),x);

(%o8) ((sqrt(3)*%i-1)*gamma_incomplete(2/3,%i*x^3)
   +(-sqrt(3)*%i-1)*gamma_incomplete(2/3,-%i*x^3))
   *(x^3)^(1/3)
   /(12*x)

But the *definite* integral in both cases is wrong.  Any ideas?
 
(%i1) display2d:false;

(%o1) false
(%i2) integrate(x*cos(x^3),x,0,1/2);

(%o2) 
gamma_incomplete(2/3,%i/8)/6+gamma_incomplete(2/3,-%i/8)/6-gamma(2/3)/3
(%i3) domain:complex;

(%o3) complex
(%i4) integrate(x*cos(x^3),x,0,1/2);

(%o4) 
gamma_incomplete(2/3,%i/8)/6+gamma_incomplete(2/3,-%i/8)/6-gamma(2/3)/3


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. 


I don't see any of those up here, though, and the gamma_incomplete 
evaluation is correct (gives the same via W|A, Sage = Pari in my version, 
mpmath, and Maxima).  I think that Maxima is somehow using the real 
antiderivative, if that makes sense - is that possible, Robert?

-- 
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-15 Thread kcrisman


On Tuesday, May 15, 2012 2:36:34 AM UTC-4, Keshav Kini wrote:

 John H Palmieri jhpalmier...@gmail.com 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? 


The same reason that plot and integral don't, because we're not calling 
them in the same way.  It makes sense to integrate symbolic expressions and 
to plot them.  It's true that we need to unify our integration command 
syntax (see http://trac.sagemath.org/sage_trac/ticket/7763).

- kcrisman 

-- 
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: Making a copy of a MixedIntegerLinearProgram

2012-05-15 Thread Emil
Next issue is that the Gurobi backend doesn't support the copy:

AttributeError: 'sage.numerical.backends.gurobi_backend.GurobiBacke'
object has no attribute 'copy'

Any idea how much work this would be to do?

(I can now do what I wanted to do before, at least with GLPK.)

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


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

2012-05-15 Thread Nathann Cohen
Hellooo !!

 Next issue is that the Gurobi backend doesn't support the copy:

Oops ^^;

 Any idea how much work this would be to do?

Oh, it's usually quite straightforward to implement such things.
Usually the feature already exists in the solver's C api, and all the
work that needs to be done is to expose it in Sage :-)

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-15 Thread Robert Dodier
On 2012-05-15, kcrisman kcris...@gmail.com wrote:

 (%i3) domain:complex;

 (%o3) complex
 (%i4) integrate(x*cos(x^3),x,0,1/2);

 (%o4) 
 gamma_incomplete(2/3,%i/8)/6+gamma_incomplete(2/3,-%i/8)/6-gamma(2/3)/3

Hmm. I get a different result. I am using the current Git version.

domain : complex;
integrate (x*cos(x^3), x, 0, 1/2);
 =
%i*gamma_incomplete(2/3,%i/8)/(4*sqrt(3))
 -gamma_incomplete(2/3,%i/8)/12-%i*gamma_incomplete(2/3,-%i/8)/(4*sqrt(3))
 -gamma_incomplete(2/3,-%i/8)/12+gamma(2/3)/6
expand (float (%));
 = .1247560409610377

That's gratifying, but the problem, as I'm sure you know, is that the
user won't know they have to change a global variable.

 I don't see any of those up here, though, and the gamma_incomplete 
 evaluation is correct (gives the same via W|A, Sage = Pari in my version, 
 mpmath, and Maxima).  I think that Maxima is somehow using the real 
 antiderivative, if that makes sense - is that possible, Robert?

It seems plausible, but I don't know the integration code very well.

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] Digest for sage-support@googlegroups.com - 25 Messages in 4 Topics

2012-05-15 Thread Mohamed Lamine Diallo
Bonjour Monsieur,
je suis nouveau avec le logiciel sage, actuellement j'essaye d'installer la
version sage-4.8 sur Ubuntu 12.04 mais j'y arrive pas, s'il vous plait
aider moi à faire cette installation.
merci.

2012/5/15 sage-support@googlegroups.com

   Today's Topic Summary

 Group: http://groups.google.com/group/sage-support/topics

- Making a copy of a 
 MixedIntegerLinearProgram#137513d7e049c617_group_thread_0[9 Updates]
- Integration issue #137513d7e049c617_group_thread_1 [7 Updates]
- Application/Use of Sage in IT company or 
 Industries#137513d7e049c617_group_thread_2[1 Update]
- Group action #137513d7e049c617_group_thread_3 [8 Updates]

   Making a copy of a 
 MixedIntegerLinearProgramhttp://groups.google.com/group/sage-support/t/b84fede6c3081915

Emil emi...@gmail.com May 15 01:32AM +0100

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




Nathann Cohen nathann.co...@gmail.com May 14 11:51PM -0700

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




Nathann Cohen nathann.co...@gmail.com May 15 12:00AM -0700

By the way, could I ask you what lead you to create and solve many LP
? I
mean, what are you solving which requires you to do that ? ^^;

Nathann




Emil emi...@gmail.com May 15 11:47AM +0100

Hi Nathann,

Thanks for writing the MILP class - it works very well. Now, I can do:

x = lp.new_variable()

Is there any way to do something like

x = lp.get_existing_variables()

?

I'm working on some graph theoretic stuff: I'm solving two LPs for
each graph, for as many graphs as I can. - Emil.







john_perry_usm john.pe...@usm.edu May 15 05:38AM -0700

On Monday, May 14, 2012 7:32:25 PM UTC-5, Emil wrote:

 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,

x *should* contain different variables, for two reasons. First, nlp
already
has a variable (a copy of the one you created for lp), so if you ask
nlp to
create a new variable for it, it won't return the variable lp created
earlier.

Second, after copying lp to nlp, you might want to change some
variables in
one from real to integer, or vice-versa.

Also, I don't think Sage has ever let you create variables  add
constraints that way. I don't know why, but if I want a variable with
a
compact notation, I've found MILP lets you do it this way:

sage: x, y = lp[0], lp[1]

but NOT

sage: x, y = lp.new_variable(), lp.new_variable()

You'll get variables alright, but you can't add constraints using the
second. The first works fine.

To add constraints, I usually do the following:

sage: lp = MixedIntegerLinearProgram(maximization=False)
sage: lp.add_constraint(2*lp[0] + 3*lp[1] = 1)
sage: nlp = copy(lp)
sage: nlp.add_constraint(3*lp[0] - 2*lp[1] = 1)

Or, if you like, use x, y, etc., defining them as I did above (the
FIRST
way).

regards
john perry




Emil emi...@gmail.com May 15 02:47PM +0100

I've found MILP lets you do it this way:

 sage: x, y = lp[0], lp[1]

Ahh! 

Re: [sage-support] Digest for sage-support@googlegroups.com - 25 Messages in 4 Topics

2012-05-15 Thread kcrisman


Bonjour Monsieur,
 je suis nouveau avec le logiciel sage, actuellement j'essaye d'installer 
 la version sage-4.8 sur Ubuntu 12.04 mais j'y arrive pas, s'il vous plait 
 aider moi à faire cette installation.
 merci.



Can one of our French-speaking folks help this gentleman?  We already have 
great relations with AIMS in South Africa, and it would be great to be able 
to work well with the other AIMS sites.  

Maybe it IS time for multi-language sage-support, like the Spanish Maxima 
list 
(http://sourceforge.net/mailarchive/forum.php?forum_name=maxima-lang-es).

 

 -- 
 -
 *Mohamed Lamine DIALLO*
 *Ingénieur Informaticien*
 *Responsable Informatique*
 *AIMS-Sénégal /www.aims-senegal.sn http://www.aims-senegal.sn*
 *Tél: 77 655 3928 / 70 103 4960*
 -




-- 
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: Making a copy of a MixedIntegerLinearProgram

2012-05-15 Thread Emil
OK I'll take a look :)

On 15 May 2012 21:55, Nathann Cohen nathann.co...@gmail.com wrote:
 Hell Emil !!

 Any chance you could make a patch? :)   (I'd volunteer myself, but I
 would probably mess it up!)

 H I could, but this patch is so local that it really is an
 ideal occasion to write your first patch... Are you sure you do not
 want to give it a try ? It is fun to be a developper, you will feel
 like Sage becomes your home directory, and everybody will throw rocks
 at you you create new bugs.. And all all the while you will be
 having fun :-D

 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-15 Thread Jason Grout

On 5/15/12 8:33 PM, Keshav Kini wrote:

And maybe that's why plot3d(), unlike plot(), does
seem to generate the deprecation warning.


Sorry---what plot command doesn't generate a deprecation warning?

Thanks,

Jason


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