[sage-support] Re: [sage-newbie] Re: integration of piecewise-defined functions

2008-01-14 Thread William Stein
On Jan 14, 2008 7:23 AM, Jaap Spies <[EMAIL PROTECTED]> wrote: > > William Stein wrote: > > On 1/14/08, John Cremona <[EMAIL PROTECTED]> wrote: > >> Jaap is right: > >> > >> Compare > >> > > > > I've created and posted a patch here: > > > >http://trac.sagemath.org/sage_trac/ticket/1776 > > > >

[sage-support] Re: [sage-newbie] Re: integration of piecewise-defined functions

2008-01-14 Thread Jaap Spies
William Stein wrote: > On 1/14/08, John Cremona <[EMAIL PROTECTED]> wrote: >> Jaap is right: >> >> Compare >> > > I've created and posted a patch here: > >http://trac.sagemath.org/sage_trac/ticket/1776 > > Refereeing would be appreciated! > Works for me! -

[sage-support] Re: [sage-newbie] Re: integration of piecewise-defined functions

2008-01-14 Thread William Stein
On 1/14/08, John Cremona <[EMAIL PROTECTED]> wrote: > > Jaap is right: > > Compare > I've created and posted a patch here: http://trac.sagemath.org/sage_trac/ticket/1776 Refereeing would be appreciated! > [EMAIL PROTECTED] > --

[sage-support] Re: [sage-newbie] Re: integration of piecewise-defined functions

2008-01-14 Thread William Stein
On 1/14/08, John Cremona <[EMAIL PROTECTED]> wrote: > > Jaap is right: > > Compare Excellent work tracking that down, which I would have never noticed. sage: preparse('f(x) = x') '_=var("x");f=symbolic_expression(x).function(x)' sage: preparse('f(x) =+x') 'f(x) =+x' sage: preparse('f(x) =-x') '

[sage-support] Re: [sage-newbie] Re: integration of piecewise-defined functions

2008-01-14 Thread John Cremona
Jaap is right: Compare [EMAIL PROTECTED] -- | SAGE Version 2.9.3, Release Date: 2008-01-05 | | Type notebook() for the GUI, and license() for information.| --

[sage-support] Re: [sage-newbie] Re: integration of piecewise-defined functions

2008-01-14 Thread Jaap Spies
William Stein wrote: > On 1/14/08, Jason Grout <[EMAIL PROTECTED]> wrote: >> I noticed that the following gives an error in Sage 2.9: >> >> sage: f(x)=-x >> >> File "", line 1 >> : can't assign to function call (> console>, line 1)

[sage-support] Re: [sage-newbie] Re: integration of piecewise-defined functions

2008-01-14 Thread William Stein
On 1/14/08, Jason Grout <[EMAIL PROTECTED]> wrote: > > John Cremona wrote: > > The problem is surely that the pieces f1a etc are just Python > > lambda-functions, yet the integral() method is being called on each of > > these in the line > > return sum([funcs[i].integral(x,invs[i][0],invs[i][1]) f

[sage-support] Re: [sage-newbie] Re: integration of piecewise-defined functions

2008-01-14 Thread Jason Grout
John Cremona wrote: > The problem is surely that the pieces f1a etc are just Python > lambda-functions, yet the integral() method is being called on each of > these in the line > return sum([funcs[i].integral(x,invs[i][0],invs[i][1]) for i in range(n)]) > so the problem arises since you are asking

[sage-support] Re: [sage-newbie] Re: integration of piecewise-defined functions

2008-01-14 Thread John Cremona
The problem is surely that the pieces f1a etc are just Python lambda-functions, yet the integral() method is being called on each of these in the line return sum([funcs[i].integral(x,invs[i][0],invs[i][1]) for i in range(n)]) so the problem arises since you are asking to integrate each funcs[i] bu

[sage-support] Re: [sage-newbie] Re: integration of piecewise-defined functions

2008-01-14 Thread David Joyner
At the moment, (a) "piecewise" is only set up for piecewise polynomials, (b) the "integrate" command is "integral". So, for your function (which is piecewise polynomial), this should work: sage: f1a = lambda x: -x+1; f1b = lambda x: x+1 sage: f2a = lambda x : -(x - 2) - 1; f2b = lambda x : (x - 2