How to fix this problem 0^0 in Matlab !?

조회 수: 1 (최근 30일)
Bewar Yousif Ali
Bewar Yousif Ali 2023년 11월 27일
댓글: Walter Roberson 2023년 12월 11일
It is crucial to understand that this expression could be used in problems related to engineering, physics, mathematics, or any other aspect of real life.
Typically, Matlab is used to solve PDE and ODE problems. Perhaps users calculated this term 0^0 incorrectly in the process.
>> % Reviewed by Bewar Yousif Ali
>> % How to fix this problem 0^0 in Matlab !?
>> % Mathematically, x^0=1 if x≠0 is equal 1 else undefined(NaN)
>> 0^0
ans =
1
>> f=@(x,y) x^y;
>> f(0,0)
ans =
1
>> v=[2 0 5 -1];
>> v.^0
ans =
1 1 1 1
  댓글 수: 1
Walter Roberson
Walter Roberson 2023년 12월 11일
There are a lot of contexts in which is considered well defined.
For example, if you have is it really necessary to say that you have to define that as piecewise(x == 0, undefined, x^2 + 2*x + 1) or can you just define it as x^2 + 2*x + 1 ? If you are writing the derivative of c*x^n for integer n, is it really necessary to define it as piecewise(n == 1 & x == 0, undefined, (c*n)*x^(n-1)) or as piecewise(n == 1 & x == 0, c, (c*n)*x^(n-1)) ? Is the derivative of c*x to be defined differently than the derivative of c*x^1, or do we just have to carry around a whole bunch of special cases to protect against the possibility of evaluating 0^0 when the relevant formula would work fine for any other x^0 ?

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

답변 (0개)

태그

Community Treasure Hunt

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

Start Hunting!

Translated by