Least possible value for a modulo with given remainders
Mostrar comentarios más antiguos
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 comentarios
John D'Errico
el 8 de Dic. de 2015
Editada: John D'Errico
el 8 de Dic. de 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
el 9 de Dic. de 2015
Riven Yvet
el 9 de Dic. de 2015
Respuestas (0)
Categorías
Más información sobre Solver Outputs and Iterative Display en Centro de ayuda y File Exchange.
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!