MATLAB: Do I get the message NaN

nansymbolic

Hello,
I would like to calculate the expression below. But I always get: NaN. I canĀ“t find my mistake.
Can somebody help me?
I4=5.718534314;
I5=-0.001546715453;
Cov__B_C_direct =1125899906842624*exp(I4^(4831891999187463/1125899906842624))*exp(8187485477687969/1715238139330560)*((230090095199403*...
exp(-I4^(4831891999187463/1125899906842624))*exp(-8187485477687969/1715238139330560)*I4^...
(3705992092344839/1125899906842624))/1233348233694652400 - (2558136220007576158378628793351*...
exp(-I4^(4831891999187463/1125899906842624))*exp(-8187485477687969/1715238139330560)*I5*I4^(2580092185502215/1125899906842624))/10681743549394799937933824491520 + ...
(3335311470258831134378888053767*exp(-I4^(4831891999187463/1125899906842624))*exp(-8187485477687969/1715238139330560)*...
I5* I4^(3705992092344839/562949953421312))/10681743549394799937933824491520)

Best Answer

When I test in a different software package, I find no problem with the representation, even if I convert the floating point numbers to rationals. I do not find any portion of the expression to be particularly large.
An algebraic equivalent to the expression is
(16191151046901145333338734592/77084264605915775) * I4^(3705992092344839/1125899906842624) - (2558136220007576158378628793351/9487294105343480) * I5 * I4^(2580092185502215/1125899906842624) + (3335311470258831134378888053767/9487294105343480) * I5 * I4^(3705992092344839/562949953421312)
Caution: remember that all of those fractions are going to be evaluated to floating point numbers, losing precision in the process. If you do not want that, then you need to use the Symbolic Toolkit, with code such as
Cov__B_C_direct = sym('1125899906842624') * exp(I4^(sym('4831891999187463') / sym('1125899906842624'))) * exp(sym('8187485477687969') / sym('1715238139330560')) * ((sym('230090095199403') * exp(-I4^(sym('4831891999187463') / sym('1125899906842624'))) * exp(-sym('8187485477687969') / sym('1715238139330560')) * I4^(sym('3705992092344839') / sym('1125899906842624'))) / sym('1233348233694652400') - (sym('2558136220007576158378628793351') * exp(-I4^(sym('4831891999187463') / sym('1125899906842624'))) * exp(-sym('8187485477687969') / sym('1715238139330560')) * I5 * I4^(sym('2580092185502215') / sym('1125899906842624'))) / sym('10681743549394799937933824491520') + (sym('3335311470258831134378888053767') * exp(-I4^(sym('4831891999187463') / sym('1125899906842624'))) * exp(-sym('8187485477687969') / sym('1715238139330560')) * I5 * I4^(sym('3705992092344839') / sym('562949953421312'))) / sym('10681743549394799937933824491520'))
Or in the reduced form,
Cov__B_C_direct = (sym('16191151046901145333338734592') / sym('77084264605915775')) * I4^(sym('3705992092344839') / sym('1125899906842624')) - (sym('2558136220007576158378628793351') / sym('9487294105343480')) * I5 * I4^(sym('2580092185502215') / sym('1125899906842624')) + (sym('3335311470258831134378888053767') / sym('9487294105343480')) * I5 * I4^(sym('3705992092344839') / sym('562949953421312'))