When i try this sym('x')^y i get an error message

조회 수: 1 (최근 30일)
Joe Bennett
Joe Bennett 2020년 12월 11일
댓글: Joe Bennett 2020년 12월 11일
a = sym(18008617784390347685963)^60322355516214665580
I get an error message, can anyone help please.
Cheers

답변 (2개)

Vladimir Sovkov
Vladimir Sovkov 2020년 12월 11일
You cannot compute this directly because the integers are larger than matlab is able to treat.
You can try
b = sym(log10(18008617784390347685963)*60322355516214665580)
b =
1342502999708137684992
so that the value you are interested in is
  댓글 수: 1
Vladimir Sovkov
Vladimir Sovkov 2020년 12월 11일
편집: Vladimir Sovkov 2020년 12월 11일
or, even better
nd=64; % number of decimal digits you want to get your result with
b = vpa(sym(log10(sym(18008617784390347685963))*60322355516214665580),nd)
% b = 1342502999708137528766.63000133154837392990340259044889069097638
a=10^mod(b,1)
\times 10^ (floor(b))

댓글을 달려면 로그인하십시오.


Daniel Pollard
Daniel Pollard 2020년 12월 11일
편집: Daniel Pollard 2020년 12월 11일
I haven't used the symbolic toolbox before, but when I type 18008617784390347685963^60322355516214665580 into my Matlab commandline it returns Inf. Computers can't handle very big numbers, and that number will be one with over 1e21 digits. You haven't told us the error message (which you should, as a rule) but this seems most likely. Google can act as a calculator and that returns 'undefined'.
What on earth do you need to store a number that big for anyway?
Edit A correction - I hilariously underestimated how many digits the number would have. It's over 1e21. I tried
randi([1 9], 1, 1e11)
and Matlab tells me that array would require 750GB of RAM to create. This has made me more curious as to what this number is you're trying to calculate.
  댓글 수: 1
Joe Bennett
Joe Bennett 2020년 12월 11일
so im trying to use matlab to do the digital signature algorithm...
p = 30167674936870980426367;
q = 17456345243;
g = 18008617784390347685963;
y = 6172647251731232412543;
H = 15296664068;
r = 16772231458;
s = 3953283568;
% % let u_1 = u;
% % let u_2 = v;
% % H = mod(s*u, q)
% % r = mod(s*v, q)
syms u k integer
eqn = s*u - q*k == H;
[u, k] = solve(eqn,[u k]);
u
syms v l integer
eqn = s*v - q*l == r;
[v, l] = solve(eqn,[v l]);
v
a = sym(g)^u;
b = sym(y)^v;
remainder = powermod(10, a+b, p)
mod(remainder, q) % should equal r
This is my code, all the values at the top were given. For the end of this algorithm i need to find the remainder of (g^u)*(y^v) | p.

댓글을 달려면 로그인하십시오.

카테고리

Help CenterFile Exchange에서 Number Theory에 대해 자세히 알아보기

태그

Community Treasure Hunt

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

Start Hunting!

Translated by