# Remainder theorem and computation in mat lab

Respected Mathematicians, Suppose we are given 10 remainders each of 10 digits for given ten distinct prime bases each of 10 digits. Find the rational number that corresponds to these remainders in the specified prime bases using Matlab. Observe that the rational number could consist more than 40 digits in numerator as well as those in denominator. Standard precision of Matlab does not allow more than 16 digits. But vpa (variable precision arithmetic) in Matlab will allow much more than 16 digits.

Consider, for example, the remainders 1, 1, 2 corresponding to the prime bases 3, 5, 7, respectively. What will be the rational number? The answer is 16. I would like to know the generalization of this part, especially about the rationals.

Thanking you all.

-
I think I have not made my point clear. I have no problem with Chinese Remainder Theorem (CRT). We have used this in many of our problems on error-free computations, had written programs in Pascal/Matlab for solving small problems. But now I am interested in Matlab (and not the obsolete Pascal) for solving large problems error-free. – BMSA Jul 30 '12 at 4:27
The problem is with high (larger than standard) precision computation in Matlab. So Matlab and possibly the vpa command in Matlab for variable precision computations need to be used for implementing CRT. We want to implement multiple residue arithmetic to solve large linear optimization problems error-free. For this, everything can be done very easily in Matlab standard precision except the implementation of CRT. – BMSA Jul 30 '12 at 4:27
The main issue is how to implement CRT for solving error-free (reasonably) large real-world problems and not CRT/algorithm/mathematics for small problems. Please discuss more precisely. – BMSA Jul 30 '12 at 4:28