0

Can any create a c program to check a function is one to one and onto or both

it is a mathmatical problem in which we check the function is one to one and onto or both one to means a every element of domain have image in codomain and every element have unique image onto mean every element of codomain have image in domain

9th Oct 2018, 12:57 PM
PIYUSH AGRAWAL
PIYUSH AGRAWAL - avatar
1 Antwort
0
To solve this, you need to input the entire domain, the entire range and the relation with all the mappings. These can be read in arrays of doubles and a structure of two doubles to store x and R(x) respectively. Then you can first check for onto, by checking if all elements in the range array are present in one of the relation array structure's second member. Then for one-one, store all the R(x) from the relation array into another array. Then run a loop through the relation's elements, and in each iteration : 0) Find the match for R(x)[i] in the new array. If match is not found, the relation is not one-one. 1) Remove all occurrences of the matched R(x) from the new array. Now if you reach the end, your function is one-one. As for the code, you should implement it yourself. Then if you face any errors or get stuck, we will be happy to help.
9th Oct 2018, 1:23 PM
Solo Wanderer 4315
Solo Wanderer 4315 - avatar