At vero eos et accusamus et iusto odio dignissimos ducimus qui blanditiis praesentium voluptatum deleniti atque corrupti quos dolores et quas molestias excepturi sint occaecati cupiditate non provident, similique sunt in culpa qui officia deserunt mollitia animi, id est laborum et dolorum fuga. Et harum quidem rerum facilis est et expedita distinctio. Nam libero tempore, cum soluta nobis est eligendi optio cumque nihil impedit quo minus id quod maxime placeat facere possimus, omnis voluptas assumenda est, omnis dolor repellendus. Itaque earum rerum hic tenetur a sapiente delectus, ut aut reiciendis voluptatibus maiores alias consequatur aut perferendis doloribus asperiores repellat.
\[f(f(x)) = -|-|x||\]\[f(f(-1)) \neq 1 \]
@Anwar f(f(x)) = -(-x) = x :-P
This can be done in a few lines in Python. Python 1, Math 0 :-D
why not C?
It might be possible in C..... let me think
maybe easier in C++
because Python (at least the default one) is C's baby, and if Python can do it, then C can :-D
in python you can't even i++ :D
What's the definition of the function? Don't give us Python code; the code is just the encapsulation of that definition. What is the definition itself in ordinary mathematical notation?
I was hoping someone could figure it out for me :( I think it has to do with complex numbers. f(x) = x*i
oh, so it's not a real valued function? Then it's trivial.
but the question said we can't use complex numbers :(
In which case, it's not trivial. Do you know the answer? I don't. I'd like you to tell me.
I don't know either, but it's one line in Python
f = lambda x: (lambda: -x) if (not hasattr(x, '__call__')) else x()
decode the line for us and tell us then. You're the Python expert.
I can't read that.
it just says f is a function that returns a function that returns the additive inverse of a number if the argument is not a function and calls its input otherwise.
Oh, so it's not a regular mathematical function at all.
is it possible to make it a regular math function?
i don't think so, but i'll think about it a little.