ASKSAGE: Sage Q&A Forum - Individual question feedhttp://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Wed, 13 Mar 2013 11:48:53 -0500case distinction in symbolic expressionhttp://ask.sagemath.org/question/9907/case-distinction-in-symbolic-expression/Is it possible to include a case distinction in a symbolic expression?
More precisely, I'm currently trying to understand how to include a [truncated power function](http://en.wikipedia.org/wiki/Truncated_power_function) into a symbolic expression, if that is at all possible.Wed, 13 Mar 2013 06:25:38 -0500http://ask.sagemath.org/question/9907/case-distinction-in-symbolic-expression/Answer by ndomes for <p>Is it possible to include a case distinction in a symbolic expression?</p>
<p>More precisely, I'm currently trying to understand how to include a <a href="http://en.wikipedia.org/wiki/Truncated_power_function">truncated power function</a> into a symbolic expression, if that is at all possible.</p>
http://ask.sagemath.org/question/9907/case-distinction-in-symbolic-expression/?answer=14647#post-id-14647To distinct two cases you can use the heaviside function:
f(x) = heaviside(x)*x^2
print type(f)
f(2); f(0); f(-2)Wed, 13 Mar 2013 11:48:53 -0500http://ask.sagemath.org/question/9907/case-distinction-in-symbolic-expression/?answer=14647#post-id-14647