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.Mon, 30 Nov 2015 10:38:09 -0600Piecewise function of several variables and how to display ithttp://ask.sagemath.org/question/31087/piecewise-function-of-several-variables-and-how-to-display-it/Hi,
I need to define a piecewise function of several variables. For a function of one variable I would use probably `Piecewise`. I would like to work with a function G of two variables t and s that is of this form:
def G(t,s):
if (t < s):
return 1
else:
return 0
Although this works, I would like to have a nice displaying of this function, like a function generated by `Piecewise` does. Is there another way how to define this function?
Thu, 26 Nov 2015 07:32:15 -0600http://ask.sagemath.org/question/31087/piecewise-function-of-several-variables-and-how-to-display-it/Comment by A.P. for <p>Hi,
I need to define a piecewise function of several variables. For a function of one variable I would use probably <code>Piecewise</code>. I would like to work with a function G of two variables t and s that is of this form:</p>
<pre><code>def G(t,s):
if (t < s):
return 1
else:
return 0
</code></pre>
<p>Although this works, I would like to have a nice displaying of this function, like a function generated by <code>Piecewise</code> does. Is there another way how to define this function?</p>
http://ask.sagemath.org/question/31087/piecewise-function-of-several-variables-and-how-to-display-it/?comment=31206#post-id-31206I don't think so, although you could use `floor(min(1, s/t))`...Mon, 30 Nov 2015 10:38:09 -0600http://ask.sagemath.org/question/31087/piecewise-function-of-several-variables-and-how-to-display-it/?comment=31206#post-id-31206