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