f | def ADD(f, g): | f | def ADD(f, g): |
n | if (callable(f) and callable(g)): | n | if callable(f) and callable(g): |
| return lambda x: f(x) + g(x) | | return lambda x: f(x)+g(x) |
| if (callable(f)): | | if callable(f): |
| return lambda x: f(x) + g | | return lambda x: f(x)+g |
| if (callable(g)): | | if callable(g): |
| return lambda x: f + g(x) | | return lambda x: f+g(x) |
| return lambda x: f + g | | return lambda x: f+g |
| | | |
| | | |
| def SUB(f, g): | | def SUB(f, g): |
n | if (callable(f) and callable(g)): | n | if callable(f) and callable(g): |
| return lambda x: f(x) - g(x) | | return lambda x: f(x)-g(x) |
| if (callable(f)): | | if callable(f): |
| return lambda x: f(x) - g | | return lambda x: f(x)-g |
| if (callable(g)): | | if callable(g): |
| return lambda x: f - g(x) | | return lambda x: f-g(x) |
| return lambda x: f - g | | return lambda x: f-g |
| | | |
| | | |
| def MUL(f, g): | | def MUL(f, g): |
n | if (callable(f) and callable(g)): | n | if callable(f) and callable(g): |
| return lambda x: f(x) * g(x) | | return lambda x: f(x)*g(x) |
| if (callable(f)): | | if callable(f): |
| return lambda x: f(x) * g | | return lambda x: f(x)*g |
| if (callable(g)): | | if callable(g): |
| return lambda x: f * g(x) | | return lambda x: f*g(x) |
| return lambda x: f * g | | return lambda x: f*g |
| | | |
| | | |
| def DIV(f, g): | | def DIV(f, g): |
t | if (callable(f) and callable(g)): | t | if callable(f) and callable(g): |
| return lambda x: f(x) / g(x) | | return lambda x: f(x)/g(x) |
| if (callable(f)): | | if callable(f): |
| return lambda x: f(x) / g | | return lambda x: f(x)/g |
| if (callable(g)): | | if callable(g): |
| return lambda x: f / g(x) | | return lambda x: f/g(x) |
| return lambda x: f / g | | return lambda x: f/g |
| | | |