A community for students.

Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

anonymous

  • 4 years ago

Define a function f(x) such that f(f(x)) = -x

  • This Question is Closed
  1. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    \[f(x)=-|x|\]

  2. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    \[f(f(x)) = -|-|x||\]\[f(f(-1)) \neq 1 \]

  3. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    @Anwar f(f(x)) = -(-x) = x :-P

  4. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    :/

  5. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    This can be done in a few lines in Python. Python 1, Math 0 :-D

  6. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    why not C?

  7. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    It might be possible in C..... let me think

  8. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    maybe easier in C++

  9. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    because Python (at least the default one) is C's baby, and if Python can do it, then C can :-D

  10. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    in python you can't even i++ :D

  11. JamesJ
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    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?

  12. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    I was hoping someone could figure it out for me :( I think it has to do with complex numbers. f(x) = x*i

  13. JamesJ
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    oh, so it's not a real valued function? Then it's trivial.

  14. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    right

  15. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    but the question said we can't use complex numbers :(

  16. JamesJ
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    In which case, it's not trivial. Do you know the answer? I don't. I'd like you to tell me.

  17. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    I don't know either, but it's one line in Python

  18. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    f = lambda x: (lambda: -x) if (not hasattr(x, '__call__')) else x()

  19. JamesJ
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    decode the line for us and tell us then. You're the Python expert.

  20. JamesJ
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    I can't read that.

  21. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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.

  22. JamesJ
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    Oh, so it's not a regular mathematical function at all.

  23. anonymous
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    is it possible to make it a regular math function?

  24. JamesJ
    • 4 years ago
    Best Response
    You've already chosen the best response.
    Medals 1

    i don't think so, but i'll think about it a little.

  25. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy

Your question is ready. Sign up for free to start getting answers.

spraguer (Moderator)
5 → View Detailed Profile

is replying to Can someone tell me what button the professor is hitting...

23

  • Teamwork 19 Teammate
  • Problem Solving 19 Hero
  • You have blocked this person.
  • ✔ You're a fan Checking fan status...

Thanks for being so helpful in mathematics. If you are getting quality help, make sure you spread the word about OpenStudy.

This is the testimonial you wrote.
You haven't written a testimonial for Owlfred.