Maple to Mupad Conversion, huge powers.
古いコメントを表示
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 件のコメント
Walter Roberson
2012 年 11 月 13 日
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.
David
2012 年 11 月 13 日
採用された回答
その他の回答 (0 件)
カテゴリ
ヘルプ センター および File Exchange で Code Performance についてさらに検索
製品
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!