nthroot(X, N) when X is inf

3 次查看(过去 30 天)
CapaB
CapaB 2012-6-23
Id like to take the 4537-th root of a number X.
The number X is too large for matlab to handle so it says Inf.
The number X comes from a for-loop where i go from i=1:4537 and X gets larger and larger.
Can i somehow use the factors of 4537
factor(4537)
ans =
13 349
and take the roots of X in intervalls so it wont reach inf, or something?
  1 个评论
Star Strider
Star Strider 2012-6-23
Please post the code of the 'for' loop so we can understand how you create X. What is X?

请先登录,再进行评论。

回答(2 个)

Walter Roberson
Walter Roberson 2012-6-23
A real root of a number can only be larger than the number if the number is between -1 and +1, and in that range the root itself is limited to -1 to +1. The only way for the 4537'th root of a number to be infinity is if the number itself is infinity, and if that is the case then factoring for roots is not going to produce anything other than infinity.
Factoring can only help if you apply it at the stage of constructing the number whose root is being taken so that it does not reach overflow (represented by infinity.)
Factoring itself is probably not going to work because you are going to run into prime numbers. You should probably instead be looking at log representation.

CapaB
CapaB 2012-6-24
It wasnt the 4537th root of the number that was inf, it was the number X itself.
But actually it was simple mathematical mistake and i managed to write the code without having to use nthroot at all.
But thank you for mentioning log representation. That should probably work. Good to know if i ran into that problem again..

类别

Help CenterFile Exchange 中查找有关 Arithmetic Operations 的更多信息

标签

Community Treasure Hunt

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

Start Hunting!

Translated by