Exponential of very large number
11 Ansichten (letzte 30 Tage)
Ältere Kommentare anzeigen
Hello all! I was trying to calculate exponental of some vectors. Actually my vector has very big entries(each entries are Stresses accumulated during earquakes. That is why they are very big).
For example
exp([-235628865.417257 29372700213.5032]/10.^5)
It returns ans=
0 Inf
I need a comment on it.
1 Kommentar
Matt J
am 28 Aug. 2021
It wouldn't make sense to take exp() to any greater precision unless you are going to take the log of it later.
Antworten (1)
Chunru
am 28 Aug. 2021
Bearbeitet: Chunru
am 28 Aug. 2021
Those number are beyond the scope of double numbers. You can try vpa. Alternatively, keep track of the mantisa and exponent yourself as follows:
a=log10(exp(1))*([-235628865.417257 29372700213.5032]/10.^5);
aint = ceil(a);
afrac = a -aint;
xm = 10.^afrac;
xe = aint;
xstr = xm(:)+" x 10 ^ "+xe(:)
3 Kommentare
Steven Lord
am 28 Aug. 2021
What are you hoping to do with those answers? Are you planning on dividing them by exp(x) for some other value of large magnitude?
Siehe auch
Kategorien
Mehr zu Historical Contests finden Sie in Help Center und File Exchange
Produkte
Community Treasure Hunt
Find the treasures in MATLAB Central and discover how the community can help you!
Start Hunting!