[sage-support] Re: Piecewise Function Fails to Evaluate in its Domain

2019-04-04 Thread brandonhgomes
But the original *does* evaluate at positive PI. print(f(pi)) # 0 This is a bug. On Wednesday, April 3, 2019 at 2:47:31 PM UTC-4, brando...@gmail.com wrote: > > The simplest example: > > f = piecewise([[[-pi-1, -pi/2], 0], [(-pi/2,pi/2), 1], [[pi/2, pi+1], 0]]) > print(f(-pi)) > > which gives th

[sage-support] Re: [piecewise] AttributeError: ComplexField_class_with_category object has no attribute complex_field

2017-10-30 Thread Ralf Stephan
On Sunday, October 29, 2017 at 11:14:54 AM UTC+1, Marcel Partap wrote: > > Is it that piecewise functions are not yet fully fledged out, > This, unfortunately. -- You received this message because you are subscribed to the Google Groups "sage-support" group. To unsubscribe from this group and s

[sage-support] Re: [piecewise] AttributeError: ComplexField_class_with_category object has no attribute complex_field

2017-10-29 Thread Marcel Partap
like basically, why don't the piecewise functions collapse to scalars? This should result in the same output, no? M_vec(x) = vector([M_Tx(x), M_by(x), M_bz(x)]).column() M_vec(x = l1) M_vec_l1 = vector([M_Tx(l1), M_by(x=l1), M_bz(x=l1)]).column() M_vec_l1 gives instead [

[sage-support] Re: Piecewise function

2016-02-12 Thread Nils Bruin
On Friday, February 12, 2016 at 6:45:20 AM UTC-8, João Alberto Ferreira wrote: > > > Thank you for the sugestions but, unfortunatelly, the options above plot > the function as it was a continuous function. The only way I could find to > p lot the function correctly is as in > http://www.sagemat

[sage-support] Re: Piecewise function

2016-02-12 Thread João Alberto Ferreira
On Thursday, February 11, 2016 at 9:04:16 PM UTC-2, Nils Bruin wrote: > > On Thursday, February 11, 2016 at 11:32:45 AM UTC-8, João Alberto Ferreira > wrote: >> >> 1) Isn't there a way to pass to the Piecewise function if the intervals >> are open or closed at its borders, so as, in the example

[sage-support] Re: Piecewise function

2016-02-11 Thread Nils Bruin
On Thursday, February 11, 2016 at 11:32:45 AM UTC-8, João Alberto Ferreira wrote: > > 1) Isn't there a way to pass to the Piecewise function if the intervals > are open or closed at its borders, so as, in the example above, g(x) could > be evaluated to 25 instead of 35/2? > It doesn't seem to b

Re: [sage-support] Re: piecewise

2012-12-02 Thread David Smith
p2+p3) > > -d > > -Original Message- > From: kcrisman > Sent: Nov 30, 2012 10:45 PM > To: sage-s...@googlegroups.com > Subject: [sage-support] Re: piecewise > > >> Is there something better? I tried to get piecewise to work, but I >> couldn'

Re: [sage-support] Re: piecewise

2012-12-01 Thread daldrich
- From: kcrisman Sent: Nov 30, 2012 10:45 PM To: sage-support@googlegroups.com Subject: [sage-support] Re: piecewise Is there something better?  I tried to get piecewise to work, but I couldn't plot, integrate, etc., the function. f=piecewise([((1,2), x^2), ((2,3), sin(x))]) plot(f, (

[sage-support] Re: piecewise

2012-11-30 Thread kcrisman
> > > Is there something better? I tried to get piecewise to work, but I > couldn't plot, integrate, etc., the function. > > f=piecewise([((1,2), x^2), ((2,3), sin(x))]) > plot(f, (x,0,3)) # error, but plot(f) works... > integrate(f, (x,1,3)) # error, but integrate(f) works > diff(f,x) # err

[sage-support] Re: Piecewise functions that are discontinuous in one point

2011-06-07 Thread kcrisman
On Jun 7, 9:58 pm, Felipo Bacani wrote: > Hello. > > How do I define a piecewise function that are discontinuous in one point? > I mean, how do I define a piecewise function f(x) if it is like >         x    if 0 f(x)=2    if x=1 >         2-x if 1 > If I try the command below: > > sage: f= Piec

[sage-support] Re: Piecewise function definition

2009-10-27 Thread David Joyner
On Tue, Oct 27, 2009 at 10:55 AM, all_thumbs wrote: > Hi Dave, > > On Jul 22, 12:56 am, David Joyner wrote: > ... >> I'm not sure what you are going to do with yourfunction. >> If it is just for plotting, say, I think you might just want to use >> >> def f(x,y): >>     if : >>        return >>

[sage-support] Re: Piecewise Function gotcha - bug or feature?

2009-10-15 Thread kcrisman
On Oct 15, 4:12 pm, erikson1970 wrote: > Piecewise Function: endpoint gotcha - bug or feature? > It seems that the piecewise function (which requires overlapping > endpoints for the specified function intervals) does some unadvertised > averaging for results for values at the endpoints. > > See

[sage-support] Re: Piecewise function definition

2009-07-21 Thread Laurent
> I'm doing numerical minimization on it right now and the only reason I > want/need it to be a sage function is so I can .subs() real values for > my parameters. To get around that, I'm just going to use global > variables for my parameters. It's kind of ugly, but it will work. It > would be

[sage-support] Re: Piecewise function definition

2009-07-21 Thread Doug
> I'm not sure what you are going to do with your function. > If it is just for plotting, say, I think you might just want to use > > def f(x,y): >     if : >        return >     if : >        return >    etc I'm doing numerical minimization on it right now and the only reason I want/need it t

[sage-support] Re: Piecewise function definition

2009-07-21 Thread David Joyner
On Tue, Jul 21, 2009 at 6:08 PM, Doug wrote: > >> Piecewise functions of 2 variables are not yet implemented. >> Sorry. > > Ah, I see. If there was were primitive functions for LessThan(x,y), > Equal(x,y), and GreaterThan(x,y), and they returned 0 or 1, I think > that's all I would need: > > f(x,

[sage-support] Re: Piecewise function definition

2009-07-21 Thread Doug
> Piecewise functions of 2 variables are not yet implemented. > Sorry. Ah, I see. If there was were primitive functions for LessThan(x,y), Equal(x,y), and GreaterThan(x,y), and they returned 0 or 1, I think that's all I would need: f(x,y) = y + LessThan(x,pi/2)*f1(x) + Equal(x,pi/2)*f2(x) + Gre

[sage-support] Re: Piecewise function definition

2009-07-21 Thread David Joyner
On Tue, Jul 21, 2009 at 5:35 PM, Doug wrote: > >> Are you aware of the function piecewise(), which seems to do what you >> want? If there is a problem with using it, what is it? > > I wasn't aware of piecewise(), and although it doesn't seem as elegant > or flexible as being able to use Indicator

[sage-support] Re: Piecewise function definition

2009-07-21 Thread Doug
> Are you aware of the function piecewise(), which seems to do what you > want?  If there is a problem with using it, what is it? I wasn't aware of piecewise(), and although it doesn't seem as elegant or flexible as being able to use Indicator functions in my function definitions, I think it sho

[sage-support] Re: Piecewise function definition

2009-07-21 Thread Marshall Hampton
Are you aware of the function piecewise(), which seems to do what you want? If there is a problem with using it, what is it? M. Hampton On Jul 21, 12:34 pm, Doug wrote: > I'm trying to do something that seems very simple but isn't working. > Hence the post here :) > > I want to define a very s

[sage-support] Re: piecewise defined functions and composition

2008-06-11 Thread David Joyner
I don't think composition of piecewise functions has been implemented yet. 2008/6/11 houp <[EMAIL PROTECTED]>: > > Hello. > > I'd like to have some simple piecewise defined function like: > f = Piecewise([[[0,1],1]]) > and the composite it with some other function like > h = x - 1 > > I've tried s