Hello all,
I have a simple code which computes applies the Chinese Remainder theorem
(for a single variable) given three input congruence equations to solve for
x; not very elegant but it works:
My query, is it possible to make this more generalised and vary the number
of input equations and give
Cleaned up the code using Loops
clear
// Chinese Remainder Theorem (CRT) for 3 congruence equations// e.g. x
≡ 3 mod 5; x ≡ 1 mod 7; x ≡ 6 mod 8// result ≡ 78 mod 280
m=evstr(x_dialog(['Moduli values:
'],'1'));a=evstr(x_dialog(['Remainder values: '],'1'));m1=m(1);
m2=m(2); m3=m(3);a1=a(1); a2=a(2)
Sorted the code with multiple equations. Not too sure how to deal with the
messagebox list of equations.
Still have to do that manually - unless there is a way to automatically
build this?
Can this multiple text string be done via a for loop to build a list ?
Thanks
__
Having an issue with the code:
Tried: x ≡ 2 mod 11; 3 mod 12; 4 mod 13; 5 mod 17; 6 mod 19 (result should
be 150999 but get 442719)
Also checked x ≡ 4 mod 11; 3 mod 17 (result should be 37 but get 136)
However, 3 equations work fine!
I have pinned down the problem to M_inv, where it is not loopin
As a test, I increased the value n (iterations) and that forced it to
converge on the value 150999.
Sounds like I need a test of convergence.
On Sun, 1 May 2022 at 08:37, Lester Anderson wrote:
> Having an issue with the code:
>
> Tried: x ≡ 2 mod 11; 3 mod 12; 4 mod 13; 5 mod 17; 6 mod 19 (res
Hello,
> De : De la part de Lester Anderson
> Envoyé : samedi 30 avril 2022 07:15
>
> My query, is it possible to make this more generalised and vary the
> number of input equations and give the user an option to specify the number
> of equations?
I don't know this problem and its solution but a