Unfortunately, the piecewise class was written before the symbolic
expressions class and has not kept pace.
The obvious solution produced this:
sage: signal = Piecewise([[(0,1), cos(2*pi*1*x)], [(-1, 0), 0*x]])
sage: signal.integral(definite=True)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
/Users/wdj/.sage/temp/jeeves.home/2806/_Users_wdj__sage_init_sage_0.py
in <module>()
/Users/wdj/sagefiles/sage-4.2.1/local/lib/python2.6/site-packages/sage/functions/piecewise.pyc
in integral(self, x, a, b, definite)
787 fun_integrated = fun.integral(x, end, x)
788 else:
--> 789 fun_integrated = fun.integral(x, start, x) + area
790 if definite or end != infinity:
791 area += fun.integral(x, start, end)
/Users/wdj/sagefiles/sage-4.2.1/local/lib/python2.6/site-packages/sage/symbolic/expression.so
in sage.symbolic.expression.Expression.integral
(sage/symbolic/expression.cpp:25344)()
/Users/wdj/sagefiles/sage-4.2.1/local/lib/python2.6/site-packages/sage/calculus/calculus.pyc
in integral(expression, v, a, b, algorithm)
635 else:
636 try:
--> 637 result = expression._maxima_().integrate(v, a, b)
638 except TypeError, error:
639 s = str(error)
/Users/wdj/sagefiles/sage-4.2.1/local/lib/python2.6/site-packages/sage/interfaces/maxima.pyc
in integral(self, var, min, max)
2023 if max is None:
2024 raise ValueError, "neither or both of min/max
must be specified."
-> 2025 return I(var, min, max)
2026
2027 integrate = integral
/Users/wdj/sagefiles/sage-4.2.1/local/lib/python2.6/site-packages/sage/interfaces/expect.pyc
in __call__(self, *args, **kwds)
1402
1403 def __call__(self, *args, **kwds):
-> 1404 return self._obj.parent().function_call(self._name,
[self._obj] + list(args), kwds)
1405
1406 def help(self):
/Users/wdj/sagefiles/sage-4.2.1/local/lib/python2.6/site-packages/sage/interfaces/expect.pyc
in function_call(self, function, args, kwds)
1310 [
s.name() for s in args],
1311
['%s=%s'%(key,
value.name()) for key, value in kwds.items()])
-> 1312 return
self.new(s)
1313
1314 def _function_call_string(self, function, args, kwds):
/Users/wdj/sagefiles/sage-4.2.1/local/lib/python2.6/site-packages/sage/interfaces/expect.pyc
in new(self, code)
1094
1095 def new(self, code):
-> 1096 return self(code)
1097
1098 ###################################################################
/Users/wdj/sagefiles/sage-4.2.1/local/lib/python2.6/site-packages/sage/interfaces/expect.pyc
in __call__(self, x, name)
1029
1030 if isinstance(x, basestring):
-> 1031 return cls(self, x, name=name)
1032 try:
1033 return self._coerce_from_special_method(x)
/Users/wdj/sagefiles/sage-4.2.1/local/lib/python2.6/site-packages/sage/interfaces/expect.pyc
in __init__(self, parent, value, is_name, name)
1445 except (TypeError, KeyboardInterrupt,
RuntimeError, ValueError), x:
1446 self._session_number = -1
-> 1447 raise TypeError, x
1448 self._session_number = parent._session_number
1449
TypeError: Computation failed since Maxima requested additional
constraints (try the command 'assume(x>0)' before integral or limit
evaluation, for example):
Is x positive, negative, or zero?
> --
> To post to this group, send email to
sage-s...@googlegroups.com
> To unsubscribe from this group, send email to
sage-support...@googlegroups.com
> For more options, visit this group at
http://groups.google.com/group/sage-support
> URL:
http://www.sagemath.org
>