How to apply a function on a number which is in 'sym' format?
1 Ansicht (letzte 30 Tage)
Ältere Kommentare anzeigen
Ammy
am 21 Feb. 2022
Beantwortet: Walter Roberson
am 21 Feb. 2022
p = sym('2')^100 - 15;
results = p_inverse(p-1, p);
where the function p_inverse is defined as;
function ia = p_inverse(a, p)
[~,ia] = gcd(a,p);
end
How can I find p_inverse for such p as defined above?
0 Kommentare
Akzeptierte Antwort
Walter Roberson
am 21 Feb. 2022
p = sym('2')^100 - 15;
results = p_inverse(p-1, p)
mod(results * (p-1),p)
function inv = p_inverse(a, p)
[~, ia] = gcd(a,p);
inv = mod(ia, p);
end
0 Kommentare
Weitere Antworten (0)
Siehe auch
Kategorien
Mehr zu Special Values finden Sie in Help Center und File Exchange
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!