f | def ADD(f, g): | f | def ADD(f, g): |
n | def h(x): | n | def newfun(x): |
| fx = f(x) if callable(f) else f | | fnew = f(x) if callable(f) else f |
| gx = g(x) if callable(g) else g | | gnew = g(x) if callable(g) else g |
| return fx + gx | | return fnew + gnew |
| return h | | return newfun |
| | | |
| | | |
| def SUB(f, g): | | def SUB(f, g): |
n | def h(x): | n | def newfun(x): |
| fx = f(x) if callable(f) else f | | fnew = f(x) if callable(f) else f |
| gx = g(x) if callable(g) else g | | gnew = g(x) if callable(g) else g |
| return fx - gx | | return fnew - gnew |
| return h | | return newfun |
| | | |
| | | |
| def MUL(f, g): | | def MUL(f, g): |
n | def h(x): | n | def newfun(x): |
| fx = f(x) if callable(f) else f | | fnew = f(x) if callable(f) else f |
| gx = g(x) if callable(g) else g | | gnew = g(x) if callable(g) else g |
| return fx * gx | | return fnew * gnew |
| return h | | return newfun |
| | | |
| | | |
| def DIV(f, g): | | def DIV(f, g): |
t | def h(x): | t | def newfun(x): |
| fx = f(x) if callable(f) else f | | fnew = f(x) if callable(f) else f |
| gx = g(x) if callable(g) else g | | gnew = g(x) if callable(g) else g |
| return fx / gx | | return fnew / gnew |
| return h | | return newfun |
| | | |