Least possible value for a modulo with given remainders
Afficher commentaires plus anciens
Hello guys. Im just asking how do you code a program that gets the LEAST value of a given modulo and remainder. Say example
Z = [3 4 5]
R = [2 1 4]
The inputs will give an output that gives the LEAST possible value for the given. So the answer to the above is 29.
3 commentaires
John D'Errico
le 8 Déc 2015
Modifié(e) : John D'Errico
le 8 Déc 2015
In general, you would use the chinese remainder theorem for problems of this ilk. Your question is not terribly clear though. Are you asking to solve for x, such that
mod(x,[3 4 5]) == [2 1 4]
You code it by writing the code. You COULD use intlinprog. if you think about the meaning of those modular equations.
mod(x,3) == 2
is equivalent to
x == 3*u1 + 2
likewise for the others. Then can you solve for x,u1,u2,u3, such that x is minimized, is non-negative, AND is integer, along with u1,u2,u3?
help intlinprog
Riven Yvet
le 9 Déc 2015
Riven Yvet
le 9 Déc 2015
Réponses (0)
Catégories
En savoir plus sur Solver Outputs and Iterative Display dans Centre d'aide et File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!