how to use mod() with symbolic numbers?

1 view (last 30 days)
Paul
Paul on 2 May 2019
Is this possible to do in MatLab?
for mod(a,b) == 3, find possible values of a and b
syms a b integer positive
assumeAlso((1 <= a) & (a <= 10));
assumeAlso((1 <= b) & (b <= 10));
e1 = mod(a,b) == 3;
sol = solve([e1], [a, b]);
aSol = sol.a;
bSol = sol.b;
Matlab gives an error..
Error using symengine
Invalid second argument.
Error in sym/privBinaryOp (line 1022)
Csym = mupadmex(op,args{1}.s, args{2}.s, varargin{:});
Error in sym/mod (line 18)
C = privBinaryOp(A, B, 'symobj::zipWithImplicitExpansion', 'symobj::modp');
Error in simple_easter (line 5)
e1 = mod(a,b) == 3;
My actual problem is much more complex, but this is a simple example which demonstrates the error
Thanks

Answers (0)

Products


Release

R2019a

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!