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