[sage-support] Re: Integration issue

2012-05-15 Thread Jason Grout

On 5/15/12 9:42 PM, Jason Grout wrote:


Anyway, I'm not going to do anything about it in the near future, so
I'll note my wish that the above had a deprecation warning and go back
to grading.


At the very least, we should maybe print out a message saying that we 
are going to assume that the horizontal axis represents the variable x.


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


[sage-support] Re: Integration issue

2012-05-15 Thread Jason Grout

On 5/15/12 9:35 PM, kcrisman wrote:



On Tuesday, May 15, 2012 10:27:17 PM UTC-4, Jason Grout wrote:

On 5/15/12 9:17 PM, Keshav Kini wrote:
 > plot(x^2, (0, 1))

I definitely think that should give a deprecation warning (I think I've
been advocating for that to give a deprecation warning for a long
time).
For example, I think this is confusing:

plot(x^2+y-x^2,(0,1))


Yes yes, we've had this conversation before. Then maybe we shouldn't
simplify such things automatically, in which case a warning would
actually make sense - who actually types in "x^2+y-x^2" to plot it in
one variable? Like Keshav said, this answers its own question - I can't
remember ever having had an actual support request on this issue. On the
most basic commands, requiring extra syntactical sugar is a recipe for
stultification, and plot is surely one of those commands. I really don't
think we need to get that language legalistic on things like this.


The point is that I can't tell if a function f is actually a function of 
one variable because simplification is Hard.  The example above is 
contrived, but illustrates the point that we may have no idea what is 
being plotted.  Explicit is better than implicit, etc.


You're right that we've had I don't know how many emails and threads 
over this issue.  I guess I still haven't changed my mind.  One big 
thing for making the syntax above illegal is that right now there is a 
very ugly wart in the code special-casing that case, and it is 
inconsistent with how other things work (for example, note the confusion 
on this thread).


Anyway, I'm not going to do anything about it in the near future, so 
I'll note my wish that the above had a deprecation warning and go back 
to grading.


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


[sage-support] Re: Integration issue

2012-05-15 Thread kcrisman


On Tuesday, May 15, 2012 10:27:17 PM UTC-4, Jason Grout wrote:
>
> On 5/15/12 9:17 PM, Keshav Kini wrote: 
> > plot(x^2, (0, 1)) 
>
> I definitely think that should give a deprecation warning (I think I've 
> been advocating for that to give a deprecation warning for a long time). 
>   For example, I think this is confusing: 
>
> plot(x^2+y-x^2,(0,1)) 
>
>
Yes yes, we've had this conversation before.  Then maybe we shouldn't 
simplify such things automatically, in which case a warning would actually 
make sense - who actually types in "x^2+y-x^2" to plot it in one variable? 
 Like Keshav said, this answers its own question - I can't remember ever 
having had an actual support request on this issue.   On the most basic 
commands, requiring extra syntactical sugar is a recipe for stultification, 
and plot is surely one of those commands.  I really don't think we need to 
get that language legalistic on things like this.

-- 
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 9:17 PM, Keshav Kini wrote:

plot(x^2, (0, 1))


I definitely think that should give a deprecation warning (I think I've 
been advocating for that to give a deprecation warning for a long time). 
 For example, I think this is confusing:


plot(x^2+y-x^2,(0,1))

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


[sage-support] Re: Integration issue

2012-05-15 Thread Keshav Kini
Jason Grout  writes:
> 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?

For example:

sage: plot(x^2, (0, 1))

sage:

-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


[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


[sage-support] Re: Integration issue

2012-05-15 Thread Keshav Kini
kcrisman  writes:
> On Tuesday, May 15, 2012 2:36:34 AM UTC-4, Keshav Kini wrote:
> 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.

I don't know if I agree. I mean, certainly it makes sense to integrate
symbolic expressions and to plot them, but the point of the deprecation
warning is that you should specify which variable you want to integrate
with respect to, or plot with respect to.

Then again, with plot(), if there's more than one free variable in the
symbolic expression, it doesn't make sense to plot it anyway. The same
is true of numerical integration (though not of symbolic integration).
So I guess I answered my own question.

Note: the above reasoning doesn't apply to plot3d() - there is still
ambiguity as to which of two free variables should be on the x axis and
which on the y axis. And maybe that's why plot3d(), unlike plot(), does
seem to generate 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: 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  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: import MatLab code into Sage

2012-05-15 Thread Jason Grout

On 5/15/12 5:20 PM, fu7ur3 wrote:

Hi,

may I ask you to help me converting matlab code into sage and also could
you please tell me how to run this code in sage afterwards?
I've followed this link
http://ask.sagemath.org/question/1416/import-matlab-code-into-sage but
the online OMPC translator seems to have problems translating these
functions - ubplot(221); imshow(obr); title('Original image');
Here is a link where you can download those matlabs codes for converting
http://www.ulozto.net/xnLgR7b/dwt-swt-zip
The reason for creating this ticket is that I'm running out of time. I
have to do this till the end of this week. If not I've finished my
studies :( My task was to do the wavelet transform in various programs
and sage is the only problem. I would be grateful for your help.


I would suggest that *you* try translating it into Sage, and ask us 
specific questions about specific parts if you get stuck.


Those commands above are probably easiest to do in straight matplotlib. 
 See http://matplotlib.sourceforge.net/ (matplotlib code usually works 
well in Sage).  You might also try running the matlab code in Octave: 
http://www.gnu.org/software/octave/.


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


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

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


Re: [sage-support] Re: Group action

2012-05-15 Thread Nathann Cohen
> IMHO most of the time is spent on IPC, via pexpect...

Oh, *THAT* is pexpect ? Then I guess I begin to understand why there
was so much fuss about it being slow some time ago ^^;

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


[sage-support] Install Sage 4.8 on Ubuntu 12.04 from a PPA

2012-05-15 Thread Jan Groenewald
Dear Mohamed,

Try

apt-add-repository ppa:aims/sagemath
apt-get update
apt-get install sagemath-upstream-binary

Regards,
Jan

On 15 May 2012 18:38, Mohamed Lamine Diallo wrote:

> 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 
>
>>   Today's Topic Summary
>>
>> Group: http://groups.google.com/group/sage-support/topics
>>
>>- Making a copy of a 
>> MixedIntegerLinearProgram<#137516f1ffa3fcb1_137513d7e049c617_group_thread_0>[9
>>  Updates]
>>- Integration issue<#137516f1ffa3fcb1_137513d7e049c617_group_thread_1>[7 
>> Updates]
>>- Application/Use of Sage in IT company or 
>> Industries<#137516f1ffa3fcb1_137513d7e049c617_group_thread_2>[1 Update]
>>- Group action <#137516f1ffa3fcb1_137513d7e049c617_group_thread_3> [8
>>Updates]
>>
>>   Making a copy of a 
>> MixedIntegerLinearProgram
>>
>>Emil  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  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  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  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  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 follo

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 

>   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 
> MixedIntegerLinearProgram
>
>Emil  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  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  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  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  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  May 15 02:47PM +0100
>
>>I've found MILP lets you do it this way:
>
> 

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

2012-05-15 Thread Emil
On 15 May 2012 15:21, Nathann Cohen  wrote:
> 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 :-)

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

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

2012-05-15 Thread kcrisman



> > (%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. 
>
>
Great, I didn't realize some code had changed - I get this same thing below 
in 5.27.0.

 

> 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. 
>
>
If all integrals still work with domain:complex, we could conceivably set 
this in the integration code.  However, we *already* set `domain:complex` 
in the startup code for the "calculus" copy of Maxima for exactly this 
reason... so I guess that this would be fixed by upgrading Maxima?
 

> > 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 Robert Dodier
On 2012-05-15, kcrisman  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] 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


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


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


[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


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

2012-05-15 Thread Emil
On 15 May 2012 13:38, john_perry_usm  wrote:
>I've found MILP lets you do it this way:
>
>     sage: x, y = lp[0], lp[1]

Ahh! Thanks, this is what I need. (Is this documented anywhere?) - 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: Application/Use of Sage in IT company or Industries

2012-05-15 Thread Dima Pasechnik


On Sunday, 13 May 2012 19:36:13 UTC+2, Robert Miller wrote:
>
> On Sunday, May 13, 2012 5:12:32 AM UTC-7, William wrote:
>>
>> On Sun, May 13, 2012 at 6:51 AM, Dima wrote: 
>> > recently there was a post on sage-devel from Robert Miller (who wrote 
>> > quite a bit of Sage code): 
>> > https://groups.google.com/d/msg/sage-devel/Hz9tagOntyg/CZLpRcF8XAkJ 
>> > soliciting job applications from Sage developers. 
>> > 
>> > So this is an example of Sage use in industry. 
>>
>> Nowhere in the message does he say that they actually use Sage.The 
>> closest is  "We do the math, using a lot of open source Python 
>> software  as well as our own secret sauce. We also make contributions 
>> back to the tools we use, as we understand the importance of open 
>> source." 
>>
>
> Well spotted! In fact it's probably hard to classify in general. The full 
> story: we don't use Sage in production, but we use several of its 
> components, including atlas, numpy, scipy, R. I have made extensive use of 
> Sage in prototyping things. In fact I've actually ported some of the Python 
> 2.7 code we have to be compatible with 2.6 so that I can import our 
> libraries in a Sage environment.
>
>
>  
quid.com would neither confirm nor deny they use Sage :-)
 

> I think that Sage can be a very hard sell for sysadmin/ops type people in 
> industry, because it is a very big install and the latest versions aren't 
> available through debian or things like pip or easy_install. Although we 
> here all realize that Sage Just Works, when someone in that sort of role 
> looks at Sage as a project that might need to be installed on their 
> production servers, they easily bristle. That's what happened at my job, so 
> instead we are installing the pieces that we need individually (and again 
> Sage was a big help as we consulted it a few times to fix 
> compilation/linking issues that had already been solved in the Sage distro).
>

yeah, sysadmins tend to be PITAs. They have to justify their existence, so 
they want to spend 10 times more time and effort to install and maintain a 
part of Sage rather than using Sage as it is :-)
They even think that easy_install and pip and debian always work...
 

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


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


Re: [sage-support] Re: Group action

2012-05-15 Thread Dima Pasechnik


On Tuesday, 15 May 2012 09:54:15 UTC+2, Nathann Cohen wrote:
>
> > 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 
>

IMHO most of the time is spent on IPC, via pexpect...
 

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


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

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