f | def ADD(f, g): | f | def ADD(f, g): |
n | def sum(x): | n | def newfun(x): |
| a = f(x) if callable(f) else f | | fnew = f(x) if callable(f) else f |
| b = g(x) if callable(g) else g | | gnew = g(x) if callable(g) else g |
| return a + b | | return fnew + gnew |
| return sum | | return newfun |
| | | |
| | | |
| def SUB(f, g): | | def SUB(f, g): |
n | def sub(x): | n | def newfun(x): |
| a = f(x) if callable(f) else f | | fnew = f(x) if callable(f) else f |
| b = g(x) if callable(g) else g | | gnew = g(x) if callable(g) else g |
| return a - b | | return fnew - gnew |
| return sub | | return newfun |
| | | |
| | | |
| def MUL(f, g): | | def MUL(f, g): |
n | def mul(x): | n | def newfun(x): |
| a = f(x) if callable(f) else f | | fnew = f(x) if callable(f) else f |
| b = g(x) if callable(g) else g | | gnew = g(x) if callable(g) else g |
| return a * b | | return fnew * gnew |
| return mul | | return newfun |
| | | |
| | | |
| def DIV(f, g): | | def DIV(f, g): |
t | def div(x): | t | def newfun(x): |
| a = f(x) if callable(f) else f | | fnew = f(x) if callable(f) else f |
| b = g(x) if callable(g) else g | | gnew = g(x) if callable(g) else g |
| return a / b | | return fnew / gnew |
| return div | | return newfun |
| | | |