Take the 2-minute tour ×
Mathematics Stack Exchange is a question and answer site for people studying math at any level and professionals in related fields. It's 100% free, no registration required.

i want to know if there is a function for example that gives the same result for a set of noncontiguous reals. i want to have these results

f(10)=25 f(25)=25 f(34)=25 f(85)=25 f(14)=25 f(13)=25 for example

in fact i have: - A number between 1 and 536870912 - Several sets of noncontiguous numbers
- A black box which must do a transformation to the sets - Each transformation must be unique and gives a number between 1 and 255 I want to know which thing (function or anything else ) that i can have in the black box that does this transformation?

{4, 212, 10, 35000} ==> f(x) ==> 250
{584, 12, 140, 5} ==> f(x) ==> 15 I mean passing a given set by f(x) gives always the same result for the passed set or i can imagine that for each element of a set i can have f(4)=250, f(212)=250, f(10)=250, f(35000)=250

Thank you

share|improve this question
    
For your example, that would be the constant function $f(x)=25$... If you want to get different results, see my answer. –  Dennis Gulko Apr 30 '12 at 9:38
3  
This is extremely unclear - while Dennis' function satisfies the first requirements you have give, I can't figure out what would satisfy the rest of them. For example, how is this number between $1$ and $536870912$ supposed to fit into it? What do you mean by doing a "transformation to the sets", and so on. –  Martin Wanvik Apr 30 '12 at 9:41
add comment

2 Answers

Note that a function $f: A \to B$, where $A$ and $B$ are sets, is a rule that assigns to each element $a$ in $A$, a single element $f(a)$ in $B$. So your new question is no less trivial than the first one you asked, in which one solution was the constant function $f(x) = 25$, defined, say on $\mathbb{R}$. It is just a matter of writing down the appropriate rule (though it is a wholly different matter if you want it to be, say, continuous, differentiable or polynomial - in that case, something like Dennis Gulko's answer is more appropriate).

If I'm interpreting your question correctly, you have a collection $A_1, A_2, \ldots, A_n$ of finite sets of real numbers, and you want the function to assign to each member of the set $A_i$ the number $a_i$. So, we can define a function $f: A \to \mathbb{R}$, whose domain $A$ is $A_1 \cup A_2 \cup \ldots \cup A_n$, where $$ f(x) := a_i, \text{ if } x \in A_i $$ Note that in order for this to be unambiguous, no two sets can have an element in common (in other words, $A_i \cap A_j = \emptyset$ whenever $i \neq j$).

share|improve this answer
    
Yes you are interpreting my question well Thank you, so what should be f(x) in this case –  Boubouh Apr 30 '12 at 11:14
2  
@Boubouh: I said what $f(x)$ is, didn't I? –  Martin Wanvik Apr 30 '12 at 11:19
add comment

You should use polynomial interpolation.
If you want a polynomial $f(x)$ that at the points $x_1,...,x_n$ has value $y_1,...,y_n$ respectively, define the following: $$p_i(x)=\frac{(x-x_1)\cdot...\cdot\widehat{(x-x_i)}\cdot...\cdot(x-x_n)}{(x_i-x_1)\cdot...\cdot\widehat{(x_i-x_i)}\cdot...\cdot(x_i-x_n)}$$ (where $\widehat{(x-x_i)}$ denotes a term that is not included) Now $p_i(x_j)=0$ for all $j\neq i$ and $p_i(x_i)=1$.
Define $f(x)=\sum_{i=1}^n y_ip_i(x)$.

share|improve this answer
add comment

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.