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 somethine like this: > > f1 = lambda x:1 > f2 = lambda x:x+2 > f = piecewise([[[0,1],f1]]) > f(f2) > > and it fails with: > > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "/Users/houp/.sage/sage_notebook/worksheets/admin/1/code/5.py", > line 7, in <module> > f(f2) > File "/Applications/sage/local/lib/python2.5/site-packages/sympy/ > plotting/", line 1, in <module> > > File "/Applications/sage/local/lib/python2.5/site-packages/sage/ > functions/piecewise.py", line 584, in __call__ > raise ValueError,"Value not defined outside of domain." > ValueError: Value not defined outside of domain. > > The problem is that when sage tries to composite those functions it > does not change the domain of f. On one hand it would be usefull to > have it calculate f2([0,1]) and use it as new domain, on the other > hand if f2 would be more complex it could be hard to calculate the > image f2([0,1]). But anyway I'm wondering if it's possible to make any > use of piecewise functions compositing? > > Best regards, > Witold Bołt. > > > >
--~--~---------~--~----~------------~-------~--~----~ To post to this group, send email to sage-support@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/sage-support URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---