Least possible value for a modulo with given remainders
Ältere Kommentare anzeigen
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 Kommentare
John D'Errico
am 8 Dez. 2015
Bearbeitet: John D'Errico
am 8 Dez. 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
am 9 Dez. 2015
Riven Yvet
am 9 Dez. 2015
Antworten (0)
Kategorien
Mehr zu Solver Outputs and Iterative Display finden Sie in Hilfe-Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!