i need a mathematical function F which is defined as F(x) = 0 if x equal to zero and F(x) = 1 if x is not equal to zero. can F(x) be represented in the form of a single mathematical expression in terms of x?
- Anybody can ask a question
- Anybody can answer
- The best answers are voted up and rise to the top
Any algorithm that does what you want will be dependent upon the F(x) you are working with. Some F's are easy-for x^2 you can take the integer sqrt of x, square it, and see if you get x back again. For x^x you could just store a table of them up to the largest number of interest and search the table. Unless you are doing arbitrary precision work it will be much less than 1000 entries.