필터 지우기
필터 지우기

Exponential of very large number

조회 수: 11 (최근 30일)
Teshome Kumsa
Teshome Kumsa 2021년 8월 28일
댓글: Steven Lord 2021년 8월 28일
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
Matt J
Matt J 2021년 8월 28일
It wouldn't make sense to take exp() to any greater precision unless you are going to take the log of it later.

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

답변 (1개)

Chunru
Chunru 2021년 8월 28일
편집: Chunru 2021년 8월 28일
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(:)
xstr = 2×1 string array
"0.47516 x 10 ^ -1023" "0.1038 x 10 ^ 127565"
  댓글 수: 3
Chunru
Chunru 2021년 8월 28일
The code uses your edited numbers now.
Steven Lord
Steven Lord 2021년 8월 28일
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?

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

카테고리

Help CenterFile Exchange에서 Historical Contests에 대해 자세히 알아보기

제품

Community Treasure Hunt

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

Start Hunting!

Translated by