[sage-support] Re: Integration bug?

2018-10-02 Thread Simon King
On 2018-10-02, kcrisman wrote: > Please do. It's likely something related to > https://trac.sagemath.org/ticket/21440 and > https://trac.sagemath.org/wiki/symbolics#Integrationtickets where you can > browse to your heart's content :-) For some reason the wrong branch seems > to get chosen by

[sage-support] Re: Integration bug?

2018-10-02 Thread kcrisman
On Monday, October 1, 2018 at 4:55:14 PM UTC-4, Simon King wrote: > > Hi! > > I get the following with sage-8.4.beta5: > sage: f(x) = cos(pi*x) > sage: (f(x)*exp(-I*pi*x)).integral(x)(x=1/2) - > (f(x)*exp(-I*pi*x)).integral(x)(x=-1/2) > 1/2 > sage: (f(x)*exp(-I*pi*x)).integral(x,-1/

[sage-support] Re: Integration bug?

2017-10-27 Thread kcrisman
> integral(sqrt(1+cos(x)^2),x,0,pi) > > > > 0 > > The bug appears to be tickled by the Maxima package abs_integrate. > Without abs_integrate, integrate(sqrt(1 + cos(x)^2), x, 0, %pi) just > returns a noun expression. > > > Zero is decidedly not correct. The problem is apparently here:

[sage-support] Re: Integration bug?

2017-10-26 Thread Robert Dodier
On 2017-10-26, david.guichard wrote: > integral(sqrt(1+cos(x)^2),x,0,pi) > > 0 The bug appears to be tickled by the Maxima package abs_integrate. Without abs_integrate, integrate(sqrt(1 + cos(x)^2), x, 0, %pi) just returns a noun expression. > Zero is decidedly not correct. The problem is a

[sage-support] Re: Integration of formal functions

2013-07-28 Thread Emmanuel Charpentier
Comments and (horrible !) workaround in Trac#14976 . HTH, Emmanuel Charpentier [ Snip ... ] -- You received this message because you are subscribed to the Google Groups "s

[sage-support] Re: Integration of formal functions

2013-07-27 Thread Robert Dodier
On 2013-07-27, Emmanuel Charpentier wrote: > (%i2) define(h(x),integrate(f(t),t,g1(x),g2(x))); > > defint: lower limit of integration must be real; found g1(x) > -- an error. To debug this try: debugmode(true); Well, a way to make this work is to write define(h(x), 'integrate(...)). 'integrate

[sage-support] Re: Integration of formal functions

2013-07-27 Thread Emmanuel Charpentier
By the way, the problem *might* be larger than that. In Maxima, one can do : (%i1) display2d:false; (%o1) false (%i2) define(h(x),integrate(f(t),t,g1(x),g2(x))); defint: lower limit of integration must be real; found g1(x) -- an error. To debug this try: debugmode(true); (%i3) declare(g1,real,

[sage-support] Re: Integration of formal functions

2013-07-27 Thread Emmanuel Charpentier
The problem seems to lie on Sage's side. In the "native" version of sage : Maxima 5.30.0 http://maxima.sourceforge.net using Lisp GNU Common Lisp (GCL) GCL 2.6.7 (a.k.a. GCL) Distributed under the GNU Public License. See the file COPYING. Dedicated to the memory of William Schelter. The function b

[sage-support] Re: Integration issue

2012-05-17 Thread kcrisman
> > >>> > Yes, it does. Our assumptions go through Maxima, and apparently assuming > a variable is complex does the job. > > sage: a = integrate(x*cos(x^3),(x,0,0.5)).n() > sage: assume(x,'complex') > sage: b = integrate(x*cos(x^3),(x,0,0.5)).n() > sage: assumptions() > [x is complex] > Actuall

[sage-support] Re: Integration issue

2012-05-17 Thread kcrisman
On Thursday, May 17, 2012 1:52:38 AM UTC-4, ketchers wrote: > > > > > I don't know how to get sage to understand "domain : complex" so I tried > with assume and here is what happened. Does it make sense? > > >> Yes, it does. Our assumptions go through Maxima, and apparently assuming a variabl

[sage-support] Re: Integration issue

2012-05-16 Thread ketchers
I don't know how to get sage to understand "domain : complex" so I tried with assume and here is what happened. Does it make sense? On Sunday, May 13, 2012

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

[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

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

[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

[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

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

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

[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

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

[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

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

[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) /op

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

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

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

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

[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

[sage-support] Re: Integration bug?

2012-03-29 Thread kcrisman
On Tuesday, March 27, 2012 4:25:48 PM UTC-4, david.guichard wrote: > > I've tried this on my 4.6 sage and on 5.0 beta; the main sagenb.org is > not returning calculations for me. Both 4.6 and 5.0 have the same error. > This double integral calculation is correct: > > var("r t") > f=integral(sq

[sage-support] Re: Integration

2011-02-08 Thread achrzesz
One can also use scipy (faster) or mpmath (very slow) sage: import scipy.integrate sage: scipy.integrate.dblquad(lambda x,y:abs(cos(x+y)),0,pi,lambda x: 0,lambda x:pi) (6.2831850310568189, 8.0696816340264377e-08) sage: n(2*pi) 6.28318530717959 sage: from mpmath import * sage: mp.dps = 50; mp.pre

[sage-support] Re: Integration

2011-02-07 Thread Robert Dodier
On Feb 7, 12:00 pm, Francois Maltey wrote: > Santanu Sarkar a crit : > > > How one can find integral abs(cos(x+y)) where x varies from 0 to pi > > and y varies from 0 to pi in Sage? > > You must help Sage (in fact Maxima bellow) for these integrals. The Maxima add-on package abs_integrate can ma

[sage-support] Re: Integration

2011-02-07 Thread BFJ
It's 2*pi since the integral of abs(cos(x+y)) from x=0 to pi is 2 (independent of y). But here's how you can get Sage to compute a numerical integral for you: sage: f = lambda y: numerical_integral( lambda x: abs(cos(x+y)), 0, pi )[0] sage: f(0.0001) 1.0001 sage: numerical_integral( f,

[sage-support] Re: Integration of piecewise function

2009-12-13 Thread Paul Butler
David, thanks for making me aware of this, I wasn't following the thread. It looks like two things are happening. First, the multiplication of piecewise functions results in some of the elements (the 0's) of the piecewise function becoming Polynomial_rational_dense instances. It looks like integr

Re: [sage-support] Re: Integration of piecewise function

2009-12-13 Thread David Joyner
I'm cc'ing Paul Butler who wrote that method. Paul, are you following this thread? On Sun, Dec 13, 2009 at 3:32 PM, Eugene Goldberg wrote: > So... There is no solution? > > On Dec 9, 6:03 pm, Sand Wraith wrote: >> Does anyone know is this issue only for newest version? (may be I >> should use

[sage-support] Re: Integration of piecewise function

2009-12-13 Thread Eugene Goldberg
So... There is no solution? On Dec 9, 6:03 pm, Sand Wraith wrote: > Does anyone know is this issue only for newest version? (may be I > should use older version of sage) > > On 8 дек, 21:47, David Joyner wrote: > > > Unfortunately, the piecewise class was written before the symbolic > > expressi

[sage-support] Re: Integration of piecewise function

2009-12-09 Thread Sand Wraith
Does anyone know is this issue only for newest version? (may be I should use older version of sage) On 8 дек, 21:47, David Joyner wrote: > Unfortunately, the piecewise class was written before the symbolic > expressions class and has not kept pace. > > The obvious solution produced this: > > sage