ASKSAGE: Sage Q&A Forum - RSS feedhttps://ask.sagemath.org/questions/Q&A Forum for SageenCopyright Sage, 2010. Some rights reserved under creative commons license.Fri, 21 Jul 2017 18:23:17 +0200Piecewise Symbolic Function with Conditional Statementhttps://ask.sagemath.org/question/38347/piecewise-symbolic-function-with-conditional-statement/I wish to incorporate a conditional Python expression (`if ... else ...`) in a symbolic function.
Suppose I have a piecewise function *k(n)* defined for *n* = 1,2,3... as in the following pseudocode:
k(n) =
2 if n = 1
n otherwise
I compose this with another function *g(x)* and wish to integrate the result. For example,
f(x)=g(x)/k(n)
f(n=...).integrate(x, 0, 1)
How can implement a non-evaluating conditional in a symbolic Sage function?terrygarciaFri, 21 Jul 2017 18:23:17 +0200https://ask.sagemath.org/question/38347/