Maple to Mupad Conversion, huge powers.
5 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
A university project I've been given has been programmed back when Matlab used Maple, meaning having to use very out of date matlab versions. The maple code is as follows,
maple('check1:=gcd((g&^lambda mod nsquare-1)/n,n)');
The following is the code I'm trying to use to update this to Mupad,
gLam = feval(symengine,'_mod',g^lambda,nsquare-1)/n;
With the gcd being handled later, the main issue is that the values of g are in the region of 137391914088787611368 and the values of lambda around 7427535290. With Maple these seem to be handled fine even though its a gigantic number, is this totally unmanageable by Mupad or is there a trick that I could use.
The current error is the following,
Error using mupadmex
Error in MuPAD command: Integer too large in
context. [_power]
Evaluating: symobj::mpower
Error in sym/privBinaryOp (line 1694)
Csym = mupadmex(op,args{1}.s,
args{2}.s, varargin{:});
Error in sym/mpower (line 194)
B = privBinaryOp(A, p, 'symobj::mpower');
Error in randomg2 (line 6)
gLam =
feval(symengine,'_mod',g^lambda,nsquare-1)/n;
Error in keygen2 (line 32)
[g]=randomg2(lambda,n,nsquare);
Thanks
David
2 Kommentare
Walter Roberson
am 13 Nov. 2012
In Maple, &^ is an "inert" operator, signifying that an exponential operation exists there but is not to be calculated immediately. Maple's mod operator knows how to deal with such operations, and there are techniques for calculating the mod of an exponential that do not always require that the full value be calculated.
I do not know if MuPAD has an equivalent.
Akzeptierte Antwort
Weitere Antworten (0)
Siehe auch
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!